コード例 #1
0
 public BoundAggregatedValue(ValueSlot output, AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
 {
     Output       = output;
     Aggregate    = aggregate;
     Aggregatable = aggregatable;
     Argument     = argument;
 }
コード例 #2
0
 public ExperimentalProteoform(string accession, IAggregatable root, bool is_target)
     : base(accession)
 {
     quant          = new QuantitativeProteoformValues(this);
     this.root      = root;
     this.is_target = is_target;
 }
コード例 #3
0
        public ExperimentalProteoform(string accession, ExperimentalProteoform temp, List <IAggregatable> candidate_observations, bool is_target, bool neucode_labeled)
            : base(accession) //this is for first mass of aggregate components. uses a temporary component
        {
            if (neucode_labeled)
            {
                NeuCodePair ncRoot = new NeuCodePair();
                ncRoot.weighted_monoisotopic_mass = temp.agg_mass;
                ncRoot.intensity_sum = temp.agg_intensity;
                ncRoot.rt_apex       = temp.agg_rt;
                ncRoot.lysine_count  = temp.lysine_count;

                this.root = ncRoot;
                this.aggregated.AddRange(candidate_observations.Where(p => includes(p, this.root)));
                this.calculate_properties();
                this.root = this.aggregated.OrderByDescending(a => a.intensity_sum).FirstOrDefault(); //reset root to component with max intensity
            }
            else
            {
                Component cRoot = new Component();
                cRoot.weighted_monoisotopic_mass = temp.agg_mass;
                cRoot.intensity_sum = temp.agg_intensity;
                cRoot.rt_apex       = temp.agg_rt;

                this.root = cRoot;
                this.aggregated.AddRange(candidate_observations.Where(p => includes(p, this.root)));
                calculate_properties();
                this.root = this.aggregated.OrderByDescending(a => a.intensity_sum).FirstOrDefault(); //reset root to component with max intensity
            }
        }
コード例 #4
0
        public void AggregateTest()
        {
            IAggregatable duck = DuckTyping.Aggregate <IAggregatable>(new AggregateClass1(), new AggregateClass2());

            Assert.IsNotNull(duck);

            Assert.AreEqual(1, duck.Method1());
            Assert.AreEqual(2, duck.Method2());

            // It is still possible to get access
            // to an interface of an underlying object.
            //
            IClass2 cls2 = DuckTyping.Implement <IClass2>(duck);

            Assert.IsNotNull(cls2);
            Assert.AreEqual(2, cls2.Method2());

            // Even to switch from one aggregated object to another
            //
            IClass1 cls1 = DuckTyping.Implement <IClass1>(cls2);

            Assert.IsNotNull(cls1);
            Assert.AreEqual(1, cls1.Method1());
            Assert.AreEqual(3, cls1.Method3());
        }
コード例 #5
0
        public void aggregate()
        {
            ExperimentalProteoform temp_pf = new ExperimentalProteoform("tbd", root, new List <IAggregatable>(Sweet.lollipop.remaining_to_aggregate), true);                                    //first pass returns temporary proteoform
            ExperimentalProteoform new_pf  = new ExperimentalProteoform("tbd", temp_pf, new List <IAggregatable>(Sweet.lollipop.remaining_to_aggregate), true, Sweet.lollipop.neucode_labeled); //second pass uses temporary protoeform from first pass.

            copy_aggregate(new_pf);                                                                                                                                                             //doesn't copy quant on purpose
            root = temp_pf.root;                                                                                                                                                                //maintain the original component root
        }
コード例 #6
0
 public AvgAggregatable(IAggregatable sumAggregatable, IAggregatable countAggregatable, Expression <object> divisionExpression, VariableSymbol sumArgument, VariableSymbol countArgument)
 {
     _sumAggregatable    = sumAggregatable;
     _countAggregatable  = countAggregatable;
     _divisionExpression = divisionExpression;
     _sumArgument        = sumArgument;
     _countArgument      = countArgument;
 }
コード例 #7
0
 public ExperimentalProteoform(string accession, IAggregatable root, List <IAggregatable> candidate_observations, bool is_target)
     : base(accession)
 {
     quant     = new QuantitativeProteoformValues(this);
     this.root = root;
     this.aggregated.AddRange(candidate_observations.Where(p => this.includes(p, this.root)));
     this.calculate_properties();
     this.root = this.aggregated.OrderByDescending(a => a.intensity_sum).FirstOrDefault();
 }
コード例 #8
0
        public BoundAggregateExpression Update(AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
        {
            if (aggregate == Symbol && aggregatable == Aggregatable && argument == Argument)
            {
                return(this);
            }

            return(new BoundAggregateExpression(aggregate, aggregatable, argument));
        }
コード例 #9
0
        public void choose_next_agg_component()
        {
            Component c = new Component();
            Component d = new Component();
            Component e = new Component();
            Component f = new Component();

            c.weighted_monoisotopic_mass = 100;
            d.weighted_monoisotopic_mass = 119;
            e.weighted_monoisotopic_mass = 121;
            f.weighted_monoisotopic_mass = 122;
            c.intensity_sum = 1;
            d.intensity_sum = 2;
            e.intensity_sum = 3;
            f.intensity_sum = 4;
            List <IAggregatable> ordered = new List <IAggregatable> {
                c, d, e, f
            }.OrderByDescending(cc => cc.intensity_sum).ToList();
            Component is_running = new Component();

            is_running.weighted_monoisotopic_mass = 100;
            is_running.intensity_sum = 100;

            //Based on components
            List <IAggregatable> active = new List <IAggregatable> {
                is_running
            };
            IAggregatable next = Sweet.lollipop.find_next_root(ordered, active);

            Assert.True(Math.Abs(next.weighted_monoisotopic_mass - is_running.weighted_monoisotopic_mass) > 2 * (double)Sweet.lollipop.maximum_missed_monos);
            Assert.AreEqual(4, next.intensity_sum);

            //Based on experimental proteoforms
            ExperimentalProteoform exp = ConstructorsForTesting.ExperimentalProteoform("E");

            exp.root = is_running;
            List <ExperimentalProteoform> active2 = new List <ExperimentalProteoform> {
                exp
            };
            IAggregatable next2 = Sweet.lollipop.find_next_root(ordered, active2);

            Assert.True(Math.Abs(next.weighted_monoisotopic_mass - is_running.weighted_monoisotopic_mass) > 2 * (double)Sweet.lollipop.maximum_missed_monos);
            Assert.AreEqual(4, next.intensity_sum);
        }
コード例 #10
0
        public string find_manual_inspection_component(IEnumerable <IAggregatable> components)
        {
            IAggregatable intense = components.OrderByDescending(c => c.intensity_sum).FirstOrDefault();

            if (intense == null)
            {
                return("");
            }

            ChargeState intense_cs = intense.charge_states.OrderByDescending(c => c.intensity).FirstOrDefault();

            if (intense_cs == null)
            {
                return("");
            }

            return("File: " + intense.input_file.filename
                   + "; Scan Range: " + intense.min_scan + "-" + intense.max_scan
                   + "; Charge State m/z (+" + intense_cs.charge_count.ToString() + "): " + intense_cs.mz_centroid + "; RT (min): " + intense.rt_apex);
        }
コード例 #11
0
 private void copy_aggregate(ExperimentalProteoform e)
 {
     root = e.root;
     //doesn't copy quant on purpose
     agg_intensity                  = e.agg_intensity;
     agg_mass                       = e.agg_mass;
     modified_mass                  = e.modified_mass;
     agg_rt                         = e.agg_rt;
     lysine_count                   = e.lysine_count;
     is_target                      = e.is_target;
     family                         = e.family;
     aggregated                     = new List <IAggregatable>(e.aggregated);
     lt_quant_components            = new List <Component>(e.lt_quant_components);
     lt_verification_components     = new List <Component>(e.lt_verification_components);
     hv_quant_components            = new List <Component>(e.hv_quant_components);
     hv_verification_components     = new List <Component>(e.hv_verification_components);
     biorepIntensityList            = new List <BiorepIntensity>(e.biorepIntensityList);
     manual_validation_id           = e.manual_validation_id;
     manual_validation_verification = e.manual_validation_verification;
     manual_validation_quant        = e.manual_validation_quant;
 }
コード例 #12
0
        public BoundAggregatedValue Update(ValueSlot output, AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
        {
            if (output == Output && aggregate == Aggregate && aggregatable == Aggregatable && argument == Argument)
            {
                return(this);
            }

            return(new BoundAggregatedValue(output, aggregate, aggregatable, argument));
        }
コード例 #13
0
 private bool tolerable_rt(IAggregatable candidate, double rt_apex)
 {
     return(candidate.rt_apex >= rt_apex - Sweet.lollipop.retention_time_tolerance &&
            candidate.rt_apex <= rt_apex + Sweet.lollipop.retention_time_tolerance);
 }
コード例 #14
0
 //This aggregates based on lysine count, mass, and retention time all at the same time. Note that in the past we aggregated based on
 //lysine count first, and then aggregated based on mass and retention time afterwards, which may give a slightly different root for the
 //experimental proteoform because the precursor aggregation may shuffle the intensity order slightly. We haven't observed any negative
 //impact of this difference as of 160812. -AC
 public bool includes(IAggregatable candidate, IAggregatable root)
 {
     return(tolerable_rt(candidate, root.rt_apex) && tolerable_mass(candidate.weighted_monoisotopic_mass, root.weighted_monoisotopic_mass) &&
            (candidate as NeuCodePair == null || tolerable_lysCt(candidate as NeuCodePair, (root as NeuCodePair).lysine_count)));
 }
コード例 #15
0
        public static ExperimentalProteoform ExperimentalProteoform(string accession, IAggregatable root, List <IAggregatable> candidate_observations, List <Component> quantitative_observations, bool is_target)
        {
            ExperimentalProteoform e = new ExperimentalProteoform(accession, root, is_target);

            e.aggregated.AddRange(candidate_observations.Where(p => e.includes(p, e.root)));
            e.calculate_properties();
            if (quantitative_observations.Count > 0)
            {
                e.lt_quant_components.AddRange(quantitative_observations.Where(r => e.includes_neucode_component(r, e, true)));
                if (Sweet.lollipop.neucode_labeled)
                {
                    e.hv_quant_components.AddRange(quantitative_observations.Where(r => e.includes_neucode_component(r, e, false)));
                }
            }
            e.root = e.aggregated.OrderByDescending(a => a.intensity_sum).FirstOrDefault();
            return(e);
        }
コード例 #16
0
 public BoundAggregateExpression(AggregateSymbol aggregate, IAggregatable aggregatable, BoundExpression argument)
 {
     Symbol       = aggregate;
     Aggregatable = aggregatable;
     Argument     = argument;
 }