Class SimpleMzIdentMLExporter
java.lang.Object
com.compomics.util.experiment.io.identification.writers.SimpleMzIdentMLExporter
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class SimpleMzIdentMLExporter extends Object implements Closeable
Simple mzIdentML exporter for PSM-level results.
- Author:
- Marc Vaudel
-
Field Summary
Fields Modifier and Type Field Description static String
ANALYSIS_SECTION
Key for the analysis section.static String
DATA_SECTION
Key for the data section.static String
HEAD_SECTION
Key for the head section.static int
MAX_NEUTRAL_LOSSES
The maximum number of neutral losses a fragment ion can have in order to be annotated.static MzIdentMLVersion
MZIDENTML_VERSION
The version of the mzIdentML format.static int
N_AA
The number of amino acids to export before and after the peptidestatic String
PEPTIDE_EVIDENCE_SECTION
Key for the peptide evidence section.static String
PEPTIDE_SECTION
Key for the peptide section. -
Constructor Summary
Constructors Constructor Description SimpleMzIdentMLExporter(String softwareName, String softwareVersion, String softwareUrl, File tempFolder, File destinationFile, ArrayList<File> spectrumFiles, File searchEngineFile, HashMap<String,ArrayList<String>> searchEngines, File fastaFile, IdentificationParameters identificationParameters, SequenceProvider sequenceProvider, ProteinDetailsProvider proteinDetailsProvider, SpectrumProvider spectrumProvider, ModificationProvider modificationProvider, FastaSummary fastaSummary, String contactFirstName, String contactLastName, String contactAddress, String contactEmail, String contactOrganizationName, String contactOrganizationAddress, String contactOrganizationEmail, boolean peptideInference)
Constructor. -
Method Summary
Modifier and Type Method Description void
addSpectrum(String spectrumFile, String spectrumTitle, ArrayList<PeptideAssumption> peptideAssumptions, ArrayList<TreeMap<Double,HashMap<Integer,Double>>> modificationLocalizationScores, PeptideSpectrumAnnotator peptideSpectrumAnnotator)
Adds a peptide-spectrum match to the file.void
close()
void
finalizeFile()
Finalizes the writing of the mzIdentML file.String
getModificationName(double modMass, Peptide peptide, int modSite)
Returns the name of the modification corresponding to he given modification mass at the given site on the given peptide.static String
getPeptideEvidenceKey(String accession, int peptideStart, long peptideKey)
Returns the peptide evidence key as string for the given peptide attributes.void
init(String contactFirstName, String contactLastName, String contactAddress, String contactEmail, String contactOrganizationName, String contactOrganizationAddress, String contactOrganizationEmail)
Initializes the writing of the file.
-
Field Details
-
HEAD_SECTION
Key for the head section.- See Also:
- Constant Field Values
-
PEPTIDE_SECTION
Key for the peptide section.- See Also:
- Constant Field Values
-
PEPTIDE_EVIDENCE_SECTION
Key for the peptide evidence section.- See Also:
- Constant Field Values
-
ANALYSIS_SECTION
Key for the analysis section.- See Also:
- Constant Field Values
-
DATA_SECTION
Key for the data section.- See Also:
- Constant Field Values
-
MZIDENTML_VERSION
The version of the mzIdentML format. -
MAX_NEUTRAL_LOSSES
public static final int MAX_NEUTRAL_LOSSESThe maximum number of neutral losses a fragment ion can have in order to be annotated.- See Also:
- Constant Field Values
-
N_AA
public static final int N_AAThe number of amino acids to export before and after the peptide- See Also:
- Constant Field Values
-
-
Constructor Details
-
SimpleMzIdentMLExporter
public SimpleMzIdentMLExporter(String softwareName, String softwareVersion, String softwareUrl, File tempFolder, File destinationFile, ArrayList<File> spectrumFiles, File searchEngineFile, HashMap<String,ArrayList<String>> searchEngines, File fastaFile, IdentificationParameters identificationParameters, SequenceProvider sequenceProvider, ProteinDetailsProvider proteinDetailsProvider, SpectrumProvider spectrumProvider, ModificationProvider modificationProvider, FastaSummary fastaSummary, String contactFirstName, String contactLastName, String contactAddress, String contactEmail, String contactOrganizationName, String contactOrganizationAddress, String contactOrganizationEmail, boolean peptideInference) throws FileNotFoundException, IOExceptionConstructor.- Parameters:
softwareName
- The name of the software used to write the mzIdentML file.softwareVersion
- The version of the software used to write the mzIdentML file.softwareUrl
- The URL of the software used to write the mzIdentML file.tempFolder
- The folder to use to write temporary files.destinationFile
- The mzIdentML file to write.spectrumFiles
- The spectrum files.searchEngineFile
- The search engine file used to identify the spectra.searchEngines
- Map of the search engine(s) and their version used to identify the spectra.fastaFile
- The fasta file containing the peptide/protein sequences.identificationParameters
- The identification parameters used to identify the spectra.sequenceProvider
- A sequence provider for the given fasta file.proteinDetailsProvider
- A protein details provider for the given fasta file.spectrumProvider
- A spectrum provider for the given spectrum file.modificationProvider
- A modification provider.fastaSummary
- A summary for the given fasta file.contactFirstName
- Contact first name.contactLastName
- Contact last name.contactAddress
- Contact address.contactEmail
- Contact email.contactOrganizationName
- Contact organization name.contactOrganizationAddress
- Contact organization address.contactOrganizationEmail
- Contact organization email.peptideInference
- Boolean indicating whether peptide inference was performed, in which case matching keys will be used for the peptides.- Throws:
FileNotFoundException
- Exception thrown if a file is not found.IOException
- Exception thrown if an error occurred while reading or writing a file.
-
-
Method Details
-
init
public void init(String contactFirstName, String contactLastName, String contactAddress, String contactEmail, String contactOrganizationName, String contactOrganizationAddress, String contactOrganizationEmail)Initializes the writing of the file. Writes up to the peptide section. Note: Protein details are written in a separate thread.- Parameters:
contactFirstName
- Contact first name.contactLastName
- Contact last name.contactAddress
- Contact address.contactEmail
- Contact email.contactOrganizationName
- Contact organization name.contactOrganizationAddress
- Contact organization address.contactOrganizationEmail
- Contact organization email.
-
finalizeFile
public void finalizeFile()Finalizes the writing of the mzIdentML file. -
addSpectrum
public void addSpectrum(String spectrumFile, String spectrumTitle, ArrayList<PeptideAssumption> peptideAssumptions, ArrayList<TreeMap<Double,HashMap<Integer,Double>>> modificationLocalizationScores, PeptideSpectrumAnnotator peptideSpectrumAnnotator)Adds a peptide-spectrum match to the file.- Parameters:
spectrumFile
- The spectrum file.spectrumTitle
- The spectrum title.peptideAssumptions
- The peptide assumptions for this spectrum.modificationLocalizationScores
- The modification localization scores for the given peptide assumptions.peptideSpectrumAnnotator
- The annotator to use for the spectra.
-
getPeptideEvidenceKey
Returns the peptide evidence key as string for the given peptide attributes.- Parameters:
accession
- the protein accessionpeptideStart
- the index of the peptide on the protein sequencepeptideKey
- the peptide match key- Returns:
- the peptide evidence key as string for the given peptide attributes
-
getModificationName
Returns the name of the modification corresponding to he given modification mass at the given site on the given peptide. Note: modification masses are matched by exact mass as reported by the modification localization scorer, no tolerance is used.- Parameters:
modMass
- The modifification mass.peptide
- The peptide.modSite
- The modification site.- Returns:
- The name of the modification.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-