Skip to content
Snippets Groups Projects
Commit 53d25e72 authored by Olivier Langella's avatar Olivier Langella
Browse files

Ods2Csv bug found by T. Balliau is fixed

parent 513f8413
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,4 @@
/build
/build_ubuntu.xml
/build.xml
mascotdatfile_log4j.log
mascotdatfile_log4j.log*
No preview for this file type
No preview for this file type
......@@ -120,6 +120,7 @@ public class print_ods_peptide_list extends printOdsBase {
}
odsTable.writeLine();
// out.write("\n");
logger.debug("printing group " + group.getNumber()+" end");
}
}
......@@ -39,10 +39,10 @@ public class CsvRedundantPeptideOutput extends OdsRedundantPeptideOutput {
public CsvRedundantPeptideOutput(OutputStream outputStream)
throws MSMSException {
ods2csv = new Ods2Csv();
ods2csv.setSinkOutputStream(outputStream);
ods2csv.setNumericFormat(NumericFormat.en);
ods2csv.setSeparator('\t');
try {
ods2csv.setSinkOutputStream(outputStream);
ods2csv.setNumericFormat(NumericFormat.en);
ods2csv.setSeparator('\t');
odsTable = ods2csv.getOdsDocPipedOutput();
} catch (Exception e) {
String message = "error getting OdsDocPipedOutput "
......
......@@ -72,6 +72,10 @@ public class OdsRedundantPeptideOutput {
String message = "DatatypeConfigurationException " + e.getMessage();
logger.error(message);
throw new MSMSException(message);
} catch (Exception e) {
String message = "Exception " + e.getMessage();
logger.error(message);
throw new MSMSException(message);
}
}
......@@ -84,6 +88,10 @@ public class OdsRedundantPeptideOutput {
String message = "XMLStreamException " + e.getMessage();
logger.error(message);
throw new MSMSException(message);
} catch (Exception e) {
String message = "Exception " + e.getMessage();
logger.error(message);
throw new MSMSException(message);
}
}
......@@ -202,6 +210,11 @@ public class OdsRedundantPeptideOutput {
+ e.getMessage();
logger.error(message);
throw new MSMSException(message);
} catch (Exception e) {
String message = "Exception in write(Identification ident) "
+ e.getMessage();
logger.error(message);
throw new MSMSException(message);
}
}
......@@ -237,6 +250,10 @@ public class OdsRedundantPeptideOutput {
+ e.getMessage();
logger.error(message);
throw new MSMSException(message);
} catch (Exception e) {
String message = "Exception in writeHeaders() " + e.getMessage();
logger.error(message);
throw new MSMSException(message);
}
}
......
......@@ -8,6 +8,7 @@ import java.util.HashSet;
import fr.inra.pappso.csv2ods.Ods2Csv;
import fr.inra.pappso.libodsstream.OdsDocWriter;
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.Protein;
import fr.inra.pappso.xtandempipeline.class_msms.config;
......@@ -228,6 +229,8 @@ public class printing_base extends process {
}
protected void printPeptideList(OdsDocWriter odsDoc) throws Exception {
logger.debug("printPeptideList begin");
// Verification pas arrete
if (this.isStop())
throw new StopException("");
......@@ -248,10 +251,18 @@ public class printing_base extends process {
for (Identification ident : this.identifications) {
writer.write(ident);
}
logger.debug("printPeptideList end");
if (this.isCsv) {
odsDoc.close();
logger.debug("csv file closed "
+ this.getfileout().getAbsolutePath() + "_peptide_list.txt");
}
}
protected void printOldPeptideList(OdsDocWriter odsDoc) throws Exception {
// Verification pas arrete
logger.debug("printOldPeptideList begin");
if (this.isStop())
throw new StopException("");
this.add_current_progress();
......@@ -270,8 +281,20 @@ public class printing_base extends process {
// output.open(this.getfileout().getAbsolutePath() + "_peptide.txt");
// peptide list
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_peptide_list(odsDoc));
try {
ident.print_result(new print_ods_peptide_list(odsDoc));
} catch (Exception e) {
String message = "error in ident.print_result :\n"
+ e.getMessage();
logger.error(message);
throw new MSMSException(message);
}
}
logger.debug("printOldPeptideList end");
if (this.isCsv) {
odsDoc.close();
logger.debug("csv file closed "
+ this.getfileout().getAbsolutePath() + "_peptide.txt");
}
}
}
......@@ -19,60 +19,73 @@ public class printing_combine extends printing_base {
this.set_view("Printing protein file results");
OdsDocWriter odsDoc;
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// msms_output output = new msms_output();
// output.open(this.getfileout().getAbsolutePath() + "_protein.txt");
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_combined(odsDoc));
}
if (this.isCsv) {
odsDoc.close();
}
this.printOldPeptideList(odsDoc);
if (this.isCsv) {
odsDoc.close();
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing compar file results");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_compar.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("compar");
}
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_compar(odsDoc, ident.getMsRunSet()));
}
if (this.isCsv) {
OdsDocWriter odsDoc = null;
try {
logger.debug("Print combine results proteins");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// msms_output output = new msms_output();
// output.open(this.getfileout().getAbsolutePath() +
// "_protein.txt");
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_combined(odsDoc));
}
if (this.isCsv) {
odsDoc.close();
}
logger.debug("Print combine results old peptides");
this.printOldPeptideList(odsDoc);
if (this.isCsv) {
odsDoc.close();
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing compar file results");
logger.debug("Print combine results compar");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_compar.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("compar");
}
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_compar(odsDoc, ident
.getMsRunSet()));
}
if (this.isCsv) {
odsDoc.close();
}
logger.debug("Print combine new peptide");
this.printPeptideList(odsDoc);
odsDoc.close();
} catch (Exception e) {
throw e;
} finally {
if (odsDoc != null) {
odsDoc.close();
}
}
this.printPeptideList(odsDoc);
odsDoc.close();
this.add_current_progress();
}
......
......@@ -5,7 +5,6 @@ import fr.inra.pappso.libodsstream.OdsDocWriter;
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.filter_print.print_ods_peptide_list;
import fr.inra.pappso.xtandempipeline.filter_print.print_ods_protein_to_indiv;
public class printing_indiv extends printing_base {
......@@ -19,40 +18,55 @@ public class printing_indiv extends printing_base {
this.set_view("Printing protein file results");
OdsDocWriter odsDoc;
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// msms_output output = new msms_output();
// output.open(this.getfileout().getAbsolutePath() + "_protein.txt");
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_indiv(odsDoc, ident
.getMsRunSet()));
}
if (this.isCsv) {
OdsDocWriter odsDoc = null;
try {
logger.debug("Print indiv results proteins");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// msms_output output = new msms_output();
// output.open(this.getfileout().getAbsolutePath() +
// "_protein.txt");
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_indiv(odsDoc, ident
.getMsRunSet()));
}
if (this.isCsv) {
odsDoc.close();
}
logger.debug("Print indiv results old peptides");
this.printOldPeptideList(odsDoc);
logger.debug("after printOldPeptideList(odsDoc)");
if (this.isCsv) {
logger.debug("try to close");
odsDoc.close();
}
logger.debug("Print indiv results new peptides");
this.printPeptideList(odsDoc);
odsDoc.close();
} catch (Exception e) {
throw e;
} finally {
if (odsDoc != null) {
odsDoc.close();
}
}
this.printOldPeptideList(odsDoc);
if (this.isCsv) {
odsDoc.close();
}
this.printPeptideList(odsDoc);
odsDoc.close();
// Verification pas arrete
if (this.isStop())
throw new StopException("");
......@@ -60,5 +74,4 @@ public class printing_indiv extends printing_base {
}
}
......@@ -20,76 +20,86 @@ public class printing_phosphopeptide extends printing_base {
this.set_view("Printing protein file results");
OdsDocWriter odsDoc;
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_phosphopeptide(odsDoc));
}
if (this.isCsv) {
odsDoc.close();
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing peptide file results");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_peptide.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("peptides");
}
// output.open(this.getfileout().getAbsolutePath() + "_peptide.txt");
// peptide list
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_peptide_list_to_phosphopeptide(
odsDoc));
}
if (this.isCsv) {
OdsDocWriter odsDoc = null;
try {
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_protein.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc = new OdsDocWriter(this.getfileout().getAbsolutePath()
+ ".ods");
odsDoc.writeSheet("proteins");
}
// protein view
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_protein_to_phosphopeptide(
odsDoc));
}
if (this.isCsv) {
odsDoc.close();
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing peptide file results");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_peptide.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("peptides");
}
// output.open(this.getfileout().getAbsolutePath() +
// "_peptide.txt");
// peptide list
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_peptide_list_to_phosphopeptide(
odsDoc));
}
if (this.isCsv) {
odsDoc.close();
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing compar file results");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_compar.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("compar");
}
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_compar_phospho(odsDoc, ident
.getMsRunSet()));
}
odsDoc.close();
} catch (Exception e) {
throw e;
} finally {
if (odsDoc != null) {
odsDoc.close();
}
}
// Verification pas arrete
if (this.isStop())
throw new StopException("");
this.add_current_progress();
this.set_view("Printing compar file results");
if (this.isCsv) {
Ods2Csv ods2csv = new Ods2Csv();
ods2csv.setSinkFilename(this.getfileout().getAbsolutePath()
+ "_compar.txt");
odsDoc = ods2csv.getOdsDocPipedOutput();
} else {
odsDoc.writeSheet("compar");
}
for (Identification ident : this.identifications) {
ident.print_result(new print_ods_compar_phospho(odsDoc, ident
.getMsRunSet()));
}
odsDoc.close();
this.add_current_progress();
}
......
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