How to use the pronto.Term 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
# Regarding metadata, verify that input files are consistent and unique.
        self._inputFileConsistency(mzqc.run_qualities)
        self._inputFileConsistency(mzqc.set_qualities)

        # For all metrics (which are basing on cv type)
        #run_and_set_quality_collection: List[BaseQuality] = list()
        #for run_or_set_quality in run_and_set_quality_collection:
        if "Proteomics Standards Initiative Quality Control Ontology" not in [cv.name for cv in cvs.values()]:
            raise SemanticError(f'Quality Control Ontology missing!')
        else:
            keys = [filter( lambda x: cvs[x].name == "Proteomics Standards Initiative Quality Control Ontology", cvs )]
            if len(keys) != 1:
                SemanticError('More than one QC CV.')
            else:    
                qc_ref = keys[0]
            metric_cvs: List[Term] = cvs[qc_ref]["QC:4000001"].rchildren()
            
        for run_or_set_quality in chain(mzqc.run_qualities,mzqc.set_qualities):
            # Verify that quality metrics are unique within a run/setQuality.
            accessions: Set[str] = set()
            for quality_metric in run_or_set_quality.quality_metrics:
                if quality_metric.accession not in accessions:
                    accessions.add(quality_metric.accession)
                else:
                    raise ValidationError(f'Duplicate quality metric: '
                                          f'accession = {quality_metric.accession}')

                # Verify that quality_metric actually is of metric type/relationship?
                cv_term = cvs[quality_metric.cvRef].get(quality_metric.accession)
                if cv_term is None or cv_term not in metric_cvs:
                    raise SemanticError(f'Non-metric CV used in metric context.')