How to use the pronto.TermList function in pronto

To help you get started, we’ve selected a few pronto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HUPO-PSI / mzQC / pylib / MZQC / SemanticCheck.py View on Github external
def validate(self, mzqc: MzQcFile):
        # Semantic validation of the JSON file.
        # Load the mzqc file specific ontologies
        cvs: Dict[str, TermList] = dict()
        for cv in mzqc.controlled_vocabularies:
            try:
                cvs[cv.ref] = Ontology(cv.uri, False) 
            except:
                SemanticError(f'Failed to load cv {cv.name} from {cv.uri}. Does {cv.ref} exist?')
        
        # For all cv terms involved:
        for cv_parameter in self._get_cv_parameters(mzqc):
            # Verify that cvRefs are valid.
            if cv_parameter.cvRef not in cvs.keys():
                raise SemanticError(f'Unknown CV reference <{cv_parameter.cv_ref}> in ' 
                                    f'element `{str(type(cv_parameter))}`')

            # Verify that the term exists in the CV.
            cv_term = cvs[cv_parameter.cvRef].get(cv_parameter.accession)
            if cv_term is None: