diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/XtandemPipelineSession.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/XtandemPipelineSession.java index 614a6d5a24c83792a4b0e0e10c0dfbaeb5815742..32e2f87fb3d4b0a4903360fff40e5ee9ff826faf 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/XtandemPipelineSession.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/XtandemPipelineSession.java @@ -2,7 +2,10 @@ package fr.inra.pappso.xtandempipeline; import java.util.ArrayList; +import org.apache.log4j.Logger; + import fr.inra.pappso.xtandempipeline.class_msms.Identification; +import fr.inra.pappso.xtandempipeline.class_msms.Match; import fr.inra.pappso.xtandempipeline.class_msms.MsRun; import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.grouping.HashPeptide; @@ -17,6 +20,8 @@ public class XtandemPipelineSession { private static XtandemPipelineSession session=null; + private static final Logger logger = Logger.getLogger(XtandemPipelineSession.class); + private HashSampleScanSet sampleScanSet = new HashSampleScanSet(); private HashPeptideSet peptideSet = new HashPeptideSet(); private HashProteinSet proteinSet = new HashProteinSet(); @@ -28,7 +33,8 @@ public class XtandemPipelineSession { private DataType_Base dataType; private XtandemPipelineSession(){ - + conf = new config(); + dataType = new DataType_Base(conf); } static public XtandemPipelineSession getInstance(){ @@ -58,4 +64,16 @@ public class XtandemPipelineSession { public void setIdentificationList(ArrayList<Identification> identifis) { this.identificationList = identifis; } + + public config getConfig() { + return this.conf; + } + public DataType_Base getDataTypeBase() { + return this.dataType; + } + + public void setDataTypeBase(DataType_Base type) { + this.dataType = type; + } + } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Match.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Match.java index 371dd66591c5b0cd1a5d5e4b7f7d5c0148295982..92e7e40ce009e80eba7be1b78af765074204573f 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Match.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Match.java @@ -163,21 +163,21 @@ public class Match implements Comparable<Match> { } public int get_coverage_to(MsRun samp) { - HashMap<String, String> seq = new HashMap<String, String>(); + HashMap<Integer, Boolean> seq = new HashMap<Integer, Boolean>(); for (int i = 0; i < this.protein_match.get_sequence().length(); i++) { int i_po = i + 1; - seq.put(new String("" + i_po), ""); + seq.put(i_po, false); } for (Peptide pep : peptides_match.values()) { if (pep.getMsRun().equals(samp)) { for (int j = pep.get_start(); j <= pep.get_stop(); j++) { - seq.put(new String("" + j), "ok"); + seq.put(j, true); } } } int k = 0; - for (String ST : seq.values()) { - if (seq.get(ST).equals("ok")) + for (boolean ST : seq.values()) { + if (ST) k++; } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Peptide.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Peptide.java index 14a006c4ee632c604226970ff8d7322c4f44a81a..69662ce344ea1417ea8657972c67479345d0b194 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Peptide.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/Peptide.java @@ -44,7 +44,7 @@ public class Peptide implements Comparable<Peptide> { private float hypercorr; - private ArrayList<Modifs> Modifs; + private ArrayList<Modifs> modifList; private boolean validate; @@ -53,24 +53,15 @@ public class Peptide implements Comparable<Peptide> { private ArrayList<Double> intensity_values; public int compareTo(Peptide p) { - // int j = this.get_sample().compareTo(p.get_sample()); - // if (j != 0) - // return (j); - // int i = this.scan - p.get_scan(); int i = this.hashSampleScan.compareTo(p.getSampleScan()); if (i != 0) return (i); return (int) (this.evalue - p.get_evalue()); - - // if (this.sample.equals(p.get_sample())) { - // return (this.scan - p.get_scan()); - // } - // return this.sample.compareTo(p.get_sample()); } // constructeur public Peptide() { - this.Modifs = new ArrayList<Modifs>(); + this.modifList = new ArrayList<Modifs>(); this.RT = 0; this.validate = true; this.scan_in_xtandem = 0; @@ -180,7 +171,7 @@ public class Peptide implements Comparable<Peptide> { int posi_corrected = posi - this.start + 1; Modifs mod = new Modifs(AA, posi_corrected, modvalue); mod.setPosi_in_prot(posi); - this.Modifs.add(mod); + this.modifList.add(mod); } public void set_sequence(String S) { @@ -246,18 +237,18 @@ public class Peptide implements Comparable<Peptide> { } public ArrayList<Modifs> get_Modifs() { - return (this.Modifs); + return (this.modifList); } public String get_Modifs_formater() { StringBuilder format = new StringBuilder(); - if (Modifs.size() >= 1) { - Modifs mod = Modifs.get(0); + if (modifList.size() >= 1) { + Modifs mod = modifList.get(0); format.append(mod.get_formater_value()); } - if (Modifs.size() >= 2) { - for (int i = 1; i < Modifs.size(); i++) { - Modifs mod = Modifs.get(i); + if (modifList.size() >= 2) { + for (int i = 1; i < modifList.size(); i++) { + Modifs mod = modifList.get(i); format.append(" - " + mod.get_formater_value()); } } @@ -267,7 +258,7 @@ public class Peptide implements Comparable<Peptide> { public Float get_mass_Modifs_without_isotope(boolean removeMS3) { Float f = (float) 0; - for (Modifs mod : Modifs) { + for (Modifs mod : modifList) { if (!mod.isIsotopic()) { if (mod.is_phopho_modifs() && removeMS3) f += Peptide.phospho_mass; @@ -280,7 +271,7 @@ public class Peptide implements Comparable<Peptide> { public Float get_mh_theo_without_isotope(boolean correctedMS3) { Float f = this.mhplus_theo; - for (Modifs mod : Modifs) { + for (Modifs mod : modifList) { if (mod.isIsotopic()) { f -= mod.get_modvalue(); } else if (mod.is_phopho_modifs() && correctedMS3) { @@ -293,7 +284,7 @@ public class Peptide implements Comparable<Peptide> { public boolean is_phopho_peptide() { boolean phospho = false; - for (Modifs mod : Modifs) { + for (Modifs mod : modifList) { if (mod.is_phopho_modifs()) phospho = true; } @@ -302,7 +293,7 @@ public class Peptide implements Comparable<Peptide> { public ArrayList<Modifs> get_phospho_Modifs() { ArrayList<Modifs> phospho = new ArrayList<Modifs>(); - for (Modifs mod : Modifs) { + for (Modifs mod : modifList) { if (mod.is_phopho_modifs()) phospho.add(mod); } @@ -431,4 +422,15 @@ public class Peptide implements Comparable<Peptide> { return this.hashSampleScan; } + public String get_Modifs_formater_without_isotope() { + StringBuilder format = new StringBuilder(); + for(Modifs mod : modifList){ + if(!mod.isIsotopic()){ + format.append(" " + mod.get_formater_value()); + } + } + format.append(" "); + return (format.toString()); + } + } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/config.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/config.java index 004064622ea8b24416d0b6086e480b33f3e67a23..d7a2572810415653eb5b4544195940580d4c361d 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/config.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/config.java @@ -1,128 +1,104 @@ package fr.inra.pappso.xtandempipeline.class_msms; import java.io.File; -import java.io.Serializable; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.util.Arrays; +import java.util.Properties; import java.util.Vector; -import fr.inra.pappso.xtandempipeline.MsException.MSMSException; +import org.apache.log4j.Logger; - -public class config implements Serializable { +public class config { private static final long serialVersionUID = 123L; + private static final Logger logger = Logger.getLogger(config.class); - private File database_filter; + private static String database_filter = "database_filter"; // le fichier de la base de donnee pour laquelle on veux retirer les // protéines - private float protein_evalue; + private static String protein_evalue = "protein_evalue"; // log(evalue) maximun pour valider une protein - private float peptide_evalue; + private static String peptide_evalue = "peptide_evalue"; // evalue maximun pour valider une protéine ou une isofome et pour combiner // les proteines - private int peptide_number; + private static String peptide_number = "peptide_number"; // minimum de peptides differents permettant l'identification - private boolean export_fasta; + private static String export_fasta = "export_fasta"; // indique si l'on veux esporter les protéines identifiées en fichier Fasta - private boolean export_proticdbml; + private static String export_proticdbml = "export_proticdbml"; // indique si l'on veux esporter les identification en fichier xml // compatible Protic - private boolean export_quantimscpp; + private static String export_masschroq = "export_quantimscpp"; // indique si l'on veux esporter les identification en fichier xml // compatible quantimscpp - private boolean remove_non_phopho_peptide; - // indique si l'on veux ne garder que les peptides phosphorylés - - private boolean protein_filter_to_complete; + private static String protein_filter_to_complete = "protein_filter_to_complete"; // indique si l'on veux appliquer les filtres au niveau proteique sur // l'ensemble des echantillons - private boolean export_fdr; + private static String export_fdr = "export_fdr"; // indique si on veux exporter la répartition des peptides dans les banques // pour des evalue croissants - private boolean export_pepnovo; + private static String export_pepnovo = "export_pepnovo"; // indique si on veux exporter les identifications pour une analyse en // pepnovo - private File xtandem_link; + private static String xtandem_link = "xtandem_link"; // lien vers le fichier X!tandem - private File xtandem_model; + private static String xtandem_model = "xtandem_model"; // lien vers les model xtandem - private File raw_data; + private static String raw_data = "raw_data"; // dossier contenant les raw_data - private File xmlresult; + private static String xmlresult = "xmlresult"; // dossier contenant les fichiers resultats - private File protein_database; + private static String protein_database = "protein_database"; // dossier contenant les fichiers fasta + private Properties properties; + public config() { - this.protein_evalue = -4; - this.peptide_evalue = Float.parseFloat("" + 0.05); - this.peptide_number = 2; - this.database_filter = new File("no selected"); - this.export_fasta = false; - this.export_quantimscpp = false; - this.export_quantimscpp = false; - this.remove_non_phopho_peptide = false; - this.protein_filter_to_complete = false; - this.export_fdr = false; - this.export_pepnovo = false; - this.xmlresult = new File(System.getProperty("user.home")); - this.raw_data = new File(System.getProperty("user.home")); - this.protein_database = new File(System.getProperty("user.home")); - this.xtandem_model = new File(System.getProperty("user.home") - + System.getProperty("file.separator") + "xtandem_models"); - + properties = new Properties(); + } + + public File getXtandem_link() { + File xtandem; if (System.getProperty("os.name").contains("Windows")) { - File model = new File("C:/Benperl/Xtandem"); - if (model.exists()) - this.xtandem_model = model; - this.xtandem_link = new File("C:/Benperl/Xtandem/tandem.exe"); + xtandem = new File("C:/Benperl/Xtandem/tandem.exe"); } else if (System.getProperty("os.name").contains("Linux")) { - this.xtandem_link = new File("/usr/bin/tandem"); + xtandem = new File("/usr/bin/tandem"); } else { - this.xtandem_link = new File("Not defined"); + xtandem = new File("Not defined"); } - - //si le dossier model n'existe pas on le crée - if(!this.xtandem_model.exists()) - this.xtandem_model.mkdir(); + File file = new File(properties.getProperty(xtandem_link,xtandem.getPath())); + return file; } - public File getXtandem_link() { - return xtandem_link; - } - - public File getXtandem_software() throws Exception { - if (!this.xtandem_link.exists()) - throw new MSMSException("The X!Tandem software : " - + xtandem_link.getAbsolutePath() - + " is not present on your system"); - return xtandem_link; - } - - public void setXtandem_link(File xtandem_link) { - this.xtandem_link = xtandem_link; + public void setXtandem_link(File F) { + properties.setProperty(xtandem_link, F.getPath()); } public File getXtandem_model() { - return xtandem_model; + File file = new File(properties.getProperty( + xtandem_model,this.getRacinePath()+System.getProperty("file.separator")+"xtandem_models")); + if(!file.exists()) + file.mkdirs(); + return (file); } public Vector<File> getXtandem_models() { - File[] files = this.xtandem_model.listFiles(); + File[] files = this.getXtandem_model().listFiles(); Vector<File> fi = new Vector<File>(); if (files == null) return fi; @@ -135,7 +111,7 @@ public class config implements Serializable { } public Vector<File> getprotein_databases() { - File[] files = this.protein_database.listFiles(); + File[] files = this.getProtein_database().listFiles(); Vector<File> fi = new Vector<File>(); if (files == null) return fi; @@ -147,131 +123,191 @@ public class config implements Serializable { return (fi); } - public void setXtandem_model(File xtandem_model) { - this.xtandem_model = xtandem_model; + public void setXtandem_model(File F) { + properties.setProperty(xtandem_model, F.getPath()); } public File getRaw_data() { - return raw_data; + File file = new File(properties.getProperty(raw_data, + System.getProperty("user.home"))); + return (file); } - public void setRaw_data(File raw_data) { - this.raw_data = raw_data; + public void setRaw_data(File F) { + properties.setProperty(raw_data, F.getPath()); } public File getXmlresult() { - return xmlresult; + File file = new File(properties.getProperty(xmlresult, + System.getProperty("user.home"))); + return (file); } - public void setXmlresult(File xmlresult) { - this.xmlresult = xmlresult; + public void setXmlresult(File F) { + properties.setProperty(xmlresult, F.getPath()); } public File getProtein_database() { - return protein_database; + File file = new File(properties.getProperty(protein_database, + System.getProperty("user.home"))); + return (file); } - public void setProtein_database(File protein_database) { - this.protein_database = protein_database; + public void setProtein_database(File F) { + properties.setProperty(protein_database, F.getPath()); } public void set_database_filter(File F) { - this.database_filter = F; + properties.setProperty(database_filter, F.getName()); } public void set_protein_evalue(float F) { - this.protein_evalue = F; + properties.setProperty(protein_evalue, "" + F); } public void set_peptide_evalue(float F) { - this.peptide_evalue = F; + properties.setProperty(peptide_evalue, "" + F); } public void set_peptide_number(int F) { - this.peptide_number = F; + properties.setProperty(peptide_number, "" + F); } public void set_export_fasta(boolean F) { - this.export_fasta = F; + properties.setProperty(export_fasta, "" + F); } public void set_export_proticdbml(boolean F) { - this.export_proticdbml = F; + properties.setProperty(export_proticdbml, "" + F); } - public void set_export_quantimscpp(boolean F) { - this.export_quantimscpp = F; + public void set_export_masschroq(boolean F) { + properties.setProperty(export_masschroq, "" + F); } public void set_export_pepnovo(boolean F) { - this.export_pepnovo = F; - } - - public void set_remove_non_phoshopeptide(boolean F) { - this.remove_non_phopho_peptide = F; + properties.setProperty(export_pepnovo, "" + F); } public void set_protein_filter_to_complete(boolean F) { - this.protein_filter_to_complete = F; + properties.setProperty(protein_filter_to_complete, "" + F); } public File get_database_filter() { - return (this.database_filter); + File file = new File(properties.getProperty(database_filter, + "no selected")); + return (file); } public float get_protein_evalue() { - return (this.protein_evalue); + float value = Float.parseFloat(properties.getProperty(protein_evalue, + "-4")); + return (value); } public float get_peptide_evalue() { - return (this.peptide_evalue); + float value = Float.parseFloat(properties.getProperty(peptide_evalue, + "0.05")); + return (value); } public int get_peptide_number() { - return (this.peptide_number); + int value = Integer.parseInt(properties + .getProperty(peptide_number, "2")); + return (value); } public boolean get_export_fasta() { - return (this.export_fasta); + String value = properties.getProperty(export_fasta, "false"); + if (value.equals("false")) + return (false); + return (true); } public boolean get_export_proticdbml() { - return (this.export_proticdbml); + String value = properties.getProperty(export_proticdbml, "false"); + if (value.equals("false")) + return (false); + return (true); } - public boolean get_export_quantimscpp() { - return (this.export_quantimscpp); + public boolean get_export_masschroq() { + String value = properties.getProperty(export_masschroq, "false"); + if (value.equals("false")) + return (false); + return (true); } public boolean get_export_pepnovo() { - return (this.export_pepnovo); - } - - public boolean get_remove_non_phopsho_peptide() { - return (this.remove_non_phopho_peptide); + String value = properties.getProperty(export_pepnovo, "false"); + if (value.equals("false")) + return (false); + return (true); } public boolean get_protein_filter_to_complete() { - return (this.protein_filter_to_complete); + String value = properties.getProperty(protein_filter_to_complete, + "false"); + if (value.equals("false")) + return (false); + return (true); } - public void set_Export_fdr(boolean export_fdr) { - this.export_fdr = export_fdr; + public void set_Export_fdr(boolean export) { + properties.setProperty(export_fdr, "" + export); } public boolean get_Export_fdr() { - return export_fdr; + String value = properties.getProperty(export_fdr, "false"); + if (value.equals("false")) + return (false); + return (true); } public boolean getXtandem_software_installed() { - if (!this.xtandem_link.exists()) + File file = this.getXtandem_link(); + if (!file.exists()) return false; - else if (!this.xtandem_link.isFile()) + else if (!file.isFile()) return false; - else if (!this.xtandem_link.canExecute()) + else if (!file.canExecute()) return false; else return true; } + public boolean loadPropertiesFromXml() throws Exception { + File xml = new File(this.getRacinePath() + + System.getProperty("file.separator") + "xtandempipeline.conf"); + if (!xml.exists()){ + logger.trace("New configuration file"); + return (false); + } + logger.trace("Load properties configuration from : "+xml.getPath()); + properties.loadFromXML(new FileInputStream(xml)); + return (true); + } + + public void savePropertiestoXml() throws Exception { + File xml = new File(this.getRacinePath() + + System.getProperty("file.separator") + "xtandempipeline.conf"); + logger.trace("Save properties condfiguration to : "+xml.getPath()); + properties.storeToXML(new FileOutputStream(xml), + "Xtandem pipeline configuration file"); + } + + private File getRacinePath() { + File path; + if (System.getProperty("os.name").contains("Linux")) { + path = new File(System.getProperty("user.home") + + "/.config/xtandempipeline"); + } else { + path = new File(System.getProperty("user.home") + + System.getProperty("file.separator") + "xtandempipeline"); + } + if (!path.exists()) { + path.mkdirs(); + } + return (path); + } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar.java index f1ff31057573cc168723ff0856a77831be5ecc08..8b721bd6b05df063c5796ca18d3c29f73fd1c5d5 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar.java @@ -72,7 +72,7 @@ public class print_compar extends print_base { //On ecris les données pour chaque sample float value = 0; - for(MsRun sample : samples){ + for(MsRun sample : samples.getMsRunList()){ if (type.equals("Spectra")) value = top.get_valid_peptide_number_to(sample); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar_phospho.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar_phospho.java index 0c00dd18c5d2e702227a9cd4c6c237bb26e008c3..71929f1236d2d27830c4aad4d73ed668cac9405c 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar_phospho.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_compar_phospho.java @@ -75,7 +75,7 @@ public class print_compar_phospho extends print_base { // On ecris les données pour chaque sample float value = 0; - for (MsRun sample : samples) { + for (MsRun sample : samples.getMsRunList()) { if (type.equals("Spectra")) value = phospho.getTotalHashSampleScantoMsRun(sample); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_peptide_list_to_phosphopeptide.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_peptide_list_to_phosphopeptide.java index f3e91739d9540272402dbe07a0aed5addf990a3b..b93db8b734cfcd0b5b7c3898a08fef63bd014039 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_peptide_list_to_phosphopeptide.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_peptide_list_to_phosphopeptide.java @@ -62,8 +62,10 @@ public class print_peptide_list_to_phosphopeptide extends print_base { } else { S.append("\t" + "Mono" + "\t"); } + S.append("\""); for (Integer pos : posi) S.append(pos + " "); + S.append("\""); } else { S.append("\t" + "No" + "\t" + "\"-\""); } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_indiv.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_indiv.java index eb7298eec0c00028ce5363b753866bba26f4f91c..e5fe1e1fa74e6851982fa714572bfeb9f57758a1 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_indiv.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_indiv.java @@ -15,8 +15,8 @@ public class print_protein_to_indiv extends print_base { logger.trace("Print Protein liste file in Individual mode"); } - public void print_header(String samp) throws Exception { - out.write(samp + "\n"); + public void print_header(MsRun samp) throws Exception { + out.write(samp.getSampleName() + "\n"); String S = "Group" + "\t" + "Sub-group" + "\t" + "Description" + "\t" + "log(E value)" + "\t" + "Coverage" + "\t" + "MW" + "\t" + "Spectra" + "\t" + "Specifics" + "\t" + "Uniques" + "\t" diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_phosphopeptide.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_phosphopeptide.java index 094fd4ffcd65fd1285c955445353c11475666fd5..50ff38f6e6e3e1512451e164c1a9c6caf6d207fe 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_phosphopeptide.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/filter_print/print_protein_to_phosphopeptide.java @@ -15,9 +15,9 @@ public class print_protein_to_phosphopeptide extends print_base { } public void print_header() throws Exception { - String S = "Group" + "\t" + "Sub-group" + "\t" + "Description" + "\t" + String S = "Group" + "\t" + "Sub-group" + "\t" + "Description" + "\t" + "MW" + "\t" + "Position" + "\t" - + "Spectra" + "\t" + "Specific" + "\t" + "Uniques" + "\t" + + "Spectra" + "\t" + "Uniques" + "\t" + "Redundancy" + "\n"; out.write(S); } @@ -33,14 +33,10 @@ public class print_protein_to_phosphopeptide extends print_base { + top.get_protein_match().get_description()); S.append("\t" + top.get_protein_match().get_mw()); - S.append("\t" + phospho.getPhosphoPositionToPrint()); + S.append("\t" + "\""+phospho.getPhosphoPositionToPrint()+"\""); S.append("\t" + phospho.size()); - if(group.getSubGroupSet().size() > 1) - S.append("\t" - + group.getNumberOfSpecificPeptideInSubGroup(hashProt)); - else - S.append("\t" + "\"-\""); + S.append("\t" + phospho.getUniquePeptideHashSampleScan()); S.append("\t"); if (sg.getHashSampleScanSetProtSet().size() > 1) diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSetProt.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSetProt.java index 5d670cfd4bfed818e1ca50e1f4043f8cc245a0ff..8a542e9d922e4c4f8ccde918ff216d044085609e 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSetProt.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSetProt.java @@ -119,7 +119,7 @@ public class HashSampleScanSetProt extends HashSampleScanSet { if (hash.getMsRun().equals(sample)) count++; } - return (this.size()); + return (count); } public int getUniqueHashPeptideSampleScantoMsRun(MsRun sample) { diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/MassChroQML.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/MassChroQML.java index cacd335da2e192de380595a2af2850f8d3208f3b..34c6f66351eca744f5b67eeae638ba0e4d787738 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/MassChroQML.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/MassChroQML.java @@ -6,8 +6,10 @@ import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.HashSet; import java.util.Hashtable; +import java.util.Iterator; + import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; @@ -337,12 +339,9 @@ public class MassChroQML { for(Group group : ident.getGrouping().getGroupList()){ for(SubGroup sg : group.getSubGroupSet().getSubGroupList()){ Protein top = sg.getHashSampleScanSetProtList().get(0).getMatch().get_protein_match(); + // balise proteines - String prot_id = "P"+group.getNumber()+ "."; - if(sg.getNumber()<10) - prot_id += "0"+sg.getNumber(); - else - prot_id += sg.getNumber(); + String prot_id = this.getSubGroupGroupNumber(group, sg); Element protein = doc.createElement("protein"); protein.setAttribute("id", prot_id); @@ -354,7 +353,7 @@ public class MassChroQML { } private void add_peptides() throws Exception { - Hashtable<String, Hashtable<String, String>> pep_sequence_to_prot = new Hashtable<String, Hashtable<String, String>>(); + Hashtable<String, HashSet<String>> pep_sequence_to_prot = new Hashtable<String, HashSet<String>>(); for(Group group : ident.getGrouping().getGroupList()){ for(HashSampleScan hash : group.getHashSampleScanSet().getHashSampleScanList()){ SubGroupSet set = group.getSubGroupContaining(hash); @@ -372,16 +371,16 @@ public class MassChroQML { peptide.setAttribute("id", pep_id); this.seq_to_element.put(seqMod, peptide); - peptide.setAttribute("seq", pep.get_LI_sequence()); + peptide.setAttribute("seq", pep.get_sequence()); peptide.setAttribute("mh", "" + pep.get_mh_theo_without_isotope(true)); peptide.setAttribute("mods", "" - + pep.get_Modifs_formater()); + + pep.get_Modifs_formater_without_isotope()); this.peptide_list.appendChild(peptide); // table temporaire pour prot_id - Hashtable<String, String> temp = new Hashtable<String, String>(); - pep_sequence_to_prot.put(seqMod, - temp); + HashSet<String> temp = new HashSet<String>(); + //Hashtable<String, String> temp = new Hashtable<String, String>(); + pep_sequence_to_prot.put(seqMod,temp); } //On ajoute une observation Element observed = doc.createElement("observed_in"); @@ -394,14 +393,8 @@ public class MassChroQML { peptide.appendChild(observed); for(SubGroup sgTemp : sgList){ - Match matchTemp = sgTemp.getHashSampleScanSetProtList().get(0).getMatch(); - Hashtable<String, String> temp = pep_sequence_to_prot - .get(seqMod); - if (!temp.containsKey(matchTemp.get_protein_match() - .get_cle_accession())) - temp.put(matchTemp.get_protein_match().get_cle_accession(), - this.prot_to_id.get(matchTemp - .get_protein_match().get_cle_accession())); + HashSet<String> temp = pep_sequence_to_prot.get(seqMod); + temp.add(this.getSubGroupGroupNumber(group, sgTemp)); } @@ -410,11 +403,11 @@ public class MassChroQML { // on reparcourt la liste pour ajouter les prots id for(String seq : pep_sequence_to_prot.keySet()){ Element peptide = this.seq_to_element.get(seq); - Hashtable<String, String> temp = pep_sequence_to_prot.get(seq); - Enumeration<String> prots = temp.elements(); - String ids = prots.nextElement(); - while (prots.hasMoreElements()) - ids = ids + " " + prots.nextElement(); + HashSet<String> temp = pep_sequence_to_prot.get(seq); + Iterator<String> prots = temp.iterator(); + String ids = prots.next(); + while (prots.hasNext()) + ids = ids + " " + prots.next(); peptide.setAttribute("prot_ids", ids); } @@ -442,5 +435,14 @@ public class MassChroQML { public void set_isotopes_mods(ModifsList mods) { this.mods = mods; } + + private String getSubGroupGroupNumber(Group group,SubGroup sg){ + String prot_id = "P"+group.getNumber()+ "."; + if(sg.getNumber()<10) + prot_id += "0"+sg.getNumber(); + else + prot_id += sg.getNumber(); + return(prot_id); + } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/Serialising.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/Serialising.java deleted file mode 100644 index 7bc2a413347ffe2d31de2a6c7978f14de92e9c89..0000000000000000000000000000000000000000 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/Serialising.java +++ /dev/null @@ -1,66 +0,0 @@ -package fr.inra.pappso.xtandempipeline.sax_parse; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.log4j.Logger; - -import fr.inra.pappso.xtandempipeline.class_msms.config; - -public class Serialising { - - private static final Logger logger = Logger.getLogger(Serialising.class); - - public Serialising() { - - } - - public void serialise_xtandem_conf(config conf) throws Exception { - logger.trace("save conf files"); - FileOutputStream fos = null; - ObjectOutputStream out_ser = null; - String file_out = this.get_conf_save("xtandem_parser.conf"); - fos = new FileOutputStream(file_out); - out_ser = new ObjectOutputStream(fos); - out_ser.writeObject(conf); - out_ser.close(); - } - - public config unserialise_xtandem_conf() throws Exception { - logger.trace("load conf files"); - FileInputStream fis = null; - ObjectInputStream in = null; - String file_in = this.get_conf_save("xtandem_parser.conf"); - // if (!new File (file_in).exists()) - // return(new config()); - fis = new FileInputStream(file_in); - in = new ObjectInputStream(fis); - config conf = (config) in.readObject(); - in.close(); - - // try { - //test si dernière version, si erreur - conf.get_export_quantimscpp(); - conf.get_protein_filter_to_complete(); - conf.get_remove_non_phopsho_peptide(); - conf.get_Export_fdr(); - conf.get_export_pepnovo(); - conf.getXtandem_link(); - conf.getXtandem_link().getAbsolutePath(); - // }catch (Exception e) { - // conf = new config(); - // System.out.println("update config file"); - // } - - return (conf); - } - - private String get_conf_save(String name) { - String S = System.getProperty("user.home") - + System.getProperty("file.separator") + name; - return S; - } - -} diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/load_project.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/load_project.java index 0fb04e4ec6a6b24506032b17fcc93a4216c93118..021ec2a1c26255317f3b9947985288909d379e3d 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/load_project.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/sax_parse/load_project.java @@ -9,6 +9,7 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.class_msms.Identification; import fr.inra.pappso.xtandempipeline.class_msms.Match; @@ -75,6 +76,7 @@ public class load_project extends org.xml.sax.helpers.DefaultHandler { // System.out.println("Start= "+Start_element_); if (Start_element_.equals("information")) { datatype = datatype.getType(attrs.getValue("Data_Type")); + XtandemPipelineSession.getInstance().setDataTypeBase(datatype); this.pro.set_max_progress(Integer.parseInt(attrs.getValue("match_number"))); } if (Start_element_.equals("filter_params")) { diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Base.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Base.java index 234ad4a069b120b942703e1e269c242087a32372..cbfea7ff9957f7c6e27ddd0fc4b88c7078518e8e 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Base.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Base.java @@ -19,7 +19,7 @@ public class DataType_Base { protected config conf; public DataType_Base(config conf){ - this.setConf(conf); + this.conf=conf; this.defined_variable(); } @@ -33,82 +33,34 @@ public class DataType_Base { } - - public void setPrint(printing_base print) { - this.print = print; - } - - - public printing_base getPrint() { return print; } - - public void setPro(process pro) { - this.pro = pro; + + public void newPrint() { } - - public process getPro() { return pro; } - - public void setIs_phosphopeptide(Boolean is_phosphopeptide) { - this.is_phosphopeptide = is_phosphopeptide; - } - - - public Boolean getIs_phosphopeptide() { return is_phosphopeptide; } - - public void setIs_invididual(Boolean is_invididual) { - this.is_invididual = is_invididual; - } - - public Boolean getIs_invididual() { return is_invididual; } - - - - public void setInformation(String information) { - this.information = information; - } - - - public String getInformation() { return information; } - - - public void setIs_active(Boolean is_active) { - this.is_active = is_active; - } - - - public Boolean getIs_active() { return is_active; } - - - public void setConf(config conf) { - this.conf = conf; - } - - - public config getConf() { return conf; } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Combine.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Combine.java index c751e3a895586b8b549a4c2caabebb4a4b3853ce..dcbffe0bf3c77c58f2ef67389ec49c5d9958d8ec 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Combine.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_Combine.java @@ -11,13 +11,17 @@ public class DataType_Combine extends DataType_Base{ protected void defined_variable() { is_active = true; is_invididual = false; - print = new printing_combine(conf); information = "Combine : </b>All sample analysis are combined, then filtered to obtained an unique result."; pro = new combined(conf); is_phosphopeptide = false; + print = new printing_combine(conf); } public String getType() { // TODO Auto-generated method stub return "combi"; } + + public void newPrint() { + print = new printing_combine(conf); + } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_individual.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_individual.java index 071a7987a21bd694332ada2c17eec5c5ee2d3eaa..f00f9a9b1b3f3e73275687f8acf8ab98189a9308 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_individual.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_individual.java @@ -12,13 +12,17 @@ public class DataType_individual extends DataType_Base{ is_active = true; is_invididual = true; is_phosphopeptide = false; - print = new printing_indiv(conf); information = "Individual : Each sample is filtered separately."; pro = new individual(conf); + print = new printing_indiv(conf); } public String getType() { // TODO Auto-generated method stub return "indiv"; } + + public void newPrint() { + print = new printing_indiv(conf); + } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_phosphopeptide.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_phosphopeptide.java index 77a76f850fc3619bc6c75e86770e0549a229af3d..096ab2775bfb0c175f2e03f0b7bb714d9f901ae5 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_phosphopeptide.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/DataType_phosphopeptide.java @@ -12,14 +12,18 @@ public class DataType_phosphopeptide extends DataType_Base{ is_active = true; is_invididual = false; is_phosphopeptide = true; - print = new printing_phosphopeptide(conf); information = "Phosphopeptide : </b>Only phosphopeptide are conserved. All sample analysis are combined, then filtered to obtained an non-redondant list of phosphosite."; pro = new phosphosite(conf); + print = new printing_phosphopeptide(conf); } public String getType() { // TODO Auto-generated method stub return "phospho"; } + + public void newPrint() { + print = new printing_phosphopeptide(conf); + } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/printing_base.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/printing_base.java index b468cc3c0c2702a4af2129295f7b72e2fd4183f1..49403166309f045c9db12e78ac2bdb295e517f39 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/printing_base.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/printing_base.java @@ -131,14 +131,14 @@ public class printing_base extends process { throw new StopException(""); this.add_current_progress(); - if ((conf.get_export_quantimscpp()) & (this.getIdentifications().size() == 1)) { + if ((conf.get_export_masschroq()) & (this.getIdentifications().size() == 1)) { this.set_view("Printing MassChroQ xml file results"); Identification ident = this.getIdentifications().firstElement(); //modification isotopic ident.filtered_match(new filter_isotopic_modifs(this.isotopic_mods)); MassChroQML xml = new MassChroQML(new File(this.getfileout() .getAbsolutePath() - + "_masschroq.xml")); + + ".masschroqML")); //transfert des isotopes xml.set_isotopes_mods(this.isotopic_mods); xml.set_identification(ident); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_Details.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_Details.java index 1bae8ea10cfd96d9184a4d8e15b2752cbc781c70..7b062bcd3038455f84dcf0d8296f62fdb1e10c9b 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_Details.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_Details.java @@ -1,7 +1,6 @@ package fr.inra.pappso.xtandempipeline.ui.results; import fr.inra.pappso.xtandempipeline.MsException.StopException; -import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.class_msms.Peptide; import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; @@ -11,8 +10,8 @@ import org.eclipse.swt.graphics.Point; public class Peptide_Details extends window_base { - public Peptide_Details(Main_Windows global, config conf) { - super(global, conf); + public Peptide_Details(Main_Windows global) { + super(global); } protected void move_CTabItem(CTabItem item, int index) { @@ -29,7 +28,7 @@ public class Peptide_Details extends window_base { protected void view_CTab_Item_in_independant_windows(CTabItem dragItem, Point point) { Peptide_Details_item dragitem = (Peptide_Details_item) dragItem; - Peptide_Details win = new Peptide_Details(controlleur, conf); + Peptide_Details win = new Peptide_Details(controlleur); win.setLinked_to_main(false); win.set_menu_item(menuitem); win.open_windows(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_List.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_List.java index 6150f7ffb94fb3522b4f6f37f662a3976ac4a75c..c73f87aec122e46acfea9712e6fbd3bdfae37f72 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_List.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Peptide_List.java @@ -1,7 +1,6 @@ package fr.inra.pappso.xtandempipeline.ui.results; import fr.inra.pappso.xtandempipeline.MsException.StopException; -import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.class_msms.Identification; import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetProt; import fr.inra.pappso.xtandempipeline.thread.DataType_Base; @@ -12,8 +11,8 @@ import org.eclipse.swt.graphics.Point; public class Peptide_List extends window_base { - public Peptide_List(Main_Windows global, config conf) { - super(global, conf); + public Peptide_List(Main_Windows global) { + super(global); } protected void initialise() { @@ -45,7 +44,7 @@ public class Peptide_List extends window_base { protected void view_CTab_Item_in_independant_windows(CTabItem dragItem, Point point) { Peptide_List_item dragitem = (Peptide_List_item) dragItem; - Peptide_List win = new Peptide_List(controlleur, conf); + Peptide_List win = new Peptide_List(controlleur); win.setLinked_to_main(false); win.set_menu_item(menuitem); win.open_windows(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_Details.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_Details.java index c83fe48b9584d9accc6a171f2bbdfae48c1312c8..25f3884bef30727d06c74a4494ee6b47c8d3454d 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_Details.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_Details.java @@ -1,19 +1,16 @@ package fr.inra.pappso.xtandempipeline.ui.results; import fr.inra.pappso.xtandempipeline.MsException.StopException; -import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetProt; import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Point; - - public class Protein_Details extends window_base { - public Protein_Details(Main_Windows global, config conf) { - super(global,conf); + public Protein_Details(Main_Windows global) { + super(global); // TODO Auto-generated constructor stub } @@ -47,7 +44,7 @@ public class Protein_Details extends window_base { protected void view_CTab_Item_in_independant_windows(CTabItem dragItem, Point point) { Protein_Details_item dragitem = (Protein_Details_item) dragItem; - Protein_Details win = new Protein_Details(controlleur, conf); + Protein_Details win = new Protein_Details(controlleur); win.setLinked_to_main(false); win.set_menu_item(menuitem); win.open_windows(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_List.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_List.java index c89a0e83e537f2f82599ec5084cba0553ebeda98..177f2ec7eb999e69186cdb10f1b3beffae37d905 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_List.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/Protein_List.java @@ -1,7 +1,6 @@ package fr.inra.pappso.xtandempipeline.ui.results; import fr.inra.pappso.xtandempipeline.MsException.StopException; -import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.class_msms.Identification; import fr.inra.pappso.xtandempipeline.thread.DataType_Base; import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; @@ -9,13 +8,10 @@ import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.graphics.Point; - - - public class Protein_List extends window_base { - public Protein_List(Main_Windows global, config conf) { - super(global, conf); + public Protein_List(Main_Windows global) { + super(global); } protected void initialise() { @@ -52,7 +48,7 @@ public class Protein_List extends window_base { protected void view_CTab_Item_in_independant_windows(CTabItem dragItem, Point point) { Protein_List_item dragitem = (Protein_List_item) dragItem; - Protein_List win = new Protein_List(controlleur, conf); + Protein_List win = new Protein_List(controlleur); win.setLinked_to_main(false); win.set_menu_item(menuitem); win.open_windows(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/window_base.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/window_base.java index ae4d7f3f4f413cb1ce66ca914e22e3931fc6a493..d3c7186ce9a727ddf7a41835dd08eca7555cd353 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/window_base.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/results/window_base.java @@ -1,5 +1,6 @@ package fr.inra.pappso.xtandempipeline.ui.results; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; @@ -38,9 +39,9 @@ public class window_base { protected static final Logger logger = Logger.getLogger(window_base.class); - public window_base(Main_Windows global, config conf) { + public window_base(Main_Windows global) { this.controlleur = global; - this.conf = conf; + this.conf = XtandemPipelineSession.getInstance().getConfig(); this.linked_to_main = true; } @@ -125,7 +126,7 @@ public class window_base { protected void view_CTab_Item_in_independant_windows(CTabItem dragItem, Point point) { - window_base win = new window_base(controlleur, conf); + window_base win = new window_base(controlleur); win.setLinked_to_main(false); win.set_menu_item(menuitem); win.open_windows(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Export_Windows.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Export_Windows.java index 450fa1980b3ff0f0748405106dd94f4e887e4be0..630e918d6f9e0b0a6de28acbb3187e261cf421af 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Export_Windows.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Export_Windows.java @@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; import fr.inra.pappso.xtandempipeline.class_msms.config; import fr.inra.pappso.xtandempipeline.class_msms.Modifs; @@ -26,7 +27,6 @@ import fr.inra.pappso.xtandempipeline.class_msms.ModifsList; import fr.inra.pappso.xtandempipeline.filter_print.print_fasta; import fr.inra.pappso.xtandempipeline.filter_print.print_fasta_to_group; import fr.inra.pappso.xtandempipeline.filter_print.print_fasta_to_subgroup; -import fr.inra.pappso.xtandempipeline.sax_parse.Serialising; import fr.inra.pappso.xtandempipeline.thread.DataType_Base; public class Export_Windows { @@ -57,9 +57,9 @@ public class Export_Windows { protected Button setisotopelabel; - public Export_Windows(Main_Windows controlleur, config X, DataType_Base datatype) { - this.conf = X; - this.datatype = datatype; + public Export_Windows(Main_Windows controlleur) { + this.conf = XtandemPipelineSession.getInstance().getConfig(); + this.datatype = XtandemPipelineSession.getInstance().getDataTypeBase(); this.Cancelled = true; // initialise la fenetre shell = new Shell(controlleur.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); @@ -143,13 +143,13 @@ public class Export_Windows { choice_quantimscpp_export = new Button(group, SWT.CHECK); choice_quantimscpp_export .setText("Results for further quantification by MassChroQ"); - choice_quantimscpp_export.setSelection(conf.get_export_quantimscpp()); + choice_quantimscpp_export.setSelection(conf.get_export_masschroq()); this.setisotopelabel = new Button(group, SWT.PUSH); setisotopelabel.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_CENTER)); setisotopelabel.setText("Defined isotope labelling"); - setisotopelabel.setEnabled(conf.get_export_quantimscpp()); + setisotopelabel.setEnabled(conf.get_export_masschroq()); setisotopelabel.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Export_Windows.this.defined_isotope_label(); @@ -257,10 +257,10 @@ public class Export_Windows { conf.set_export_fasta(this.choice_fasta_export.getSelection()); conf.set_export_pepnovo(this.choice_pepnovo_export.getSelection()); conf.set_export_proticdbml(this.choice_protic_export.getSelection()); - conf.set_export_quantimscpp(this.choice_quantimscpp_export + conf.set_export_masschroq(this.choice_quantimscpp_export .getSelection()); // on sauve - new Serialising().serialise_xtandem_conf(conf); + conf.savePropertiestoXml(); datatype.getPrint().setfileout(out); int index = fasta_type.getSelectionIndex(); if (index >= 0) diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Filter_Windows.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Filter_Windows.java index 0ac6f531f2492a1d23fde3c31a0eb15a79ba97e0..b208718d6ff6b55458112892b87a6781d740339e 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Filter_Windows.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Filter_Windows.java @@ -18,10 +18,10 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; import fr.inra.pappso.xtandempipeline.MsException.StopException; import fr.inra.pappso.xtandempipeline.class_msms.config; -import fr.inra.pappso.xtandempipeline.sax_parse.Serialising; import fr.inra.pappso.xtandempipeline.thread.DataType_Base; public class Filter_Windows { @@ -36,10 +36,10 @@ public class Filter_Windows { private Boolean Cancelled; private DataType_Base type; - public Filter_Windows(Main_Windows controlleur, config X, DataType_Base type) { + public Filter_Windows(Main_Windows controlleur) { Cancelled = true; - this.type = type; - this.conf = X; + this.conf = XtandemPipelineSession.getInstance().getConfig(); + this.type = XtandemPipelineSession.getInstance().getDataTypeBase(); this.add_xml = new Vector<File>(); current_directory = conf.getXmlresult().getAbsolutePath(); shell = new Shell(controlleur.getDisplay(),SWT.DIALOG_TRIM|SWT.APPLICATION_MODAL); @@ -205,7 +205,7 @@ public class Filter_Windows { private void next_clic() { try { this.modified_conf(); - new Serialising().serialise_xtandem_conf(conf); + conf.savePropertiestoXml(); type.getPro().setXtandem(add_xml); Cancelled = false; shell.dispose(); diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Main_Windows.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Main_Windows.java index 4d5c0a900e5e279a95becda577d80a64461b66f4..87fb7f5c6637b555a9f69282e0b8929f43555019 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Main_Windows.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Main_Windows.java @@ -1,6 +1,7 @@ package fr.inra.pappso.xtandempipeline.ui.swt; import fr.inra.pappso.xtandempipeline.XtandemPipelineMain; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; import fr.inra.pappso.xtandempipeline.MsException.StopException; import fr.inra.pappso.xtandempipeline.class_msms.Database; @@ -12,15 +13,12 @@ import fr.inra.pappso.xtandempipeline.filter_print.calculation_peptide_mh_deviat import fr.inra.pappso.xtandempipeline.filter_print.calculation_protein_fdr; import fr.inra.pappso.xtandempipeline.grouping.HashSampleScanSetProt; import fr.inra.pappso.xtandempipeline.grouping.SubGroup; -import fr.inra.pappso.xtandempipeline.sax_parse.Serialising; import fr.inra.pappso.xtandempipeline.thread.DataType_Base; import fr.inra.pappso.xtandempipeline.thread.DataType_Combine; import fr.inra.pappso.xtandempipeline.thread.DataType_individual; import fr.inra.pappso.xtandempipeline.thread.DataType_phosphopeptide; import fr.inra.pappso.xtandempipeline.thread.load_result_and_create_grouping; -import fr.inra.pappso.xtandempipeline.thread.printing_combine; -import fr.inra.pappso.xtandempipeline.thread.printing_indiv; -import fr.inra.pappso.xtandempipeline.thread.printing_phosphopeptide; +import fr.inra.pappso.xtandempipeline.thread.printing_base; import fr.inra.pappso.xtandempipeline.thread.process; import fr.inra.pappso.xtandempipeline.thread.reinitialise_result_filter_and_create_grouping; import fr.inra.pappso.xtandempipeline.thread.save_result_and_filtering; @@ -72,7 +70,7 @@ public class Main_Windows { protected Shell shell; - protected DataType_Base data_type; + //protected DataType_Base XtandemPipelineSession.getInstance().getDataTypeBase(); private Peptide_Details peptide_details; @@ -100,21 +98,21 @@ public class Main_Windows { public Main_Windows() { logger.debug("Main_Windows begin"); - boolean newconfig = false; - try { - conf = new Serialising().unserialise_xtandem_conf(); + //ouverture d'une session + boolean oldconfig = false; + try { + conf = XtandemPipelineSession.getInstance().getConfig(); + oldconfig = conf.loadPropertiesFromXml(); } catch (Exception e) { - conf = new config(); - System.out.println("" + e); - newconfig = true; + logger.error("Problem to load old config file"+e); + e.printStackTrace(); } buttons = new Vector<Button>(); items = new Vector<MenuItem>(); - data_type = new DataType_Base(conf); - peptide_details = new Peptide_Details(this, conf); - protein_details = new Protein_Details(this, conf); - peptide_list = new Peptide_List(this, conf); - protein_list = new Protein_List(this, conf); + peptide_details = new Peptide_Details(this); + protein_details = new Protein_Details(this); + peptide_list = new Peptide_List(this); + protein_list = new Protein_List(this); identifications = new Vector<Identification>(); @@ -139,8 +137,8 @@ public class Main_Windows { shell.setText("X!Tandem results "+XtandemPipelineMain.version); - if (newconfig) - new Path_configuration(this, conf); + if (!oldconfig) + new Path_configuration(this); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { @@ -223,7 +221,7 @@ public class Main_Windows { } protected void calcul_fdr(Button widget) { - if (data_type.getIs_active() && database_list.getSelectionCount() > 0) { + if ( XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active() && database_list.getSelectionCount() > 0) { String[] databases = database_list.getSelection(); calculation_peptide_fdr calc_pep = new calculation_peptide_fdr( @@ -347,15 +345,15 @@ public class Main_Windows { } private void update_filter_param() { - ((Text) filter_button.getData("peptide")).setText(""+this.data_type.getConf().get_peptide_evalue()); - ((Text) filter_button.getData("pepnumber")).setText(""+this.data_type.getConf().get_peptide_number()); - ((Text) filter_button.getData("protein")).setText(""+this.data_type.getConf().get_protein_evalue()); + ((Text) filter_button.getData("peptide")).setText(""+XtandemPipelineSession.getInstance().getConfig().get_peptide_evalue()); + ((Text) filter_button.getData("pepnumber")).setText(""+XtandemPipelineSession.getInstance().getConfig().get_peptide_number()); + ((Text) filter_button.getData("protein")).setText(""+XtandemPipelineSession.getInstance().getConfig().get_protein_evalue()); } protected void filter_results_to(Button widget) { try { - if (!data_type.getIs_active()) + if (! XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active()) throw new StopException(""); float fl1; float fl2; @@ -388,7 +386,7 @@ public class Main_Windows { process p = new reinitialise_result_filter_and_create_grouping( conf, identifications.elementAt(identif_select - .getSelectionIndex()), data_type); + .getSelectionIndex()), XtandemPipelineSession.getInstance().getDataTypeBase()); new Running(this, p, false); this.view_result(); @@ -409,7 +407,7 @@ public class Main_Windows { boolean type = false; if (((Combo) widget.getData("type")).getSelectionIndex() == 0) type = true; - if (data_type.getIs_active()) { + if ( XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active()) { calculation_peptide_mh_deviation calc = new calculation_peptide_mh_deviation( type); int index = identif_select.getSelectionIndex(); @@ -608,13 +606,13 @@ public class Main_Windows { private void update_identification_result() { logger.debug("Number of identification results : "+identifications.size()); identif_select.removeAll(); - System.out.println("datatype=" + data_type); - if (data_type.getIs_active()) { - if (data_type.getIs_invididual()) { + logger.debug("datatype=" + XtandemPipelineSession.getInstance().getDataTypeBase()); + if ( XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active()) { + if ( XtandemPipelineSession.getInstance().getDataTypeBase().getIs_invididual()) { for (Identification ident : identifications) { identif_select.add(ident.get_samples().getMsRunList().get(0).getSampleName()); } - } else if (!data_type.getIs_phosphopeptide()) { + } else if (! XtandemPipelineSession.getInstance().getDataTypeBase().getIs_phosphopeptide()) { identif_select.add("Combine result"); } else { identif_select.add("Phosphopeptide result"); @@ -636,7 +634,7 @@ public class Main_Windows { } protected boolean view_result() { - if (!data_type.getIs_active()) + if (! XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active()) return (false); int index = identif_select.getSelectionIndex(); System.out.println(index + ""); @@ -655,13 +653,13 @@ public class Main_Windows { // envoyer les signaux aux autres fenetres this.protein_list - .load_data(identifications.elementAt(index), data_type); + .load_data(identifications.elementAt(index), XtandemPipelineSession.getInstance().getDataTypeBase()); return (true); } public void view_protein(Identification ident, SubGroup sg, HashSampleScanSetProt hashProt) { - this.peptide_list.load_data(ident, hashProt, data_type); + this.peptide_list.load_data(ident, hashProt, XtandemPipelineSession.getInstance().getDataTypeBase()); this.protein_details.view_protein_details(hashProt); } @@ -725,29 +723,24 @@ public class Main_Windows { protected void export_identification_results() { try { - if (!data_type.getIs_active()) + DataType_Base datatype = XtandemPipelineSession.getInstance().getDataTypeBase(); + if (! datatype.getIs_active()) throw new StopException(""); + //on recree un nouveau printer sinon erreur si déjà processer + datatype.newPrint(); + + datatype.getPrint().setIdentifications(identifications); - // ATTENTION si le process a déjà été tourné, il y aura une erreur, - // remise à jour - if (data_type.getIs_invididual()) - data_type.setPrint(new printing_indiv(conf)); - else if (data_type.getIs_phosphopeptide()) - data_type.setPrint(new printing_phosphopeptide(conf)); - else - data_type.setPrint(new printing_combine(conf)); - data_type.getPrint().setIdentifications(identifications); - - Export_Windows export = new Export_Windows(this, conf, data_type); + Export_Windows export = new Export_Windows(this); File S_out = export.getFileOut(); if (export.isCancelled()) throw new StopException("Stopping"); - new Running(this, data_type.getPrint(), false); + new Running(this, datatype.getPrint(), false); - if (!data_type.getPrint().getError().equalsIgnoreCase("")) - throw new MSMSException(data_type.getPrint().getError()); - if (data_type.getPrint().isStop()) + if (! datatype.getPrint().getError().equalsIgnoreCase("")) + throw new MSMSException( datatype.getPrint().getError()); + if ( datatype.getPrint().isStop()) throw new StopException(""); MessageBox messageBox = new MessageBox(shell, SWT.OK); @@ -764,8 +757,10 @@ public class Main_Windows { protected void analysed(DataType_Base type) { try { + //on met à jour le type de datatype + XtandemPipelineSession.getInstance().setDataTypeBase(type); // configuration des paramètres de filtrage - Filter_Windows filter = new Filter_Windows(this, conf, type); + Filter_Windows filter = new Filter_Windows(this); if (filter.isCancelled()) throw new StopException("Stopping"); @@ -780,7 +775,7 @@ public class Main_Windows { identifications = type.getPro().getIdentifications(); if (identifications.size() == 0) throw new MSMSException("No valide identification"); - this.data_type = type; + this.update_identification_result(); } catch (StopException e) { @@ -849,8 +844,8 @@ public class Main_Windows { if (loading.isStop()) throw new StopException(""); - this.data_type = loading.getData_type(); this.identifications = loading.getIdentifications(); + this.update_identification_result(); } catch (StopException e) { System.out.println("stop"); @@ -861,11 +856,11 @@ public class Main_Windows { public void save_current_project() { try { - if (!data_type.getIs_active()) + if (! XtandemPipelineSession.getInstance().getDataTypeBase().getIs_active()) throw new StopException(""); File out = this.get_file_project("Save current project as", SWT.SAVE); - save_result_and_filtering save = new save_result_and_filtering(conf, out, identifications, data_type); + save_result_and_filtering save = new save_result_and_filtering(conf, out, identifications, XtandemPipelineSession.getInstance().getDataTypeBase()); new Running(this,save,false); if (!save.getError().equalsIgnoreCase("")) @@ -931,7 +926,7 @@ class ResultSelectionListener implements Listener { else if (it.getText().equals("Phosphopeptide")) name.analysed(new DataType_phosphopeptide(name.conf)); else if (it.getText().equals("Path preference")) - new Path_configuration(name, name.conf); + new Path_configuration(name); else if (it.getText().equals("X!Tandem preset")) new Xtandem_preset(name, name.conf); else if (it.getText().equals("Documentation")) { diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Path_configuration.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Path_configuration.java index 5f9e7d1bdb91089344c6172ea23eec4174244fff..921602f6a2a450ace65b60b1e9a23f1eb89fedfb 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Path_configuration.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/ui/swt/Path_configuration.java @@ -20,17 +20,17 @@ import org.eclipse.swt.widgets.Text; +import fr.inra.pappso.xtandempipeline.XtandemPipelineSession; import fr.inra.pappso.xtandempipeline.MsException.MSMSException; import fr.inra.pappso.xtandempipeline.class_msms.config; -import fr.inra.pappso.xtandempipeline.sax_parse.Serialising; public class Path_configuration { protected Shell shell; private config conf; - public Path_configuration(Main_Windows controlleur, config X) { - this.conf = X; + public Path_configuration(Main_Windows controlleur) { + this.conf = XtandemPipelineSession.getInstance().getConfig(); shell = new Shell(controlleur.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setImages(controlleur.getImages()); shell.setText("Path configuration"); @@ -188,7 +188,7 @@ public class Path_configuration { public void save_configuration_to_disque() { try { - new Serialising().serialise_xtandem_conf(conf); + conf.savePropertiestoXml(); } catch (MSMSException e) { MessageBox messageBox = new MessageBox(shell, SWT.ERROR); messageBox