示例#1
0
        public int[] GetSequenceCoverage(IEnumerable <IAminoAcidSequence> peptides)
        {
            int[]  bits            = new int[Length];
            string leucineSequence = RepresentativeProtein.GetLeucineSequence();

            foreach (IAminoAcidSequence pep in peptides)
            {
                int start_index = 0;
                while (true)
                {
                    int index = leucineSequence.IndexOf(pep.GetLeucineSequence(), start_index);
                    start_index = index + 1;
                    if (index < 0)
                    {
                        break;
                    }

                    for (int aa = index; aa < index + pep.Length; aa++)
                    {
                        bits[aa]++;
                    }
                }
            }
            return(bits);
        }
示例#2
0
        public string ToParsimonyProteins(ExperimentGroup exp, bool duplexQuant = false, bool useOnlyCompleteSets = false)
        {
            StringBuilder sb = new StringBuilder(512);

            sb.AppendFormat("{0},{1},{2},{3:G4},{4:G4},{5:G4},{6},{7},{8},{9},", Name, Description, LongestProteinLen, SequenceCoverage, RepresentativeProtein.CalculateSequenceCoverage(Peptides.Where(pep => !pep.IsShared)), SequenceRedundacy, Count, UniquePeptides, Peptides.Count, Peptides.Count(pep => pep.IsShared));
            if (exp != null)
            {
                int psms;
                HashSet <Peptide> uniquepeps;
                UniquePeptidesPerGroup.TryGetValue(exp, out uniquepeps);
                PsmsPerGroup.TryGetValue(exp, out psms);
                sb.Append(psms);
                sb.Append(',');
                if (uniquepeps != null)
                {
                    sb.Append(uniquepeps.Count);
                }
                sb.Append(',');
                sb.Append(uniquepeps.Count(pep => pep.IsShared));
                sb.Append(',');
            }
            sb.Append(PScore.ToString(CultureInfo.InvariantCulture));
            if (exp != null && exp.UseQuant)
            {
                Quantitation quant;
                if (Quantitation.TryGetValue(exp.Name, out quant))
                {
                    sb.Append(',');
                    sb.Append(quant.PSMs);
                    sb.Append(',');
                    sb.Append(quant.UniquePeptides.Count);
                    sb.Append(',');
                    sb.Append(quant.ToOutput(duplexQuant, exp.MeidanLog2Ratio, useOnlyCompleteSets));
                }
                else
                {
                    sb.Append(",0,0");
                    for (int i = 0; i < exp.QuantPlex * 4; i++)
                    {
                        sb.Append(",-");
                    }

                    if (duplexQuant)
                    {
                        sb.Append(",N/A,N/A");
                    }
                }
            }

            if (ProteinHoarder.AnnotationType != AnnotationType.None)
            {
                sb.Append(',');
                sb.Append(ProteinIdsString());
                sb.Append(',');
                sb.Append(GeneNamesString());
            }

            return(sb.ToString());
        }