diff --git a/src/fr/inra/pappso/xtandempipeline/Utils.java b/src/fr/inra/pappso/xtandempipeline/Utils.java index 2f09b492030f329f27efc3fc950073b91cc26896..7820da745b0c61f922329cd8bdf6aa1ddc6342a0 100644 --- a/src/fr/inra/pappso/xtandempipeline/Utils.java +++ b/src/fr/inra/pappso/xtandempipeline/Utils.java @@ -26,9 +26,12 @@ import java.util.Collection; import org.apache.log4j.Logger; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; +import fr.inra.pappso.xtandempipeline.class_msms.Protein; import fr.inra.pappso.xtandempipeline.class_msms.GroupingProtein.PeptideMass; import fr.inra.pappso.xtandempipeline.grouping.Group; +import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetPhospho; import fr.inra.pappso.xtandempipeline.grouping.SubGroup; +import fr.inra.pappso.xtandempipeline.grouping.interfaces.GrpProtMatch; public class Utils { private static final Logger logger = Logger.getLogger(Utils.class); @@ -132,7 +135,8 @@ public class Utils { } public static String getPappsoPhosphoIslandId(Group group, SubGroup sg, - int k) throws MSMSException { - return getPappsoGroupingNumber(group, sg, k); + HashSampleScanSetPhospho phospho) throws MSMSException { + Protein prot = (Protein) phospho.getGrpProtMatch().getGrpProtein(); + return getPappsoGroupingNumber(group, sg, prot.getPhosphoId()); } } diff --git a/src/fr/inra/pappso/xtandempipeline/class_msms/Protein.java b/src/fr/inra/pappso/xtandempipeline/class_msms/Protein.java index 45ac5ca00fd4a0bd8818367b8f39f5f4695e5f55..5c3236f4f46f3573b5cad8ee284b5e5881b30622 100644 --- a/src/fr/inra/pappso/xtandempipeline/class_msms/Protein.java +++ b/src/fr/inra/pappso/xtandempipeline/class_msms/Protein.java @@ -16,6 +16,8 @@ public class Protein implements GrpProtein { private float mw; + private Integer phosphoId; + private int PAI_count; private String description; @@ -342,4 +344,34 @@ public class Protein implements GrpProtein { return this.PAI_count; } + /** + * get the protein identifier of this protein usefull in the PhosphoIsland + * context to get a unique PhosphoIsland ID + * + * @return int + * @throws MSMSException + */ + public int getPhosphoId() throws MSMSException { + if (this.phosphoId == null) { + String error = "phosphoId is null"; + logger.debug(error); + throw new MSMSException(error); + } + return this.phosphoId.intValue(); + } + + /** + * set the protein identifier of this protein usefull in the PhosphoIsland + * context to get a unique PhosphoIsland ID the developper MUST give an id + * number for each protein of PhosphoIslands + * + * @param i + */ + public void setPhosphoId(int i) { + if (this.phosphoId == null) { + this.phosphoId = i; + } + + } + } diff --git a/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoProteinOutput.java b/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoProteinOutput.java index 3b2278c3e8e72d8d68b0af6eb2f6d598ab1cbc2d..c7febcf92d9f5ee80c2e15356cbef7b388318777 100644 --- a/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoProteinOutput.java +++ b/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoProteinOutput.java @@ -36,6 +36,7 @@ import fr.inra.pappso.xtandempipeline.Utils; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; import fr.inra.pappso.xtandempipeline.class_msms.Identification; import fr.inra.pappso.xtandempipeline.class_msms.Match; +import fr.inra.pappso.xtandempipeline.class_msms.Protein; import fr.inra.pappso.xtandempipeline.grouping.Group; import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetPhospho; import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetProt; @@ -142,7 +143,11 @@ public class OdsPhosphoProteinOutput { for (HashSampleScanSetProt hashProt : sg .getHashSampleScanSetProtList()) { k++; - this.writeOnePhosphoProtein(hashProt, group, sg, k); + Protein prot = (Protein) hashProt.getGrpProtMatch() + .getGrpProtein(); + prot.setPhosphoId(k); + this.writeOnePhosphoProtein( + (HashSampleScanSetPhospho) hashProt, group, sg); } } } @@ -162,14 +167,13 @@ public class OdsPhosphoProteinOutput { } } - private void writeOnePhosphoProtein(HashSampleScanSetProt hashProt, - Group group, SubGroup sg, int k) throws MSMSException { + private void writeOnePhosphoProtein(HashSampleScanSetPhospho phospho, + Group group, SubGroup sg) throws MSMSException { try { logger.debug("writeOnePhosphoProtein begin " + group + sg); odsTable.writeLine(); - Match top = (Match) hashProt.getGrpProtMatch(); - HashSampleScanSetPhospho phospho = (HashSampleScanSetPhospho) hashProt; + Match top = (Match) phospho.getGrpProtMatch(); // odsTable.writeCell("Group ID"); odsTable.writeCell(Utils.getPappsoGroupId(group)); @@ -178,7 +182,8 @@ public class OdsPhosphoProteinOutput { odsTable.writeCell(Utils.getPappsoSubGroupId(group, sg)); // odsTable.writeCell("Phosphosite ID"); - odsTable.writeCell(Utils.getPappsoPhosphoIslandId(group, sg, k)); + odsTable.writeCell(Utils.getPappsoPhosphoIslandId(group, sg, + phospho)); // odsTable.writeCell("Description"); odsTable.writeCell(top.get_protein_match().get_description()); diff --git a/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoSpectraOutput.java b/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoSpectraOutput.java index bb18a2878a426123e1588884f5a49f074f426a62..345d3fbbf21eb0607f6452054d3f18b020d59080 100644 --- a/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoSpectraOutput.java +++ b/src/fr/inra/pappso/xtandempipeline/output/SpreadSheets/OdsPhosphoSpectraOutput.java @@ -162,8 +162,13 @@ public class OdsPhosphoSpectraOutput { HashMap<PeptideMass, HashSet<Peptide>> hashPeptideMass2Peptides = new HashMap<PeptideMass, HashSet<Peptide>>(); int nbpeptide = 0; + int k = 0; for (HashSampleScanSetProt hashPhospho : sg .getHashSampleScanSetProtSet()) { + k++; + Protein prot = (Protein) hashPhospho.getGrpProtMatch() + .getGrpProtein(); + prot.setPhosphoId(k); for (Peptide peptide : ((Match) hashPhospho .getGrpProtMatch()) .getValidPeptideInPhosphoIsland((HashSampleScanSetPhospho) hashPhospho)) { @@ -195,10 +200,11 @@ public class OdsPhosphoSpectraOutput { logger.debug("pepMassSet numbering"); pepMassSet.numbering(); + HashSet<HashSampleScan> uniqueHashSampleScan = new HashSet<HashSampleScan>(); + for (HashSampleScanSetProt hashPprot : sg .getHashSampleScanSetProtSet()) { HashSampleScanSetPhospho hashPhospho = (HashSampleScanSetPhospho) hashPprot; - HashSet<HashSampleScan> uniqueHashSampleScan = new HashSet<HashSampleScan>(); Protein prot = (Protein) hashPhospho.getGrpProtMatch() .getGrpProtein(); @@ -326,12 +332,11 @@ public class OdsPhosphoSpectraOutput { HashSet<HashSampleScanSetProt> phosphoIslandList = sg .getHashSampleScanSetProtSet(); Collection<String> phosphoIslandsIds = new TreeSet<String>(); - int k = 0; + for (HashSampleScanSetProt hashProt : phosphoIslandList) { HashSampleScanSetPhospho phosphoIsland = (HashSampleScanSetPhospho) hashProt; - k++; phosphoIslandsIds.add(Utils.getPappsoPhosphoIslandId(group, sg, - k)); + phosphoIsland)); } // odsTable.writeCell("Number of subgroups"); odsTable.writeCell(phosphoIslandsIds.size()); diff --git a/src/fr/inra/pappso/xtandempipeline/sax_parse/Mascot.java b/src/fr/inra/pappso/xtandempipeline/sax_parse/Mascot.java index e7b3da84d9a913a9a27e6645b2ee38ca587e2e68..56234bf0bbffac4476bdbbdf7e44d523f8aef6e3 100644 --- a/src/fr/inra/pappso/xtandempipeline/sax_parse/Mascot.java +++ b/src/fr/inra/pappso/xtandempipeline/sax_parse/Mascot.java @@ -29,7 +29,7 @@ public class Mascot { private MascotDatfile mascotDatfile; - //private Peptide peptide; + // private Peptide peptide; private Protein prot_; @@ -102,18 +102,16 @@ public class Mascot { protected void addPeptideToIdentification(PeptideHit pep, Query query, boolean reversed) throws MSMSException { - + // mapping proteinHit to protein && peptideHit to peptide for (Object obj : pep.getProteinHits()) { ProteinHit prot = (ProteinHit) obj; - - - //peptide = PeptideStore.getInstance().newPeptide(); + + // peptide = PeptideStore.getInstance().newPeptide(); Peptide pep_ = PeptideStore.getInstance().newPeptide(); pep_.set_sample_id( - identification_.getMsRunSet() - .getInstance(sample_), sample_); + identification_.getMsRunSet().getInstance(sample_), sample_); pep_.set_charge((int) round( (pep.getPeptideMr() / query.getPrecursorMZ()), 0)); @@ -123,14 +121,14 @@ public class Mascot { + pep.getDeltaMass() + 1.007825)); pep_.set_mhplus_theo((float) (pep.getPeptideMr() + 1.007825)); pep_.set_sequence(pep.getSequence()); - - if(XtandemPipelineSession.getInstance().getConfig().get_mascot_evalue_theoritical()){ - //Evalue theoritical + if (XtandemPipelineSession.getInstance().getConfig() + .get_mascot_evalue_theoritical()) { + // Evalue theoritical pep_.set_evalue((float) pep.getExpectancy()); - }else{ - //Evalue experimental - double eval = (pep.getIonsScore()-pep.getHomologyThreshold())/10; + } else { + // Evalue experimental + double eval = (pep.getIonsScore() - pep.getHomologyThreshold()) / 10; eval = 0.05 / Math.pow(10, eval); pep_.set_evalue((float) eval); } @@ -180,7 +178,7 @@ public class Mascot { // modified posi in prot of the peptide pep_.set_start(prot.getStart()); pep_.set_stop(prot.getStop()); - + // modifs add with position in prot!!! Modification[] mods = pep.getModifications(); for (int i = 0; i < mods.length; i++) { @@ -194,7 +192,7 @@ public class Mascot { posi--; } if (mod != null) { - pep_.set_Modifs(mod.getLocation(), posi+prot.getStart(), + pep_.set_Modifs(mod.getLocation(), posi + prot.getStart(), (float) mod.getMass()); identification_.add_modifs_to_liste(new Modifs((float) mod .getMass())); diff --git a/src/fr/inra/pappso/xtandempipeline/sax_parse/XtandemPhospho.java b/src/fr/inra/pappso/xtandempipeline/sax_parse/XtandemPhospho.java index d191efcf5bd605efe0f45bae06e0ec19b893402a..3a45992d002dfbcdc5b7aec6d170617a67dabe7b 100644 --- a/src/fr/inra/pappso/xtandempipeline/sax_parse/XtandemPhospho.java +++ b/src/fr/inra/pappso/xtandempipeline/sax_parse/XtandemPhospho.java @@ -172,8 +172,9 @@ public class XtandemPhospho extends org.xml.sax.helpers.DefaultHandler { pep_ = peptide; // valeur généric du scan try { - pep_.set_sample_id(identification_.getMsRunSet().getInstance( - sample_), sample_); + pep_.set_sample_id( + identification_.getMsRunSet().getInstance(sample_), + sample_); } catch (MSMSException e) { throw new SAXException(e); } @@ -202,9 +203,9 @@ public class XtandemPhospho extends org.xml.sax.helpers.DefaultHandler { this.peptide = PeptideStore.getInstance().newPeptide(); } pep_ = peptide; - pep_.set_Modifs(attrs.getValue("type"), Integer.parseInt(attrs - .getValue("at")), Float.valueOf(attrs.getValue("modified")) - .floatValue()); + pep_.set_Modifs(attrs.getValue("type"), + Integer.parseInt(attrs.getValue("at")), + Float.valueOf(attrs.getValue("modified")).floatValue()); // modifs liste for isotopic analysis identification_.add_modifs_to_liste(new Modifs(Float.valueOf( attrs.getValue("modified")).floatValue())); @@ -232,8 +233,9 @@ public class XtandemPhospho extends org.xml.sax.helpers.DefaultHandler { match_ = (Match) identification_.get_match(prot_); prot_ = match_.get_protein_match(); } - prot_.set_evalue(identification_.getMsRunSet().getInstance( - sample_), Float.valueOf(_evalue_prot).floatValue()); + prot_.set_evalue( + identification_.getMsRunSet().getInstance(sample_), + Float.valueOf(_evalue_prot).floatValue()); } if (spectre_number) { String tmp = C_data.replaceAll(" ", ""); diff --git a/src/fr/inra/pappso/xtandempipeline/sax_parse/xtandem.java b/src/fr/inra/pappso/xtandempipeline/sax_parse/xtandem.java index 56d42086a2e2df19477bb99779ecdcf03f31435b..a8b1390a46838fcac45d0d6c75e2af403c5dc935 100644 --- a/src/fr/inra/pappso/xtandempipeline/sax_parse/xtandem.java +++ b/src/fr/inra/pappso/xtandempipeline/sax_parse/xtandem.java @@ -168,8 +168,9 @@ public class xtandem extends org.xml.sax.helpers.DefaultHandler { } pep_ = this.peptide; try { - pep_.set_sample_id(identification_.getMsRunSet().getInstance( - sample_), sample_); + pep_.set_sample_id( + identification_.getMsRunSet().getInstance(sample_), + sample_); } catch (MSMSException e) { throw new SAXException(e); } @@ -198,9 +199,9 @@ public class xtandem extends org.xml.sax.helpers.DefaultHandler { this.peptide = PeptideStore.getInstance().newPeptide(); } pep_ = peptide; - pep_.set_Modifs(attrs.getValue("type"), Integer.parseInt(attrs - .getValue("at")), Float.valueOf(attrs.getValue("modified")) - .floatValue()); + pep_.set_Modifs(attrs.getValue("type"), + Integer.parseInt(attrs.getValue("at")), + Float.valueOf(attrs.getValue("modified")).floatValue()); // modifs liste for isotopic analysis identification_.add_modifs_to_liste(new Modifs(Float.valueOf( attrs.getValue("modified")).floatValue())); @@ -228,16 +229,20 @@ public class xtandem extends org.xml.sax.helpers.DefaultHandler { match_ = (Match) identification_.get_match(prot_); prot_ = match_.get_protein_match(); } - prot_.set_evalue(identification_.getMsRunSet().getInstance( - sample_), Float.valueOf(_evalue_prot).floatValue()); + prot_.set_evalue( + identification_.getMsRunSet().getInstance(sample_), + Float.valueOf(_evalue_prot).floatValue()); } if (spectre_number) { String tmp = C_data.replaceAll(" .*", ""); String[] split = tmp.split("-"); if (split.length == 2) { try { - int scan = Integer.parseInt(split[0].replaceAll("ScanNumber:", "")); - float rtime = Float.valueOf(split[1].replaceAll("RtInSec:", "")).floatValue(); + int scan = Integer.parseInt(split[0].replaceAll( + "ScanNumber:", "")); + float rtime = Float.valueOf( + split[1].replaceAll("RtInSec:", "")) + .floatValue(); correction_scan.put("" + _scan, "" + scan); correction_time.put("" + scan, "" + rtime); logger.debug("" + scan + " = " + rtime);