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

stores and reads scan number correspondance from XPIP files

parent e10e80b9
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,20 @@ public interface IdentificationDataSource extends
* store scan number correspondance information
*
* this is usefull in case the real scan num (given by the spectrometer) is
* not the same as indicated in the identification data source :
* one can store the fuzzy scan number and still can get MSMS data from the source
* not the same as indicated in the identification data source : one can
* store the fuzzy scan number and still can get MSMS data from the source
*
*/
public void setScanCorrespondance(int fixedScanNum,
int scanNumAsWrittenInDataSource);
/**
* gets the identifier of the spectrum within this datasource, given the
* real spectrum scan number
*
* @param scanNumber
* @return NULL if there is no correspondance
*/
public Integer getScanCorrespondance(int scanNumber);
}
......@@ -56,4 +56,9 @@ public class IdentificationMascotFile extends IdentificationDataFile {
int scanNumAsWrittenInDataSource) {
}
@Override
public Integer getScanCorrespondance(int scanNumber) {
return null;
}
}
......@@ -123,4 +123,9 @@ public class IdentificationProticPortSource implements IdentificationDataSource
int scanNumAsWrittenInDataSource) {
}
@Override
public Integer getScanCorrespondance(int scanNumber) {
return null;
}
}
......@@ -110,9 +110,16 @@ public class IdentificationXtandemFile extends IdentificationDataFile {
@Override
public void setScanCorrespondance(int fixedScanNum,
int scanNumAsWrittenInDataSource) {
if (fixedScanNum == scanNumAsWrittenInDataSource)
return;
logger.debug("setScanCorrespondance " + fixedScanNum + "=>"
+ scanNumAsWrittenInDataSource);
this.scanNum2XtandemScanNum.put(fixedScanNum,
scanNumAsWrittenInDataSource);
}
@Override
public Integer getScanCorrespondance(int scanNumber) {
return scanNum2XtandemScanNum.get(scanNumber);
}
}
......@@ -15,6 +15,7 @@ import fr.inra.pappso.xtandempipeline.class_msms.Identification;
import fr.inra.pappso.xtandempipeline.class_msms.Match;
import fr.inra.pappso.xtandempipeline.class_msms.Modifs;
import fr.inra.pappso.xtandempipeline.class_msms.MsRun;
import fr.inra.pappso.xtandempipeline.class_msms.IdentificationDataFile.IdentificationDataSource;
import fr.inra.pappso.xtandempipeline.class_msms.MapDb.Peptide;
import fr.inra.pappso.xtandempipeline.thread.DataType_Base;
import fr.inra.pappso.xtandempipeline.thread.process;
......@@ -108,10 +109,15 @@ public class XpipWriter {
private void write_peptide_to(Peptide pep) throws Exception {
writer.writeStartElement("peptide");
writer.writeAttribute("sample", pep.get_sample());
pep.getIdentificationDataSource().writeXpipPeptideSourceAttribute(
writer);
IdentificationDataSource dataSource = pep.getIdentificationDataSource();
dataSource.writeXpipPeptideSourceAttribute(writer);
writer.writeAttribute("scan", "" + pep.get_scan());
writer.writeAttribute("scan_in_xtandem", "" + pep.get_scan());
Integer scanCorrespondance = dataSource.getScanCorrespondance(pep
.get_scan());
if (scanCorrespondance != null) {
writer.writeAttribute("scan_in_xtandem", "" + scanCorrespondance);
}
writer.writeAttribute("RT", "" + pep.get_RT_in_sec());
writer.writeAttribute("mhplus_obser", "" + pep.get_mhplus_obser());
writer.writeAttribute("mhplus_theo", "" + pep.get_mhplus_theo());
......
......@@ -138,9 +138,9 @@ public class load_project extends org.xml.sax.helpers.DefaultHandler {
if (sampleName == null) {
throw new MSMSException("sample attribute is null");
}
prot_.set_evalue(identification_.getMsRunSet().getInstance(
sampleName), Float.valueOf(attrs.getValue("evalue"))
.floatValue());
prot_.set_evalue(
identification_.getMsRunSet().getInstance(sampleName),
Float.valueOf(attrs.getValue("evalue")).floatValue());
}
if (Start_element_.equals("peptide")) {
this.startElementpeptide(namespaceURI, attrs);
......@@ -235,16 +235,19 @@ public class load_project extends org.xml.sax.helpers.DefaultHandler {
originalFileName);
peptide.set_sample_id(this.identification_.getMsRunSet()
.getInstance(sampleName), sample_file);
if (attrs.getValue("scan_in_xtandem") == null) {
throw new MSMSException("scan_in_xtandem is null");
}
logger.debug("peptide.set_scan");
peptide.set_scan(Integer
.parseInt(attrs.getValue("scan_in_xtandem")));
//read scan number :
if (attrs.getValue("scan") == null) {
throw new MSMSException("scan is null");
}
peptide.set_scan(Integer.parseInt(attrs.getValue("scan")));
if (attrs.getValue("scan_in_xtandem") != null) {
//if there is a correspondance to make in the source file :
sample_file.setScanCorrespondance(peptide.get_scan(),
Integer.parseInt(attrs.getValue("scan_in_xtandem")));
}
if (attrs.getValue("RT") == null) {
// throw new MSMSException("RT is null");
logger.warn("RT is null");
......@@ -371,8 +374,8 @@ public class load_project extends org.xml.sax.helpers.DefaultHandler {
prot_ = null;
}
if (Last_element_.equals("identification")) {
XtandemPipelineSession.getInstance().getIdentificationList().add(
identification_);
XtandemPipelineSession.getInstance().getIdentificationList()
.add(identification_);
}
C_data = "";
}
......
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