Commit c9ce7ea2 authored by Langella Olivier's avatar Langella Olivier
Browse files

WIP: writing q-values in ODS file

parent 30f99ca7
......@@ -194,3 +194,9 @@ ComputeQvalues::cleanPeptideEvidenceList(
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void
ComputeQvalues::writeDistributionsByEngines(CalcWriterInterface *p_writer) const
{
}
......@@ -28,6 +28,7 @@
#pragma once
#include "../project.h"
#include <odsstream/calcwriterinterface.h>
/**
......@@ -45,6 +46,8 @@ class ComputeQvalues
* Destructor
*/
~ComputeQvalues();
void writeDistributionsByEngines(CalcWriterInterface * p_writer) const;
private:
void computeTandemPeptideEvidenceQvalues(
......
......@@ -170,7 +170,7 @@ OdsExport::write(CalcWriterInterface *p_writer, WorkMonitorInterface *p_monitor)
SampleSheet(this, p_writer, _p_project.get());
}
if(settings.value("export_ods/qvalues", "true").toBool())
if(settings.value("export_ods/qvalues", "false").toBool())
{
p_monitor->message(QObject::tr("writing q-values"));
QvaluesSheet(this, p_writer, _p_project);
......
......@@ -40,267 +40,9 @@ QvaluesSheet::QvaluesSheet(OdsExport *p_ods_export,
table_settings.setVerticalSplit(1);
_p_writer->setCurrentOdsTableSettings(table_settings);
writeHeaders();
// writeHeaders();
ComputeQvalues qvalues(p_project);
}
void
QvaluesSheet::writeHeaders()
{
// MS sample name X!tandem xml result file name X!Tandem version
// X!tandem xml model file name total spectra used total spectra assigned
// assigned/used percent total unique assigned database file names MS/MS data
// source file name MS/MS data source file path MS level 1 MS level 2 TIC
// mean in MS 1 TIC mean in MS 2 rt min rt max
_p_writer->writeLine();
_p_writer->writeCell("sample ID");
_p_writer->writeCell("sample");
_p_writer->writeCell("MS run file");
_p_writer->writeCell("Identification engine");
_p_writer->writeCell("Identification engine version");
_p_writer->writeCell("Identification result file");
_p_writer->writeCell("Identification fasta files");
_p_writer->writeCell("X!Tandem parameters");
// total_spectra_assigned=1, ///< total_spectra_assigned in one
// identification file (one sample)
_p_writer->setCellAnnotation(
"total spectra assigned in one identification file (one mzdata sample) "
"given by the identification engine");
_p_writer->writeCell("Total spectra assigned");
//
// total_spectra_used=2,///< total_spectra_used in one identification file
// (one sample)
_p_writer->setCellAnnotation(
"total spectra used in one identification file (one mzdata sample) given "
"by the identification engine");
_p_writer->writeCell("Total spectra used");
_p_writer->setCellAnnotation(
"Percentage of spectra assignment (spectra assigned / spectra used");
_p_writer->writeCell("Assignment percentage");
// total_unique_assigned=5,///< total number unique peptide sequence assigned
_p_writer->setCellAnnotation(
"total unique peptide sequence assigned in one identification file (one "
"mzdata sample) given by the identification engine");
_p_writer->writeCell("Total unique assigned");
if(_msrun_statistics)
{
_p_writer->setCellAnnotation(
"total number of scans during the MS run (from mz file)");
_p_writer->writeCell("Total scans");
_p_writer->setCellAnnotation(
"total number of MS level 1 during the MS run (from mz file)");
_p_writer->writeCell("Total MS1");
_p_writer->setCellAnnotation(
"total number of MS level 2 during the MS run (from mz file)");
_p_writer->writeCell("Total MS2");
_p_writer->setCellAnnotation(
"total number of MS level 3 during the MS run (from mz file)");
_p_writer->writeCell("Total MS3");
_p_writer->setCellAnnotation(
"total ion current in MS level 1 spectra "
"during the MS run (from mz file)");
_p_writer->writeCell("TIC MS1");
_p_writer->setCellAnnotation(
"total ion current in MS level 2 spectra "
"during the MS run (from mz file)");
_p_writer->writeCell("TIC MS2");
_p_writer->setCellAnnotation(
"total ion current in MS level 3 spectra "
"during the MS run (from mz file)");
_p_writer->writeCell("TIC MS3");
}
/*
total_peptide_used=3,///< total number of peptides generated and used in
identification total_proteins_used=4,///< total number of proteins generated
and used in identification
*/
}
void
QvaluesSheet::writeIdentificationDataSource(
IdentificationDataSource *p_ident_data_source)
{
_p_writer->writeLine();
MsRunSp msrun_sp = p_ident_data_source->getMsRunSp();
if(_msrun_statistics)
{
if(msrun_sp->findMsRunFile())
{
msrun_sp->checkMsRunStatistics();
}
msrun_sp->freeMsRunReaderSp();
}
_p_writer->writeCell(msrun_sp.get()->getXmlId());
_p_writer->writeCell(msrun_sp.get()->getSampleName());
_p_writer->writeCell(msrun_sp.get()->getFileName());
_p_writer->writeCell(p_ident_data_source->getIdentificationEngineName());
_p_writer->writeCell(p_ident_data_source->getIdentificationEngineVersion());
_p_writer->writeCell(p_ident_data_source->getResourceName());
QStringList fasta_files;
for(FastaFileSp fasta_file : p_ident_data_source->getFastaFileList())
{
fasta_files << fasta_file.get()->getAbsoluteFilePath();
}
_p_writer->writeCell(fasta_files.join(" "));
QVariant var_sample = p_ident_data_source->getIdentificationEngineParam(
IdentificationEngineParam::tandem_param);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toString());
}
var_sample = p_ident_data_source->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_assigned);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
var_sample = p_ident_data_source->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_used);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
if(!p_ident_data_source
->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_assigned)
.isNull() &&
!p_ident_data_source
->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_used)
.isNull())
{
_p_writer->writeCellPercentage(
p_ident_data_source
->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_assigned)
.toDouble() /
p_ident_data_source
->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_spectra_used)
.toDouble());
}
else
{
_p_writer->writeEmptyCell();
}
var_sample = p_ident_data_source->getIdentificationEngineStatistics(
IdentificationEngineStatistics::total_unique_assigned);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
if(_msrun_statistics)
{
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::total_spectra);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::total_spectra_ms1);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::total_spectra_ms2);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::total_spectra_ms3);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toInt());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::tic_spectra_ms1);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toDouble());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::tic_spectra_ms2);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toDouble());
}
var_sample =
msrun_sp.get()->getMsRunStatistics(MsRunStatistics::tic_spectra_ms3);
if(var_sample.isNull())
{
_p_writer->writeEmptyCell();
}
else
{
_p_writer->writeCell(var_sample.toDouble());
}
}
qvalues.writeDistributionsByEngines(_p_writer);
}
......@@ -39,13 +39,8 @@ class QvaluesSheet
ProjectSp p_project);
private:
void writeHeaders();
void
writeIdentificationDataSource(IdentificationDataSource *p_ident_data_source);
private:
OdsExport *_p_ods_export;
const Project *_p_project;
CalcWriterInterface *_p_writer;
bool _msrun_statistics = true;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment