Esempio n. 1
0
        /// <summary>
        /// clones trees for root, parents and children and sets the correct node
        /// </summary>
        /// <param name="target">target we want to clone</param>
        /// <returns></returns>
        private static IqTarget CloneIqTrees(IqTarget target)
        {
            //initialize utilities
            var util = new IqTargetUtilities();

            //find root
            var rootNode = target.RootTarget;

            //this returnes the copied tree
            var tempTarget = util.Clone(rootNode);

            //select current node along the tree.  we need to mangle the charge and the ID to ensure uniqueness
            var selectID          = target.ID;
            var selectChargeState = target.ChargeState;

            var targetList = new List <IqTarget>();

            targetList.Add(tempTarget);

            var nodeLevelTargets = util.GetTargetsFromNodelLevel(targetList, target.NodeLevel);

            var s = (from n in nodeLevelTargets where n.ID == selectID && n.ChargeState == selectChargeState select n).Take(1).ToList();

            return(s[0]);
        }
Esempio n. 2
0
        /// <summary>
        /// Copies the target parameter to a new IqTarget.
        /// </summary>
        /// <param name="target">target parameter</param>
        public IqTarget(IqTarget target)
            : this()
        {
            var util = new IqTargetUtilities();

            util.CopyTargetProperties(target, this);
        }
Esempio n. 3
0
        /// <summary>
        /// clones simple properties and deeper trees
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public IqTarget DeepClone(IqTarget target)
        {
            var util = new IqTargetUtilities();

            //basic copy

            //TODO: the problem is here is we are creating an IqTargetBasic, which might not fit everyone's liking
            IqTarget copiedTarget = new IqTargetBasic();

            CopyTargetProperties(target, copiedTarget);

            //this returnes the copied tree
            var deepCopy = CloneIqTrees(target);

            //set root via private set
            copiedTarget.RootTarget = deepCopy.RootTarget;

            //set parent target
            copiedTarget.ParentTarget = deepCopy.ParentTarget;

            //set the child targets
            var childTargets = deepCopy.ChildTargets().ToList();

            if (deepCopy.HasChildren() && childTargets.Count > 0)
            {
                foreach (var subtarget in childTargets)
                {
                    copiedTarget.AddTarget(subtarget);
                }
            }

            return(copiedTarget);
        }
Esempio n. 4
0
        public List <IqTarget> GetTargetsFromNodelLevel(IqTarget target, int level)
        {
            var iqTargetList = new List <IqTarget>();

            iqTargetList.Add(target);

            return(GetTargetsFromNodelLevel(iqTargetList, level));
        }
Esempio n. 5
0
        public void AssignWorkflowToChildren(IqWorkflow workflow, IqTarget target, int childLevel = 1)
        {
            var targetsAtGivenNodeLevel = _targetUtilities.GetTargetsFromNodelLevel(target, childLevel);

            foreach (var childIqTarget in targetsAtGivenNodeLevel)
            {
                childIqTarget.SetWorkflow(workflow);
            }
        }
Esempio n. 6
0
        public IqResult(IqTarget target)
        {
            _labelFreeResultExporter = new IqLabelFreeResultExporter();
            _childResults            = new List <IqResult>();

            Target            = target;
            IqResultDetail    = new IqResultDetail();
            CorrelationData   = new ChromCorrelationData();
            FitScore          = 1;
            InterferenceScore = 1;
            IsExported        = true;
        }
Esempio n. 7
0
        /// <summary>
        /// Sets the parents NET value based on the scan numbers observed in the children.
        /// </summary>
        public void setParentNetFromChildren(IqTarget target)
        {
            var children = target.ChildTargets();
            var scanList = new List <int>();

            foreach (IqChargeStateTarget chargeStateTarget in children)
            {
                scanList.Add(chargeStateTarget.ObservedScan);
            }
            scanList.Sort();
            target.ElutionTimeTheor = Run.NetAlignmentInfo.GetNETValueForScan(scanList[scanList.Count / 2]);
        }
Esempio n. 8
0
        public List <IqTarget> CreateChargeStateTargets(IqTarget iqTarget, double minMZObs = 400, double maxMZObserved = 1500, int maxChargeStatesToCreate = 100)
        {
            var minCharge = 1;
            var maxCharge = 100;

            UpdateTargetMissingInfo(iqTarget);

            var targetList = new List <IqTarget>();

            for (var charge = minCharge; charge <= maxCharge; charge++)
            {
                var mz = iqTarget.MonoMassTheor / charge + DeconTools.Backend.Globals.PROTON_MASS;

                if (mz < maxMZObserved)
                {
                    if (mz < minMZObs)
                    {
                        break;
                    }

                    IqTarget chargeStateTarget = new IqChargeStateTarget();


                    CopyTargetProperties(iqTarget, chargeStateTarget);

                    //Note - make sure this step is done after the 'CopyTargetProperties'
                    chargeStateTarget.ChargeState = charge;


                    //adjust isotope profile to reflect new charge state
                    if (chargeStateTarget.TheorIsotopicProfile != null && iqTarget.TheorIsotopicProfile != null)
                    {
                        chargeStateTarget.TheorIsotopicProfile = AdjustIsotopicProfileMassesFromChargeState(chargeStateTarget.TheorIsotopicProfile, iqTarget.TheorIsotopicProfile.ChargeState, charge);
                    }

                    chargeStateTarget.MZTheor = chargeStateTarget.MonoMassTheor / chargeStateTarget.ChargeState +
                                                DeconTools.Backend.Globals.PROTON_MASS;

                    targetList.Add(chargeStateTarget);
                }
            }


            //sort by charge state (descending). Then take the top N charge states. Then reorder by charge state (ascending).
            targetList = targetList.OrderByDescending(p => p.ChargeState).Take(maxChargeStatesToCreate).OrderBy(p => p.ChargeState).ToList();



            return(targetList);
        }
Esempio n. 9
0
        public int GetTotalNodelLevels(IqTarget inputTarget)
        {
            var levels = 0;

            var target = inputTarget.RootTarget;


            while (target.HasChildren())
            {
                target = target.ChildTargets().First();
                levels++;
            }

            return(1 + levels);
        }
Esempio n. 10
0
        public IqResult CreateResult(IqTarget target)
        {
            var result = Workflow.CreateIQResult(target);

            if (target.HasParent)
            {
                if (ParentTarget.GetResult() == null)
                {
                    ParentTarget._result = ParentTarget.CreateResult();
                }
                result.ParentResult = ParentTarget._result;
                ParentTarget._result.AddResult(result);
            }

            return(result);
        }
Esempio n. 11
0
        /// <summary>
        /// for cloning a IqTarget. Recursive
        /// </summary>
        /// <param name="target">Input the root target so all children will be cloned</param>
        /// <returns></returns>
        public IqTarget Clone(IqTarget target)
        {
            IqTarget tempTarget = new IqTargetBasic();

            CopyTargetProperties(target, tempTarget);

            //child targets
            var childTargets = target.ChildTargets().ToList();

            if (target.HasChildren() && childTargets.Count > 0)
            {
                foreach (var child in childTargets)
                {
                    var clone = Clone(child);
                    clone.ParentTarget = target;
                    tempTarget.AddTarget(clone);
                }
            }
            return(tempTarget);
        }
Esempio n. 12
0
        public void CopyTargetProperties(IqTarget sourceTarget, IqTarget targetForUpdate, bool updateWorkflow = true)
        {
            targetForUpdate.ID = sourceTarget.ID;
            targetForUpdate.EmpiricalFormula = sourceTarget.EmpiricalFormula;
            targetForUpdate.Code             = sourceTarget.Code;
            targetForUpdate.MonoMassTheor    = sourceTarget.MonoMassTheor;
            targetForUpdate.ChargeState      = sourceTarget.ChargeState;
            targetForUpdate.MZTheor          = sourceTarget.MZTheor;
            targetForUpdate.ElutionTimeTheor = sourceTarget.ElutionTimeTheor;
            targetForUpdate.ScanLC           = sourceTarget.ScanLC;
            targetForUpdate.QualityScore     = sourceTarget.QualityScore;


            targetForUpdate.TheorIsotopicProfile = sourceTarget.TheorIsotopicProfile == null
                             ? null
                             : sourceTarget.TheorIsotopicProfile.CloneIsotopicProfile();

            if (updateWorkflow)
            {
                targetForUpdate.Workflow = sourceTarget.Workflow;
            }
        }
Esempio n. 13
0
        public virtual void UpdateTargetMissingInfo(IqTarget target, bool calcAveragineForMissingEmpiricalFormula = true, bool cysteinesAreModified = false)
        {
            var isMissingMonoMass = target.MonoMassTheor <= 0;

            if (String.IsNullOrEmpty(target.EmpiricalFormula))
            {
                if (!String.IsNullOrEmpty(target.Code))
                {
                    //Create empirical formula based on code. Assume it is an unmodified peptide
                    //target.EmpiricalFormula = _peptideUtils.GetEmpiricalFormulaForPeptideSequence(target.Code);
                    target.EmpiricalFormula = IqCodeParser.GetEmpiricalFormulaFromSequence(target.Code, cysteinesAreModified);
                }
                else
                {
                    if (isMissingMonoMass)
                    {
                        throw new ApplicationException(
                                  "Trying to fill in missing data on target, but Target is missing both the 'Code' and the Monoisotopic Mass. One or the other is needed.");
                    }
                    target.Code             = "AVERAGINE";
                    target.EmpiricalFormula =
                        IsotopicDistributionCalculator.GetAveragineFormulaAsString(target.MonoMassTheor);
                }
            }

            if (isMissingMonoMass)
            {
                target.MonoMassTheor =
                    EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(target.EmpiricalFormula);
            }

            if (target.ChargeState != 0)
            {
                target.MZTheor = target.MonoMassTheor / target.ChargeState + DeconTools.Backend.Globals.PROTON_MASS;
            }
        }
Esempio n. 14
0
 public TopDownIqResult(IqTarget target)
     : base(target)
 {
     ChargeCorrelationData    = new ChargeCorrelationData();
     SelectedCorrelationGroup = new ChargeCorrelationItem();
 }
 protected internal override IqResult CreateIQResult(IqTarget target)
 {
     return(new O16O18IqResult(target));
 }
Esempio n. 16
0
 public void RemoveTarget(IqTarget target)
 {
     _childTargets.Remove(target);
 }
Esempio n. 17
0
 public void AddTarget(IqTarget target)
 {
     target.ParentTarget = this;
     _childTargets.Add(target);
 }
Esempio n. 18
0
 public virtual void TestTarget(IqTarget target)
 {
 }
Esempio n. 19
0
 public O16O18IqResult(IqTarget target)
     : base(target)
 {
 }
Esempio n. 20
0
 //TODO:  later will make this abstract/virtual.  Workflow creates the type of IqResult we want
 protected internal virtual IqResult CreateIQResult(IqTarget target)
 {
     return(new IqResult(target));
 }
Esempio n. 21
0
 public virtual void Execute(IqTarget target)
 {
     throw new NotImplementedException("IqWorkflow not implemented");
 }
Esempio n. 22
0
 public void AssignWorkflowToParent(IqWorkflow workflow, IqTarget target)
 {
     target.RootTarget.SetWorkflow(workflow);
 }