Class MZTabParserContext
- java.lang.Object
-
- uk.ac.ebi.pride.jmztab2.utils.parser.MZTabParserContext
-
public class MZTabParserContext extends Object
MZTabParserContext is used to keep track of indexed elements and interrelations during parsing.
- Since:
- 11/09/17
- Author:
- nilshoffmann
-
-
Constructor Summary
Constructors Constructor Description MZTabParserContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssayaddAssay(Metadata metadata, Assay assay)Add a assay into metadata.AssayaddAssayCustom(Metadata metadata, Integer id, Parameter param)Add a assay[id]-custom[i] into metadata.AssayaddAssayExternalUri(Metadata metadata, Integer id, URI location)Add a assay[id]-external_uri into metadata.AssayaddAssayMsRun(Metadata metadata, Integer id, MsRun msRun)Add assay[id]-ms_run_ref into metadata.AssayaddAssaySample(Metadata metadata, Integer id, Sample sample)Add assay[id]-sample_ref into metadata.ContactaddContact(Metadata metadata, Contact contact)Add a contact into metadata.ContactaddContactAffiliation(Metadata metadata, Integer id, String affiliation)Add contact[id]-affiliation.ContactaddContactEmail(Metadata metadata, Integer id, String email)Add contact[id]-emailContactaddContactName(Metadata metadata, Integer id, String name)Add contact[id]-name.CVaddCV(Metadata metadata, CV cv)Add a controlled vocabularies/ontologies into metadata.CVaddCVFullName(Metadata metadata, Integer id, String fullName)Add a cv[id]-full_name.CVaddCVLabel(Metadata metadata, Integer id, String label)Add a cv[id]-label.CVaddCVURI(Metadata metadata, Integer id, String uri)Add a cv[id]-uri.CVaddCVVersion(Metadata metadata, Integer id, String version)Add a cv[id]-version.DatabaseaddDatabase(Metadata metadata, Database database)addDatabase.DatabaseaddDatabasePrefix(Metadata metadata, Integer id, String valueLabel)addDatabasePrefix.DatabaseaddDatabaseUri(Metadata metadata, Integer id, URI checkURI)addDatabaseUri.DatabaseaddDatabaseVersion(Metadata metadata, Integer id, String version)addDatabaseVersion.InstrumentaddInstrument(Metadata metadata, Instrument instrument)Add a instrument[id] to metadata.InstrumentaddInstrumentAnalyzer(Metadata metadata, Integer id, Parameter analyzer)Add a parameter for instrument[id]-analyzer[i]InstrumentaddInstrumentDetector(Metadata metadata, Integer id, Parameter detector)Add a parameter for instrument[id]-detectorInstrumentaddInstrumentName(Metadata metadata, Integer id, Parameter name)Add a parameter for instrument[id]-nameInstrumentaddInstrumentSource(Metadata metadata, Integer id, Parameter source)Add a parameter for instrument[id]-sourceMsRunaddMsRun(Metadata metadata, MsRun msRun)Add a ms_run[id] into metadata.MsRunaddMsRunFormat(Metadata metadata, Integer id, Parameter format)Add ms_run[id]-format into metadata.MsRunaddMsRunFragmentationMethod(Metadata metadata, Integer id, Parameter fragmentationMethod)Add ms_run[id]-fragmentation_method into metadata.MsRunaddMsRunHash(Metadata metadata, Integer id, String hash)addMsRunHash.MsRunaddMsRunHashMethod(Metadata metadata, Integer id, Parameter hashMethod)addMsRunHashMethod.MsRunaddMsRunIdFormat(Metadata metadata, Integer id, Parameter idFormat)Add ms_run[id]-id_format into metadata.MsRunaddMsRunInstrumentRef(Metadata metadata, Integer id, Instrument instrument)Add ms_run[id]-instrument_ref into metadata.MsRunaddMsRunLocation(Metadata metadata, Integer id, URI location)Add ms_run[id]-location into metadata.MsRunaddMsRunScanPolarity(Metadata metadata, Integer id, Parameter scanPolarity)addMsRunScanPolarity.PublicationaddPublication(Metadata metadata, Publication publication)Add a publiction to metadata.PublicationaddPublicationItem(Metadata metadata, Integer id, PublicationItem.TypeEnum type, String accession)Add a publication item to metadata.PublicationaddPublicationItems(Metadata metadata, Integer id, Collection<PublicationItem> items)Add a couple of publication items into publication[id].SampleaddSample(Metadata metadata, Sample sample)Add a sample to metadata.SampleaddSampleCellType(Metadata metadata, Integer id, Parameter cellType)Add a sample[id]-cell_type into sample.SampleaddSampleCustom(Metadata metadata, Integer id, Parameter custom)Add a sample[id]-custom into sample.SampleaddSampleDescription(Metadata metadata, Integer id, String description)Add a sample[id]-description into sample.SampleaddSampleDisease(Metadata metadata, Integer id, Parameter disease)Add a sample[id]-disease into sample.SampleProcessingaddSampleProcessing(Metadata metadata, Integer id, List<Parameter> sampleProcessing)Add a sample_processing[id].SampleProcessingaddSampleProcessingParameter(Metadata metadata, Integer id, Parameter param)Add a processing parameter to sample_processing[id]SampleaddSampleSpecies(Metadata metadata, Integer id, Parameter species)Add a sample[id]-species into sample.SampleaddSampleTissue(Metadata metadata, Integer id, Parameter tissue)Add a sample[id]-tissue into sample.voidaddSmallMoleculeColUnit(Metadata metadata, String columnName, Parameter param)Defines the unit for the data reported in a column of the small molecule section.voidaddSmallMoleculeEvidenceColUnit(Metadata metadata, String columnName, Parameter param)Defines the unit for the data reported in a column of the small molecule section.voidaddSmallMoleculeFeatureColUnit(Metadata metadata, String columnName, Parameter param)Defines the unit for the data reported in a column of the small molecule section.SoftwareaddSoftware(Metadata metadata, Software software)Add a software to metadata, which used to analyze the data and obtain the reported results.SoftwareaddSoftwareParameter(Metadata metadata, Integer id, Parameter param)Add a software[id] parameter.SoftwareaddSoftwareSetting(Metadata metadata, Integer id, String setting)Add a software[id]-setting.StudyVariableaddStudyVariable(Metadata metadata, StudyVariable studyVariable)Add a study variable into metadata.StudyVariableaddStudyVariableAssay(Metadata metadata, Integer id, Assay assay)Add a study_variable[id]-assay_refs.StudyVariableaddStudyVariableAverageFunction(Metadata metadata, Integer id, Parameter checkParameter)Add a study_variable[id]-average_function.StudyVariableaddStudyVariableDescription(Metadata metadata, Integer id, String description)Add a study_variable[id]-description.StudyVariableaddStudyVariableFactors(Metadata metadata, Integer id, Parameter checkParameter)Add a study_variable[id]-factor.StudyVariableaddStudyVariableVariationFunction(Metadata metadata, Integer id, Parameter checkParameter)Add a study_variable[id]-variation_function.Map<String,String>getColUnitMap()Defines a method to access the colUnit to help in the transformation from columnName String -> to columnName MZTabColumn
-
-
-
Constructor Detail
-
MZTabParserContext
public MZTabParserContext()
-
-
Method Detail
-
addSample
public Sample addSample(Metadata metadata, Sample sample)
Add a sample to metadata. Samples are NOT MANDATORY in mzTab, since many software packages cannot determine what type of sample was analysed (e.g. whether biological or technical replication was performed).
-
addSampleSpecies
public Sample addSampleSpecies(Metadata metadata, Integer id, Parameter species)
Add a sample[id]-species into sample.
-
addSampleTissue
public Sample addSampleTissue(Metadata metadata, Integer id, Parameter tissue)
Add a sample[id]-tissue into sample.
-
addSampleCellType
public Sample addSampleCellType(Metadata metadata, Integer id, Parameter cellType)
Add a sample[id]-cell_type into sample.
-
addSampleDisease
public Sample addSampleDisease(Metadata metadata, Integer id, Parameter disease)
Add a sample[id]-disease into sample.
-
addSampleDescription
public Sample addSampleDescription(Metadata metadata, Integer id, String description)
Add a sample[id]-description into sample.
-
addSampleCustom
public Sample addSampleCustom(Metadata metadata, Integer id, Parameter custom)
Add a sample[id]-custom into sample. Add a custom parameter for sample.
-
addSampleProcessing
public SampleProcessing addSampleProcessing(Metadata metadata, Integer id, List<Parameter> sampleProcessing)
Add a sample_processing[id]. A list of parameters describing a sample processing step. The order of the data_processing items should reflect the order these processing steps were performed in. If multiple parameters are given for a step these MUST be separated by a "|".- Parameters:
id- SHOULD be positive integer.sampleProcessing- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
SampleProcessingobject.
-
addSampleProcessingParameter
public SampleProcessing addSampleProcessingParameter(Metadata metadata, Integer id, Parameter param)
Add a processing parameter to sample_processing[id]- Parameters:
id- SHOULD be positive integer.param- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
SampleProcessingobject.
-
addInstrument
public Instrument addInstrument(Metadata metadata, Instrument instrument)
Add a instrument[id] to metadata.- Parameters:
instrument- SHOULD NOT be null.metadata- aMetadataobject.- Returns:
- a
Instrumentobject.
-
addInstrumentName
public Instrument addInstrumentName(Metadata metadata, Integer id, Parameter name)
Add a parameter for instrument[id]-name- Parameters:
id- SHOULD be positive integer.name- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
Instrumentobject.
-
addInstrumentSource
public Instrument addInstrumentSource(Metadata metadata, Integer id, Parameter source)
Add a parameter for instrument[id]-source- Parameters:
id- SHOULD be positive integer.source- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
Instrumentobject.
-
addInstrumentAnalyzer
public Instrument addInstrumentAnalyzer(Metadata metadata, Integer id, Parameter analyzer)
Add a parameter for instrument[id]-analyzer[i]- Parameters:
id- SHOULD be positive integer.analyzer- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
Instrumentobject.
-
addInstrumentDetector
public Instrument addInstrumentDetector(Metadata metadata, Integer id, Parameter detector)
Add a parameter for instrument[id]-detector- Parameters:
id- SHOULD be positive integer.detector- if null ignore operation.metadata- aMetadataobject.- Returns:
- a
Instrumentobject.
-
addSoftware
public Software addSoftware(Metadata metadata, Software software)
Add a software to metadata, which used to analyze the data and obtain the reported results.
-
addSoftwareParameter
public Software addSoftwareParameter(Metadata metadata, Integer id, Parameter param)
Add a software[id] parameter. The parameter's value SHOULD contain the software's version. The order (numbering) should reflect the order in which the tools were used.
-
addSoftwareSetting
public Software addSoftwareSetting(Metadata metadata, Integer id, String setting)
Add a software[id]-setting. This field MAY occur multiple times for a single software. The value of this field is deliberately set as a String, since there currently do not exist cvParameters for every possible setting.
-
addPublication
public Publication addPublication(Metadata metadata, Publication publication)
Add a publiction to metadata. A publication associated with this file. Several publications can be given by indicating the number in the square brackets after "publication". PubMed ids must be prefixed by "pubmed:", DOIs by "doi:". Multiple identifiers MUST be separated by "|".- Parameters:
publication- SHOULD NOT be null.metadata- aMetadataobject.- Returns:
- a
Publicationobject.
-
addPublicationItem
public Publication addPublicationItem(Metadata metadata, Integer id, PublicationItem.TypeEnum type, String accession)
Add a publication item to metadata. PubMed ids must be prefixed by "pubmed:", DOIs by "doi:". Multiple identifiers MUST be separated by "|".- Parameters:
id- SHOULD be positive integer.type- SHOULD NOT be null.accession- SHOULD NOT set empty.metadata- aMetadataobject.- Returns:
- a
Publicationobject.
-
addPublicationItems
public Publication addPublicationItems(Metadata metadata, Integer id, Collection<PublicationItem> items)
Add a couple of publication items into publication[id]. Several publications can be given by indicating the number in the square brackets after "publication". PubMed ids must be prefixed by "pubmed:", DOIs by "doi:". Multiple identifiers MUST be separated by "|".- Parameters:
id- SHOULD be positive integer.items- SHOULD NOT be null.metadata- aMetadataobject.- Returns:
- a
Publicationobject.
-
addContact
public Contact addContact(Metadata metadata, Contact contact)
Add a contact into metadata.
-
addContactName
public Contact addContactName(Metadata metadata, Integer id, String name)
Add contact[id]-name. Several contacts can be given by indicating the number in the square brackets after "contact". A contact has to be supplied in the format [first name] [initials] [last name] (see example).
-
addContactAffiliation
public Contact addContactAffiliation(Metadata metadata, Integer id, String affiliation)
Add contact[id]-affiliation.
-
addContactEmail
public Contact addContactEmail(Metadata metadata, Integer id, String email)
Add contact[id]-email
-
addMsRun
public MsRun addMsRun(Metadata metadata, MsRun msRun)
Add a ms_run[id] into metadata. An MS run is effectively one run (or set of runs on pre-fractionated samples) on an MS instrument, and is referenced from assay in different contexts.
-
addMsRunFormat
public MsRun addMsRunFormat(Metadata metadata, Integer id, Parameter format)
Add ms_run[id]-format into metadata. A parameter specifying the data format of the external MS data file.
-
addMsRunLocation
public MsRun addMsRunLocation(Metadata metadata, Integer id, URI location)
Add ms_run[id]-location into metadata. Location of the external data file. If the actual location of the MS run is unknown, a "null" MUST be used as a place holder value.
-
addMsRunInstrumentRef
public MsRun addMsRunInstrumentRef(Metadata metadata, Integer id, Instrument instrument)
Add ms_run[id]-instrument_ref into metadata. Reference to a commonly used instrument.
-
addMsRunIdFormat
public MsRun addMsRunIdFormat(Metadata metadata, Integer id, Parameter idFormat)
Add ms_run[id]-id_format into metadata. Parameter specifying the id format used in the external data file.
-
addMsRunFragmentationMethod
public MsRun addMsRunFragmentationMethod(Metadata metadata, Integer id, Parameter fragmentationMethod)
Add ms_run[id]-fragmentation_method into metadata. A list of "|" separated parameters describing all the types of fragmentation used in a given ms run.
-
addMsRunHash
public MsRun addMsRunHash(Metadata metadata, Integer id, String hash)
addMsRunHash.
-
addMsRunHashMethod
public MsRun addMsRunHashMethod(Metadata metadata, Integer id, Parameter hashMethod)
addMsRunHashMethod.
-
addMsRunScanPolarity
public MsRun addMsRunScanPolarity(Metadata metadata, Integer id, Parameter scanPolarity)
addMsRunScanPolarity.
-
addAssay
public Assay addAssay(Metadata metadata, Assay assay)
Add a assay into metadata. The application of a measurement about the sample (in this case through MS) - producing values about small molecules, peptides or proteins. One assay is typically mapped to one MS run in the case of label-free MS analysis or multiple assays are mapped to one MS run for multiplexed techniques, along with a description of the label or tag applied.
-
addAssayCustom
public Assay addAssayCustom(Metadata metadata, Integer id, Parameter param)
Add a assay[id]-custom[i] into metadata. The application of a measurement about the sample (in this case through MS) - producing values about small molecules, peptides or proteins. One assay is typically mapped to one MS run in the case of label-free MS analysis or multiple assays are mapped to one MS run for multiplexed techniques, along with a description of the label or tag applied.
-
addAssayExternalUri
public Assay addAssayExternalUri(Metadata metadata, Integer id, URI location)
Add a assay[id]-external_uri into metadata. The application of a measurement about the sample (in this case through MS) - producing values about small molecules, peptides or proteins. One assay is typically mapped to one MS run in the case of label-free MS analysis or multiple assays are mapped to one MS run for multiplexed techniques, along with a description of the label or tag applied.
-
addAssaySample
public Assay addAssaySample(Metadata metadata, Integer id, Sample sample)
Add assay[id]-sample_ref into metadata. An association from a given assay to the sample analysed.
-
addAssayMsRun
public Assay addAssayMsRun(Metadata metadata, Integer id, MsRun msRun)
Add assay[id]-ms_run_ref into metadata. An association from a given assay to the source MS run.
-
addStudyVariable
public StudyVariable addStudyVariable(Metadata metadata, StudyVariable studyVariable)
Add a study variable into metadata. The variables about which the final results of a study are reported, which may have been derived following averaging across a group of replicate measurements (assays). In files where assays are reported, study variables have references to assays. The same concept has been defined by others as "experimental factor".- Parameters:
studyVariable- SHOULD NOT be null.metadata- aMetadataobject.- Returns:
- a
StudyVariableobject.
-
addStudyVariableAssay
public StudyVariable addStudyVariableAssay(Metadata metadata, Integer id, Assay assay)
Add a study_variable[id]-assay_refs. Comma-separated references to the IDs of assays grouped in the study variable.- Parameters:
id- SHOULD be positive integer.assay- SHOULD NOT be null, and should be defined in metadata first.metadata- aMetadataobject.- Returns:
- a
StudyVariableobject.
-
addStudyVariableDescription
public StudyVariable addStudyVariableDescription(Metadata metadata, Integer id, String description)
Add a study_variable[id]-description. A textual description of the study variable.- Parameters:
metadata- aMetadataobject.id- SHOULD be positive integer.description- if empty ignore operation.- Returns:
- a
StudyVariableobject.
-
addStudyVariableFactors
public StudyVariable addStudyVariableFactors(Metadata metadata, Integer id, Parameter checkParameter)
Add a study_variable[id]-factor. A Parameter further refining what is known about the study design.- Parameters:
metadata- aMetadataobject.id- id SHOULD be positive integer.checkParameter- the study variable factor Parameter to add.- Returns:
- a
StudyVariableobject.
-
addStudyVariableVariationFunction
public StudyVariable addStudyVariableVariationFunction(Metadata metadata, Integer id, Parameter checkParameter)
Add a study_variable[id]-variation_function. This is a Parameter detailing how the reported study variable abundances have been calculated.- Parameters:
metadata- aMetadataobject.id- SHOULD be positive integer.checkParameter- the parameter.- Returns:
- a
StudyVariableobject.
-
addStudyVariableAverageFunction
public StudyVariable addStudyVariableAverageFunction(Metadata metadata, Integer id, Parameter checkParameter)
Add a study_variable[id]-average_function. This is a Parameter detailing how the reported study variable abundances have been calculated.- Parameters:
metadata- aMetadataobject.id- SHOULD be positive integer.checkParameter- the parameter.- Returns:
- a
StudyVariableobject.
-
addCV
public CV addCV(Metadata metadata, CV cv)
Add a controlled vocabularies/ontologies into metadata. Define the controlled vocabularies/ontologies used in the mzTab file.
-
addCVLabel
public CV addCVLabel(Metadata metadata, Integer id, String label)
Add a cv[id]-label. A string describing the labels of the controlled vocabularies/ontologies used in the mzTab file
-
addCVFullName
public CV addCVFullName(Metadata metadata, Integer id, String fullName)
Add a cv[id]-full_name. A string describing the full names of the controlled vocabularies/ontologies used in the mzTab file
-
addCVVersion
public CV addCVVersion(Metadata metadata, Integer id, String version)
Add a cv[id]-version. A string describing the version of the controlled vocabularies/ontologies used in the mzTab file
-
addCVURI
public CV addCVURI(Metadata metadata, Integer id, String uri)
Add a cv[id]-uri. A string containing the URIs of the controlled vocabularies/ontologies used in the mzTab file
-
addSmallMoleculeColUnit
public void addSmallMoleculeColUnit(Metadata metadata, String columnName, Parameter param)
Defines the unit for the data reported in a column of the small molecule section. Defines the used unit for a column in the small molecule section. The format of the value has to be {column name}={Parameter defining the unit} This field MUST NOT be used to define a unit for quantification columns. The unit used for small molecule quantification values MUST be set in small_molecule-quantification_unit.- Parameters:
metadata- aMetadataobject.columnName- SHOULD NOT be nullparam- SHOULD NOT be null
-
addSmallMoleculeFeatureColUnit
public void addSmallMoleculeFeatureColUnit(Metadata metadata, String columnName, Parameter param)
Defines the unit for the data reported in a column of the small molecule section. Defines the used unit for a column in the small molecule section. The format of the value has to be {column name}={Parameter defining the unit} This field MUST NOT be used to define a unit for quantification columns. The unit used for small molecule quantification values MUST be set in small_molecule-quantification_unit.- Parameters:
metadata- aMetadataobject.columnName- SHOULD NOT be nullparam- SHOULD NOT be null
-
addSmallMoleculeEvidenceColUnit
public void addSmallMoleculeEvidenceColUnit(Metadata metadata, String columnName, Parameter param)
Defines the unit for the data reported in a column of the small molecule section. Defines the used unit for a column in the small molecule section. The format of the value has to be {column name}={Parameter defining the unit} This field MUST NOT be used to define a unit for quantification columns. The unit used for small molecule quantification values MUST be set in small_molecule-quantification_unit.- Parameters:
metadata- aMetadataobject.columnName- SHOULD NOT be nullparam- SHOULD NOT be null
-
getColUnitMap
public Map<String,String> getColUnitMap()
Defines a method to access the colUnit to help in the transformation from columnName String -> to columnName MZTabColumn- Returns:
- a
Mapobject.
-
addDatabase
public Database addDatabase(Metadata metadata, Database database)
addDatabase.
-
addDatabasePrefix
public Database addDatabasePrefix(Metadata metadata, Integer id, String valueLabel)
addDatabasePrefix.
-
addDatabaseVersion
public Database addDatabaseVersion(Metadata metadata, Integer id, String version)
addDatabaseVersion.
-
-