17 public double mass {
get; }
29 public List<double>
ions {
get; }
39 public Peptide(
string Sequence,
double Mass, Dictionary<int, double> Modifications,
Settings IonSettings,
bool IsDecoy)
45 ions = getIons(Sequence, Mass, Modifications, IonSettings);
54 public int[]
getEnconding(
int massRange = 5000,
int massMultiplier = 100)
56 var encoding =
new List<int>();
58 foreach (var ion
in ions)
62 encoding.Add((
int) Math.Round(ion * massMultiplier));
66 return encoding.Distinct().OrderBy(x => x).ToArray();
78 peptide = peptide + $
"{modification.Key}:{modification.Value}+";
81 peptide = peptide.TrimEnd(
new char[] {
'+'});
85 return "_" + peptide +
"]";
114 private List<double> getIons(
string Sequence,
double Mass, Dictionary<int, double> Modifications,
Settings IonSettings)
116 var
ions =
new List<double>();
118 double[] outIonsNoNL;
121 foreach (var mod
in Modifications)
127 aa: Sequence[mod.Key],
129 neutralLosses: new double[0],
132 id: mod.Key.GetHashCode() + mod.Value.GetHashCode(),
138 sequence: Encoding.ASCII.GetBytes(Sequence),
140 charge: IonSettings.MAX_PRECURSOR_CHARGE,
142 maxNumberNeutralLoss: IonSettings.MAX_NEUTRAL_LOSSES,
143 maxNumberNeutralLossModifications: IonSettings.MAX_NEUTRAL_LOSS_MODS,
147 maxAllowedChargeState: IonSettings.MAX_FRAGMENT_CHARGE);
149 ions.AddRange(outIonsNoNL);
151 return ions.Distinct().OrderBy(x => x).ToList();
158 public static class DatabaseReader
167 public static List<Peptide> readFASTA(
string filename, Settings settings,
bool generateDecoys =
false)
Simplified peptide class that stores peptide/peptidoform information.
bool isDecoy
Is the peptide a decoy peptide or target peptide.
bool addModification(int position, double mass)
Adds a modification to the peptide if the peptide isn't already modified at that position.
string sequence
Amino acid sequence of the peptide.
double mass
Mass of the unmodified peptide.
Peptide(string Sequence, double Mass, Dictionary< int, double > Modifications, Settings IonSettings, bool IsDecoy)
Constructor for a new peptide/pepidoform.
int[] getEnconding(int massRange=5000, int massMultiplier=100)
Get the encoding vector of the peptide.
Dictionary< int, double > modifications
Dictionary mapping residue positions (0 based) to modification masses.
List< double > ions
List of theoretical ion m/z values.
override string ToString()
Constructs a string representation of the peptide.
Settings for digestion, ion calculation and VectorSearch.
static List< Peptide > DigestFasta(string fastaFileName, Settings settings, bool generateDecoys=false, double coreUsage=0.75)