Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit a29d487

Browse files
committed
updating methods for new naming and new CPeptideIon constructor
1 parent 494507e commit a29d487

File tree

3 files changed

+37
-30
lines changed

3 files changed

+37
-30
lines changed

src/main/java/theoretical/Contaminant.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private void prepare_theoretical_spectrum() {
106106
private HashSet<CPeptideIon> getBackbone(HashMap<Integer, ArrayList<Ion>> product_ions) {
107107
HashSet<CPeptideIon> backbones = new HashSet<CPeptideIon>();
108108
// prepare for naming
109-
String pepName = "pep";
109+
String pepName = "";
110110
int pep_length = peptide.getSequence().length();
111111
int linked_index = linker_position;
112112
CPeptideIonType cPepIonType = CPeptideIonType.Backbone;
@@ -138,7 +138,7 @@ private HashSet<CPeptideIon> getBackbone(HashMap<Integer, ArrayList<Ion>> produc
138138
if (tmp_ion_type == PeptideFragmentIon.X_ION || tmp_ion_type == PeptideFragmentIon.Y_ION || tmp_ion_type == PeptideFragmentIon.Z_ION) {
139139
index = pep_length - linked_index - 1;
140140
}
141-
backbones.addAll(prepareBackbone(product_ions, tmp_ion_type, index, 0, pepName, cPepIonType, true));
141+
backbones.addAll(prepareBackbone(product_ions, tmp_ion_type, index, 0, pepName, cPepIonType, true, peptide));
142142
}
143143
return backbones;
144144
}

src/main/java/theoretical/LinkedPeptideFragmentIon.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private ArrayList<CPeptideIon> calculateTerminisAttaching(int fragmentIonType) {
124124
}
125125
String cPepIonTypeName = rootName + "_" + index_for_user;
126126
Ion ion = tmp_ions.get(ion_index);
127-
CPeptideIon cIon = new CPeptideIon(intensity, ion.getTheoreticMass(), cPeptideIonType, fragmentIonType, cPepIonTypeName);
127+
CPeptideIon cIon = new CPeptideIon(intensity, ion.getTheoreticMass(), cPeptideIonType, fragmentIonType, cPepIonTypeName, '+');
128128
terminiCPepIons.add(cIon);
129129
}
130130
return terminiCPepIons;
@@ -195,7 +195,7 @@ private ArrayList<CPeptideIon> calculateNTerminiCPeptideIons(int fragmentIonType
195195
char node = linkedPeptide.getSequence().charAt(linker_position_on_linkedPeptide);
196196
double startMass = AminoAcid.getAminoAcid(node).getMonoisotopicMass();
197197
String nodeName = rootName + "_" + linker_position_on_linkedPeptide;
198-
CPeptideIon cPepIonNode = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, nodeName);
198+
CPeptideIon cPepIonNode = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, nodeName, '+');
199199
nTerminiCPepIons_Branching.add(cPepIonNode);
200200
// Since it is N-termini, we shall not go till the end...
201201
for (int i = startInd + 1; i < pepLen - 1; i++) {
@@ -207,7 +207,7 @@ private ArrayList<CPeptideIon> calculateNTerminiCPeptideIons(int fragmentIonType
207207
}
208208
int naming_index = i + 1;
209209
String name = rootName + "_" + naming_index;
210-
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name);
210+
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name, '+');
211211
nTerminiCPepIons_Branching.add(cPepIon);
212212
}
213213
startMass = AminoAcid.getAminoAcid(node).getMonoisotopicMass();
@@ -221,7 +221,7 @@ private ArrayList<CPeptideIon> calculateNTerminiCPeptideIons(int fragmentIonType
221221
}
222222
int naming_index = i + 1;
223223
String name = rootName + "_" + naming_index;
224-
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name);
224+
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name, '+');
225225
nTerminiCPepIons_Branching.add(cPepIon);
226226
}
227227

@@ -260,7 +260,7 @@ private ArrayList<CPeptideIon> calculateCTerminiCPeptideIons(int fragmentIonType
260260
double startMass = AminoAcid.getAminoAcid(node).getMonoisotopicMass();
261261
int index_for_naming = linker_position_on_linkedPeptide + 1;
262262
String nodeName = rootName + "_" + index_for_naming;
263-
CPeptideIon cPepIonNode = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, nodeName);
263+
CPeptideIon cPepIonNode = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, nodeName, '+');
264264
cTerminiCPepIons_Branching.add(cPepIonNode);
265265
// Since it is N-termini, we shall not go till the end...ONLY HERE C-TERMINI CAN BE FOUND!
266266
for (int i = startInd + 1; i < pepLen; i++) {
@@ -272,7 +272,7 @@ private ArrayList<CPeptideIon> calculateCTerminiCPeptideIons(int fragmentIonType
272272
}
273273
int naming_index = pepLen - i;
274274
String name = rootName + "_" + naming_index;
275-
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name);
275+
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name, '+');
276276
cTerminiCPepIons_Branching.add(cPepIon);
277277
}
278278
startMass = AminoAcid.getAminoAcid(node).getMonoisotopicMass();
@@ -283,7 +283,7 @@ private ArrayList<CPeptideIon> calculateCTerminiCPeptideIons(int fragmentIonType
283283
startMass += leftRes;
284284
int naming_index = pepLen - i;
285285
String name = rootName + "_" + naming_index;
286-
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name);
286+
CPeptideIon cPepIon = new CPeptideIon(intensity, startMass, cPeptideIonType, fragmentIonType, name, '+');
287287
cTerminiCPepIons_Branching.add(cPepIon);
288288
}
289289
return cTerminiCPepIons_Branching;

src/main/java/theoretical/MonoLinkedPeptides.java

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,40 +109,47 @@ private void prepare_theoretical_spectrum() {
109109
private HashSet<CPeptideIon> getBackbone(HashMap<Integer, ArrayList<Ion>> product_ions) {
110110
HashSet<CPeptideIon> backbones = new HashSet<CPeptideIon>();
111111
// prepare for naming
112-
String pepName = "pep";
112+
String pepName = "";
113113
int pep_length = peptide.getSequence().length();
114114
int linked_index = linker_position;
115115
CPeptideIonType cPepIonType = CPeptideIonType.Backbone;
116116
double mass_shift = linker.getMassShift_Type0();
117117
ArrayList<Integer> ion_types = new ArrayList<Integer>();
118118
// get only peptide fragment ions
119119
// 0= a, 1=b, 2=c, 3=x, 4=y, 5=z
120-
if (fragmentation_mode.equals(FragmentationMode.CID)) {
121-
// mostly b and y ions
122-
ion_types.add(PeptideFragmentIon.B_ION);
123-
ion_types.add(PeptideFragmentIon.Y_ION);
124-
} else if (fragmentation_mode.equals(FragmentationMode.ETD)) {
125-
// mostly c and z ions
126-
ion_types.add(PeptideFragmentIon.C_ION);
127-
ion_types.add(PeptideFragmentIon.Z_ION);
128-
} else if (fragmentation_mode.equals(FragmentationMode.HCD)) {
129-
// mostly y ions and then b and a ions
130-
ion_types.add(PeptideFragmentIon.A_ION);
131-
ion_types.add(PeptideFragmentIon.B_ION);
132-
ion_types.add(PeptideFragmentIon.Y_ION);
133-
} else if (fragmentation_mode.equals(FragmentationMode.HCD_all)) {
134-
// mostly y ions and then b and a ions
135-
ion_types.add(PeptideFragmentIon.A_ION);
136-
ion_types.add(PeptideFragmentIon.B_ION);
137-
ion_types.add(PeptideFragmentIon.X_ION);
138-
ion_types.add(PeptideFragmentIon.Y_ION);
120+
switch (fragmentation_mode) {
121+
case CID:
122+
// mostly b and y ions
123+
ion_types.add(PeptideFragmentIon.B_ION);
124+
ion_types.add(PeptideFragmentIon.Y_ION);
125+
break;
126+
case ETD:
127+
// mostly c and z ions
128+
ion_types.add(PeptideFragmentIon.C_ION);
129+
ion_types.add(PeptideFragmentIon.Z_ION);
130+
break;
131+
case HCD:
132+
// mostly y ions and then b and a ions
133+
ion_types.add(PeptideFragmentIon.A_ION);
134+
ion_types.add(PeptideFragmentIon.B_ION);
135+
ion_types.add(PeptideFragmentIon.Y_ION);
136+
break;
137+
case HCD_all:
138+
// mostly y ions and then b and a ions
139+
ion_types.add(PeptideFragmentIon.A_ION);
140+
ion_types.add(PeptideFragmentIon.B_ION);
141+
ion_types.add(PeptideFragmentIon.X_ION);
142+
ion_types.add(PeptideFragmentIon.Y_ION);
143+
break;
144+
default:
145+
break;
139146
}
140147
for (Integer tmp_ion_type : ion_types) {
141148
int index = linked_index;
142149
if (tmp_ion_type == PeptideFragmentIon.X_ION || tmp_ion_type == PeptideFragmentIon.Y_ION || tmp_ion_type == PeptideFragmentIon.Z_ION) {
143150
index = pep_length - linked_index - 1;
144151
}
145-
backbones.addAll(prepareBackbone(product_ions, tmp_ion_type, index, mass_shift, pepName, cPepIonType, true));
152+
backbones.addAll(prepareBackbone(product_ions, tmp_ion_type, index, mass_shift, pepName, cPepIonType, true, peptide));
146153
}
147154
return backbones;
148155
}

0 commit comments

Comments
 (0)