Class CvMappingValidator

  • All Implemented Interfaces:
    de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>

    public class CvMappingValidator
    extends Object
    implements de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>
    Validator implementation that uses a provided xml mapping file with rules for required, recommended and optional CV parameters to assert that an mzTab follows these rules. First, all preValidators are run, then, the cv parameter validation is executed, before finally, the postValidators are run. Each validator can add validation messages to the output.
    Author:
    nilshoffmann
    • Constructor Detail

      • CvMappingValidator

        public CvMappingValidator()
    • Method Detail

      • of

        public static CvMappingValidator of​(File mappingFile,
                                            boolean errorIfTermNotInRule)
                                     throws JAXBException
        Create a new instance of CvMappingValidator. Uses a default instance of the CvParameterLookupService.
        Parameters:
        mappingFile - the mapping file to use
        errorIfTermNotInRule - raise an error if a term is not defined within an otherwise matching rule for the element
        Returns:
        a new CvMappingValidator instance
        Throws:
        JAXBException - if errors occur during unmarshalling of the mapping xml file.
      • of

        public static CvMappingValidator of​(File mappingFile,
                                            CvParameterLookupService client,
                                            boolean errorIfTermNotInRule)
                                     throws JAXBException
        Create a new instance of CvMappingValidator. Uses the provided CvParameterLookupService.
        Parameters:
        mappingFile - the mapping file to use
        client - the ontology lookup service client
        errorIfTermNotInRule - raise an error if a term is not defined within an otherwise matching rule for the element
        Returns:
        a new CvMappingValidator instance
        Throws:
        JAXBException - if errors occur during unmarshalling of the mapping xml file.
      • withPreValidator

        public CvMappingValidator withPreValidator​(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> preValidator)
        Add the provided validator implementation to the list of validators that run first.
        Parameters:
        preValidator - the validator
        Returns:
        an instance of this object
      • withPostValidator

        public CvMappingValidator withPostValidator​(de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab> postValidator)
        Add the provided validator implementation to the list of validators that run last.
        Parameters:
        postValidator - the validator
        Returns:
        an instance of this object
      • of

        public static CvMappingValidator of​(URL mappingFile,
                                            boolean errorIfTermNotInRule)
                                     throws JAXBException
        Create a new instance of CvMappingValidator. Uses a default instance of the CvParameterLookupService.
        Parameters:
        mappingFile - the mapping file URL to use
        errorIfTermNotInRule - raise an error if a term is not defined within an otherwise matching rule for the element
        Returns:
        a new CvMappingValidator instance
        Throws:
        JAXBException - if errors occur during unmarshalling of the mapping xml file.
      • of

        public static CvMappingValidator of​(URL mappingFile,
                                            CvParameterLookupService client,
                                            boolean errorIfTermNotInRule)
                                     throws JAXBException
        Create a new instance of CvMappingValidator. Uses the provided CvParameterLookupService.
        Parameters:
        mappingFile - the mapping file URL to use
        client - the ontology lookup service client
        errorIfTermNotInRule - raise an error if a term is not defined within an otherwise matching rule for the element
        Returns:
        a new CvMappingValidator instance
        Throws:
        JAXBException - if errors occur during unmarshalling of the mapping xml file.
      • of

        public static CvMappingValidator of​(info.psidev.cvmapping.CvMapping mapping,
                                            CvParameterLookupService client,
                                            boolean errorIfTermNotInRule)
        Create a new instance of CvMappingValidator. Uses the provided CvParameterLookupService.
        Parameters:
        mapping - the cv mapping to use
        client - the ontology lookup service client
        errorIfTermNotInRule - raise an error if a term is not defined within an otherwise matching rule for the element
        Returns:
        a new CvMappingValidator instance
      • validate

        public List<de.isas.mztab2.model.ValidationMessage> validate​(de.isas.mztab2.model.MzTab mzTab)
        Specified by:
        validate in interface de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>