Esempio n. 1
0
        /*
         * These are from the experiment and will be removed if you call reset on the
         * graph
         */
        public Peptide addPeptideFromIdentification(IDs id, double currentTime)
        {
            String           peptideSequence         = id.getPeptideSequence();
            double           peptideMass             = id.getPeptideMass();
            HashSet <String> parentProteinAccessions = id.getParentProteinAccessions();
            Peptide          pep;

            if (containsPeptide(peptideSequence))
            {
                return(getPeptide(peptideSequence));
            }
            else
            {
                // Adds the peptide from the identification into the database
                pep = new Peptide(peptideSequence, peptideMass, false);
                // these peptides will be removed if reset() is called
                SequenceToPeptide.Add(peptideSequence, pep);
                peptides.Add(pep);

                if (includeRetentionTime)
                {
                    // TODO right now this takes the current time as the peak retention time...
                    // should we run it through RTCalc so we can better estimate our RT alignment?
                    // 2019-04-29 No, do not. Observed times are better than predicted
                    // pep.setRetentionTime(RetentionTimeUtil.convertDoubleToRetentionTime(rt,
                    // retentionTimeWindow,
                    // retentionTimeWindow));
                    RetentionTime rt = new RetentionTime(currentTime + retentionTimeWindow, retentionTimeWindow,
                                                         retentionTimeWindow, false);
                    pep.setRetentionTime(rt);
                }
            }
            // update its parent proteins
            foreach (String acc in parentProteinAccessions)
            {
                Protein parentProtein = AccesstionToProtein[acc];
                if (parentProtein != null)
                {
                    pep.addProtein(parentProtein);
                }
                else if (acc.Contains(GlobalVar.DecoyPrefix))
                {
                    log.Info("WARNINGin Decoy parent protein for this peptide was not found!!");
                    log.Info(acc);
                }
                else
                {
                    log.Warn("WARNINGin Non-decoy parent protein for this peptide was not found!!");
                    log.Warn(acc);
                }
            }

            return(pep);
        }
Esempio n. 2
0
 public void addPeptide(String reference, Peptide pep)
 {
     if (peptides.Keys.Contains(reference))
     {
         log.Debug("Peptide already exists");
     }
     else
     {
         peptides.Add(reference, pep);
     }
 }
Esempio n. 3
0
 public Protein addProteinFromIdentification(Peptide pep, HashSet <String> parentProteinAccessions)
 {
     // TODO
     log.Error("Implementation for adding protein from identification not completed...");
     return(null);
     // foreach(String accessionin parentProteinAccessions) {
     // Protein prot;
     // if(!containsProtein(accession)) {
     // prot = new Protein(accession, null);
     // }
     // }
 }
Esempio n. 4
0
 public void printGraph()
 {
     log.Debug(ToString());
     foreach (String acc in AccesstionToProtein.Keys)
     {
         Protein p = getProtein(acc);
         log.Debug(p);
     }
     foreach (String seq in SequenceToPeptide.Keys)
     {
         Peptide pep = getPeptide(seq);
         log.Debug(pep);
     }
 }
Esempio n. 5
0
        private void addPeptides(List <DigestedPeptide> digestedPeptideArray)
        {
            log.Debug("Adding peptides...");
            foreach (DigestedPeptide dp in digestedPeptideArray)
            {
                String parentProteinAccession = dp.getAccession();
                String peptideSequence        = dp.getSequence();
                double peptideMass            = dp.getMass();

                // Add digested peptide to the graph
                Protein parentProtein = getProtein(parentProteinAccession);
                Peptide pep;
                if (containsPeptide(peptideSequence))
                {
                    pep = getPeptide(peptideSequence);
                }
                else
                {
                    // HERE is where you make the peptide objects!!
                    if (includeCarbamidoModification)
                    {
                        peptideMass = carbamidoModificationMass(peptideSequence, peptideMass);
                    }

                    pep = new Peptide(peptideSequence, peptideMass, true);
                    SequenceToPeptide.Add(peptideSequence, pep);
                    peptides.Add(pep);
                }

                if (parentProtein != null)
                {
                    pep.addProtein(parentProtein);
                }
                else
                {
                    log.Warn("WARNINGin Parent protein foreach this peptide was not found!!");
                }
            }

            // add retention time information
            setRetentionTimes();

            peptides.Sort((Peptide x, Peptide y) => (y.getMass()).CompareTo(x.getMass()));
            log.Debug("Done adding peptides.");
        }
Esempio n. 6
0
        public bool Equals(Object o)
        {
            // If the object is compared with itself then return true
            if (o == this)
            {
                return(true);
            }

            /*
             * Check if o is an instance of Peptide or not "null instanceof [type]" also
             * returns false
             */
            if (!(o is Peptide))
            {
                return(false);
            }

            // typecast o to Complex so that we can compare data members
            Peptide pep = (Peptide)o;

            // Compare the data members and return accordingly

            return(pep.getMass().CompareTo(this.getMass()) == 0 && this.getSequence().Equals(pep.getSequence()));
        }