Skip to content
Snippets Groups Projects
Commit 68b39d42 authored by langella's avatar langella
Browse files

reading local log4j.properties file

git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@283 b8ef2a07-7df7-436f-90b9-41648038564b
parent 6da38e0a
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ package fr.inra.pappso.xtandempipeline; ...@@ -20,6 +20,7 @@ package fr.inra.pappso.xtandempipeline;
*/ */
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
...@@ -30,6 +31,7 @@ import org.apache.commons.codec.binary.Base64; ...@@ -30,6 +31,7 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.PropertyConfigurator;
import fr.inra.pappso.xtandempipeline.class_msms.config;
import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows; import fr.inra.pappso.xtandempipeline.ui.swt.Main_Windows;
public class XtandemPipelineMain { public class XtandemPipelineMain {
...@@ -53,25 +55,34 @@ public class XtandemPipelineMain { ...@@ -53,25 +55,34 @@ public class XtandemPipelineMain {
+ "If a protein is identified by two peptides with an evalue of O.O1, the protein evalue is O.OOO1.\n\n" + "If a protein is identified by two peptides with an evalue of O.O1, the protein evalue is O.OOO1.\n\n"
+ "So, we preconise to put -4 for the protein evalue filter instead of -8."; + "So, we preconise to put -4 for the protein evalue filter instead of -8.";
public static String news = "3.2.2 : Corrected report of input parameter on X!Tandem output result (thanks to T. Greko)\n\n"+ public static String news = "3.2.2 : Corrected report of input parameter on X!Tandem output result (thanks to T. Greko)\n\n"
"3.2.1 : Add new X!Tandem paramaters for multiple search of modifications in one analyse and calculation can now be performed on z > 3"+"\n\n"+ + "3.2.1 : Add new X!Tandem paramaters for multiple search of modifications in one analyse and calculation can now be performed on z > 3"
"3.2.0 : Identification from Mascot dat file can now be imported and filtered."+ + "\n\n"
" All work as X!Tandem result excepts that protein sequence can not be retrieved : PAI and coverage are absent.\n"+ + "3.2.0 : Identification from Mascot dat file can now be imported and filtered."
"Correction of FDR calculation from Reverse/Decoy search."; + " All work as X!Tandem result excepts that protein sequence can not be retrieved : PAI and coverage are absent.\n"
+ "Correction of FDR calculation from Reverse/Decoy search.";
public static void main(String[] args) { public static void main(String[] args) {
// Chargement en release mode File log4jPropertyFile = new File(config.getRacinePath()
if (System.getProperty("os.name").contains("Linux")) { + System.getProperty("file.separator") + "log4j.properties");
PropertyConfigurator.configure(XtandemPipelineMain.class if (log4jPropertyFile.exists()) {
.getResource("/conf/log4j.linux.properties")); PropertyConfigurator.configure(log4jPropertyFile.getAbsolutePath());
logger.info("Linux logging"); logger.info("loading log4j proterties from "+log4jPropertyFile.getAbsolutePath());
// System.out.print("Linux logging"); // return (false);
} else { } else {
PropertyConfigurator.configure(XtandemPipelineMain.class // Chargement en release mode
.getResource("/conf/log4j.windows.properties")); if (System.getProperty("os.name").contains("Linux")) {
logger.info("Window logging"); PropertyConfigurator.configure(XtandemPipelineMain.class
// System.out.print("Window logging"); .getResource("/conf/log4j.linux.properties"));
logger.info("Linux logging");
// System.out.print("Linux logging");
} else {
PropertyConfigurator.configure(XtandemPipelineMain.class
.getResource("/conf/log4j.windows.properties"));
logger.info("Window logging");
// System.out.print("Window logging");
}
} }
if (args.length > 0) { if (args.length > 0) {
try { try {
......
...@@ -144,7 +144,7 @@ public class config { ...@@ -144,7 +144,7 @@ public class config {
public File getXtandem_model() { public File getXtandem_model() {
File file = new File(properties.getProperty(xtandem_model, File file = new File(properties.getProperty(xtandem_model,
this.getRacinePath() + System.getProperty("file.separator") config.getRacinePath() + System.getProperty("file.separator")
+ "xtandem_models")); + "xtandem_models"));
if (!file.exists()) if (!file.exists())
file.mkdirs(); file.mkdirs();
...@@ -375,7 +375,7 @@ public class config { ...@@ -375,7 +375,7 @@ public class config {
} }
public boolean loadPropertiesFromXml() throws Exception { public boolean loadPropertiesFromXml() throws Exception {
File xml = new File(this.getRacinePath() File xml = new File(config.getRacinePath()
+ System.getProperty("file.separator") + "xtandempipeline.conf"); + System.getProperty("file.separator") + "xtandempipeline.conf");
if (!xml.exists()) { if (!xml.exists()) {
logger.info("New configuration file"); logger.info("New configuration file");
...@@ -387,14 +387,14 @@ public class config { ...@@ -387,14 +387,14 @@ public class config {
} }
public void savePropertiestoXml() throws Exception { public void savePropertiestoXml() throws Exception {
File xml = new File(this.getRacinePath() File xml = new File(config.getRacinePath()
+ System.getProperty("file.separator") + "xtandempipeline.conf"); + System.getProperty("file.separator") + "xtandempipeline.conf");
logger.info("Save properties condfiguration to : " + xml.getPath()); logger.info("Save properties condfiguration to : " + xml.getPath());
properties.storeToXML(new FileOutputStream(xml), properties.storeToXML(new FileOutputStream(xml),
"Xtandem pipeline configuration file"); "Xtandem pipeline configuration file");
} }
private File getRacinePath() { static public File getRacinePath() {
File path; File path;
if (System.getProperty("os.name").contains("Linux")) { if (System.getProperty("os.name").contains("Linux")) {
path = new File(System.getProperty("user.home") path = new File(System.getProperty("user.home")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment