from ontobio.ontol_factory import OntologyFactory
ofactory = OntologyFactory()
ont = ofactory.create("pato") ## Connect remotely to PATO over SPARQL
##
## Note: Jupyter may show '*' to indicate kernel busy while this is being
## fetched - should only take a few seconds. Wait before proceeding
h:pato g:
cls = ont.node('PATO:0001374')
cls
{'label': 'ploidy'}
ancs = ont.descendants('PATO:0001374')
ancs
{'PATO:0001375', 'PATO:0001376', 'PATO:0001377', 'PATO:0001378', 'PATO:0001379', 'PATO:0001380', 'PATO:0001381', 'PATO:0001382', 'PATO:0001383', 'PATO:0001384', 'PATO:0001385', 'PATO:0001386', 'PATO:0001387', 'PATO:0001388', 'PATO:0001389', 'PATO:0001390', 'PATO:0001391', 'PATO:0001392', 'PATO:0001393', 'PATO:0001394', 'PATO:0001395'}
["{} '{}'".format(x, ont.label(x)) for x in ont.descendants('PATO:0001374')]
["PATO:0001376 'monoploid'", "PATO:0001380 'paleopolyploid'", "PATO:0001379 'allopolyploidy'", "PATO:0001377 'polyploid'", "PATO:0001390 'partial trisomy'", "PATO:0001375 'haploid'", "PATO:0001392 'endopolyploid'", "PATO:0001385 'aneuploid'", "PATO:0001395 'haplodiploid'", "PATO:0001382 'tetraploid'", "PATO:0001378 'autopolyploid'", "PATO:0001394 'diploid'", "PATO:0001383 'pentaploid'", "PATO:0001393 'euploid'", "PATO:0001391 'mosaic trisomy'", "PATO:0001386 'monosomy'", "PATO:0001389 'trisomy'", "PATO:0001387 'disomy'", "PATO:0001388 'uniparental disomy'", "PATO:0001381 'triploid'", "PATO:0001384 'hexaploid'"]
ont.subsets() ## Issues remote call; Jupyter may show '*' for ~1s
['http://purl.obolibrary.org/obo/pato#abnormal_slim', 'http://purl.obolibrary.org/obo/pato#absent_slim', 'http://purl.obolibrary.org/obo/pato#attribute_slim', 'http://purl.obolibrary.org/obo/pato#cell_quality', 'http://purl.obolibrary.org/obo/pato#disposition_slim', 'http://purl.obolibrary.org/obo/pato#hpo_slim', 'http://purl.obolibrary.org/obo/pato#mpath_slim', 'http://purl.obolibrary.org/obo/pato#relational_slim', 'http://purl.obolibrary.org/obo/pato#scalar_slim', 'http://purl.obolibrary.org/obo/pato#value_slim']
slim = ont.extract_subset('absent_slim') ## Issues remote call; Jupyter may show '*' for ~1s
["{} '{}'".format(x, ont.label(x)) for x in slim]
["PATO:0000462 'absent'", "PATO:0000467 'present'", "PATO:0015001 'absence due to degeneration'"]