示例#1
0
        public void Correct(string prefix, IProteinSet proteinSet)
        {
            int count = 0;

            for (int i = 0; i < proteinIndex.Length; i++)
            {
                if (T07SearchEngineEnhancement.IsReverseProtein(proteinSet.GetName(proteinIndex[i]), prefix))
                {
                    count++;
                }
            }
            if (count == 0 || count == proteinIndex.Length)
            {
                return;
            }
            List <int> result = new List <int>();

            for (int i = 0; i < proteinIndex.Length; i++)
            {
                if (!proteinSet.GetName(proteinIndex[i]).StartsWith(prefix))
                {
                    result.Add(proteinIndex[i]);
                }
            }
            proteinIndex = result.ToArray();
        }
示例#2
0
 public void FillProteinToPepTable(Dictionary <string, HashSet <string> > protIdToPepSeqs, IProteinSet proteinSet)
 {
     if (peptides == null)
     {
         Read();
     }
     for (int i = 0; i < peptides.Length; i++)
     {
         MascotPeptide p            = peptides[i][0];
         int[]         proteinIndex = p.ProteinIndex;
         if (!T07SearchEngineEnhancement.ValidPeptide(p.Sequence))
         {
             continue;
         }
         foreach (int pi in proteinIndex)
         {
             string protId = proteinSet.GetName(pi);
             if (!protIdToPepSeqs.ContainsKey(protId))
             {
                 protIdToPepSeqs.Add(protId, new HashSet <string>());
             }
             string key = p.Sequence;
             if (!protIdToPepSeqs[protId].Contains(key))
             {
                 protIdToPepSeqs[protId].Add(key);
             }
         }
     }
 }
 public bool HasReverseProteins(string revstring)
 {
     for (int i = 0; i < proteinIds.Length; i++)
     {
         if (T07SearchEngineEnhancement.IsReverseProtein(proteinIds[i], revstring))
         {
             return(true);
         }
     }
     return(false);
 }
示例#4
0
 public bool HasOnlyReverseHits(string reverseStr, IProteinSet proteinSet)
 {
     for (int i = 0; i < proteinIndex.Length; i++)
     {
         if (!T07SearchEngineEnhancement.IsReverseProtein(proteinSet.GetName(proteinIndex[i]), reverseStr))
         {
             return(false);
         }
     }
     return(true);
 }
示例#5
0
        public MsmsHit(MascotPeptide[] peptides, int scanNumber, int fileIndex, MascotQueryType type,
                       int silacIndex, double elutionTime, double mz, double monoisotopicMz, ushort[] fixedMods,
                       HashSet <string> labelModificationSet, SilacType silacType, SilacLabel[] labels1, SilacLabel[] labels2)
        {
            rawFileIndex    = fileIndex;
            this.scanNumber = scanNumber;
            this.silacIndex = silacIndex;
            this.type       = type;
            pep             = peptides[0].Pep;
            score           = peptides[0].MascotScore;
            altScore        = peptides[0].AltScore;
            charge          = (int)Math.Round(peptides[0].Mass / mz);
            massErrorPpm    = peptides[0].MassErrorPpm;
            if (peptides.Length > 1)
            {
                deltaScoreAll = peptides[0].MascotScore - peptides[1].MascotScore;
            }
            else
            {
                deltaScoreAll = peptides[0].MascotScore;
            }
            int ind = -1;

            for (int i = 1; i < peptides.Length; i++)
            {
                if (!peptides[i].Sequence.Equals(peptides[0].Sequence))
                {
                    ind = i;
                    break;
                }
            }
            if (ind != -1)
            {
                deltaScoreDifferentPep = peptides[0].MascotScore - peptides[ind].MascotScore;
            }
            else
            {
                deltaScoreDifferentPep = peptides[0].MascotScore;
            }
            labelModifications =
                peptides[0].Modifications.GetLabelModifications(fixedMods, peptides[0].Sequence, labelModificationSet);
            trueModifications   = peptides[0].Modifications.GetTrueModifications(labelModificationSet);
            this.elutionTime    = elutionTime;
            this.mz             = mz;
            this.monoisotopicMz = monoisotopicMz;
            if (silacType == SilacType.Singlets)
            {
                this.silacIndex = 0;
            }
            else if (type != MascotQueryType.Silac)
            {
                AminoAcid[] allAas     = T07SearchEngineEnhancement.CalcAllAas(silacType, labels1, labels2);
                char[]      allAaLetts = AminoAcid.GetSingleLetters(allAas);
                for (int i = 0; i < allAaLetts.Length; i++)
                {
                    this.silacIndex =
                        CalcSilacIndex(allAaLetts[i], labelModifications, peptides[0].Sequence, silacType, labels1,
                                       labels2);
                    if (this.silacIndex != -1)
                    {
                        break;
                    }
                }
            }
        }
示例#6
0
        private int GetSilacIndex(char aa, SilacType type, SilacLabel[] labels1, SilacLabel[] labels2)
        {
            if (type == SilacType.Singlets)
            {
                return(0);
            }
            int    index = -1;
            string seq   = sequence;

            for (int i = 0; i < seq.Length; i++)
            {
                if (seq[i] == aa)
                {
                    index = i;
                    break;
                }
            }
            if (index == -1)
            {
                return(-1);
            }
            Modification[] mods = T07SearchEngineEnhancement.GetModifiedVersions(aa, type, labels1, labels2);
            ushort         mod  = modifications.GetModificationAt(index);

            if (mod == ushort.MaxValue)
            {
                for (int i = 1; i < mods.Length; i++)
                {
                    if (mods[i] == null)
                    {
                        return(-1);
                    }
                }
                return(0);
            }
            if (type == SilacType.Doublets)
            {
                if (mods[1] == null)
                {
                    return(-1);
                }
                if (mods[1].Index == mod)
                {
                    return(1);
                }
                return(-1);
            }
            if (mods[1] == mods[2])
            {
                return(-1);
            }
            if (mods[1] != null && mods[1].Index == mod)
            {
                return(1);
            }
            if (mods[2] != null && mods[2].Index == mod)
            {
                return(2);
            }
            return(-1);
        }