Class 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
    • 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).
        Parameters:
        sample - SHOULD NOT be null.
        metadata - a Metadata object.
        Returns:
        a Sample object.
      • addSampleCustom

        public Sample addSampleCustom​(Metadata metadata,
                                      Integer id,
                                      Parameter custom)
        Add a sample[id]-custom into sample. Add a custom parameter for sample.
        Parameters:
        id - SHOULD be positive integer.
        custom - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a Sample object.
      • 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 - a Metadata object.
        Returns:
        a SampleProcessing object.
      • addSoftware

        public Software addSoftware​(Metadata metadata,
                                    Software software)
        Add a software to metadata, which used to analyze the data and obtain the reported results.
        Parameters:
        software - SHOULD NOT be null
        metadata - a Metadata object.
        Returns:
        a Software object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        param - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a Software object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        setting - if empty ignore operation.
        metadata - a Metadata object.
        Returns:
        a Software object.
      • 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 - a Metadata object.
        Returns:
        a Publication object.
      • 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 - a Metadata object.
        Returns:
        a Publication object.
      • 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).
        Parameters:
        id - SHOULD be positive integer.
        name - SHOULD NOT set empty.
        metadata - a Metadata object.
        Returns:
        a Contact object.
      • 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.
        Parameters:
        msRun - SHOULD NOT be null.
        metadata - a Metadata object.
        Returns:
        a MsRun object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        format - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a MsRun object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        location - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a MsRun object.
      • addMsRunInstrumentRef

        public MsRun addMsRunInstrumentRef​(Metadata metadata,
                                           Integer id,
                                           Instrument instrument)
        Add ms_run[id]-instrument_ref into metadata. Reference to a commonly used instrument.
        Parameters:
        metadata - a Metadata object.
        id - SHOULD be positive integer.
        instrument - if null ignore operation.
        Returns:
        a MsRun object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        idFormat - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a MsRun object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        fragmentationMethod - if null ignore operation.
        metadata - a Metadata object.
        Returns:
        a MsRun object.
      • 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.
        Parameters:
        assay - SHOULD NOT be null.
        metadata - a Metadata object.
        Returns:
        a Assay object.
      • 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.
        Parameters:
        metadata - a Metadata object.
        id - SHOULD NOT be null.
        param - the parameter.
        Returns:
        a Assay object.
      • 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.
        Parameters:
        metadata - a Metadata object.
        id - the id of the assay element.
        location - SHOULD NOT be null.
        Returns:
        a Assay object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        sample - SHOULD NOT be null, and SHOULD be defined in metadata first.
        metadata - a Metadata object.
        Returns:
        a Assay object.
      • 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.
        Parameters:
        id - SHOULD be positive integer.
        msRun - SHOULD NOT be null, and SHOULD be defined in metadata first.
        metadata - a Metadata object.
        Returns:
        a Assay object.
      • 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 - a Metadata object.
        Returns:
        a StudyVariable object.
      • 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 - a Metadata object.
        Returns:
        a StudyVariable object.
      • 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 - a Metadata object.
        id - id SHOULD be positive integer.
        checkParameter - the study variable factor Parameter to add.
        Returns:
        a StudyVariable object.
      • 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.
        Parameters:
        cv - SHOULD NOT be null.
        metadata - a Metadata object.
        Returns:
        a CV object.
      • 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
        Parameters:
        id - SHOULD be positive integer.
        metadata - a Metadata object.
        label - a String object.
        Returns:
        a CV object.
      • 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
        Parameters:
        id - SHOULD be positive integer.
        metadata - a Metadata object.
        fullName - a String object.
        Returns:
        a CV object.
      • 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
        Parameters:
        id - SHOULD be positive integer.
        metadata - a Metadata object.
        version - a String object.
        Returns:
        a CV object.
      • 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
        Parameters:
        id - SHOULD be positive integer.
        metadata - a Metadata object.
        uri - a String object.
        Returns:
        a CV object.
      • 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 - a Metadata object.
        columnName - SHOULD NOT be null
        param - 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 - a Metadata object.
        columnName - SHOULD NOT be null
        param - 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 - a Metadata object.
        columnName - SHOULD NOT be null
        param - SHOULD NOT be null
      • getColUnitMap

        public Map<String,​StringgetColUnitMap()
        Defines a method to access the colUnit to help in the transformation from columnName String -> to columnName MZTabColumn
        Returns:
        a Map object.