public FastaSeqV01 GetModel() { // For backward compatibility, check the first amino acid // for 'X', and assume it is a peptide list, if it is. bool peptideList = PeptideList || Sequence[0] == 'X'; // Not L10N FastaSeqV01Builder seqBuilder = new FastaSeqV01Builder { Id = Name, PeptideList = peptideList }; List <string> descriptions = new List <string> { Description }; if (Alternatives != null) { foreach (XmlAlternativeProtein alternative in Alternatives) { descriptions.Add(alternative.Name + " " + alternative.Description); // Not L10N } } seqBuilder.Descriptions = descriptions.ToArray(); string sequence = Sequence.Trim(); if (peptideList && sequence.Length > 0 && sequence[0] == FastaSeqV01.PEPTIDE_SEPARATOR) { peptideList = false; sequence = sequence.Substring(1); } foreach (char aa in sequence) { if (peptideList && aa == '\n') { seqBuilder.EndPeptide(); } if (!char.IsWhiteSpace(aa)) { seqBuilder.Append(aa); } } if (peptideList) { seqBuilder.EndPeptide(); } return(seqBuilder.ToFastaSequence()); }
public FastaSeqV01 GetModel() { // For backward compatibility, check the first amino acid // for 'X', and assume it is a peptide list, if it is. bool peptideList = PeptideList || Sequence[0] == 'X'; // Not L10N FastaSeqV01Builder seqBuilder = new FastaSeqV01Builder { Id = Name, PeptideList = peptideList }; List<string> descriptions = new List<string> {Description}; if (Alternatives != null) { foreach (XmlAlternativeProtein alternative in Alternatives) descriptions.Add(alternative.Name + " " + alternative.Description); // Not L10N } seqBuilder.Descriptions = descriptions.ToArray(); string sequence = Sequence.Trim(); if (peptideList && sequence.Length > 0 && sequence[0] == FastaSeqV01.PEPTIDE_SEPARATOR) { peptideList = false; sequence = sequence.Substring(1); } foreach (char aa in sequence) { if (peptideList && aa == '\n') seqBuilder.EndPeptide(); if (!char.IsWhiteSpace(aa)) seqBuilder.Append(aa); } if (peptideList) seqBuilder.EndPeptide(); return seqBuilder.ToFastaSequence(); }