waldronlab / MicrobiomeOntology

Other
1 stars 0 forks source link

Extract NCBI Taxon #1

Open kbeckenrode opened 4 years ago

kbeckenrode commented 4 years ago

Hi @wdduncan,

I want to describe only bacteria associated with the humans for this ontology. I have a mapping file containing 1,718 bacteria associated with human microbiome. How can I extract .OWL files with only these taxa from NCBITaxon Ontology?

cMD_metaphlan2ncbi.xlsx

Thanks!

kbeckenrode commented 4 years ago

Hi @lgeistlinger , maybe you can advise to my question above?

lgeistlinger commented 4 years ago

I'd start with obtaining the OBO file eg. here:

Then I would proceed with reading the OBO file using the ontologyIndex package into R:

The ontologyIndex also provides tools for subsetting an ontology (here to human microbes), and writing the ontology in OBO format out again, and also gives recommendations of how to convert between OBO and OWL format if you have applications that specifically require OWL format.

Just let me know if you experience trouble on the way here.

wdduncan commented 4 years ago

Sorry for my lack of biological knowledge, but can describe the structure of the file? What do the "k", "p", and "c" mean? On the ontology lookup service site, I can find Gammaproteobacteria, but not `cGammaproteobacteria`.

Gammaproteobacteria has a URI of http://purl.obolibrary.org/obo/NCBITaxon_1236. So, it looks like the 1236 part of the URI matches what is in your NCBI column.

You can use the R package (as described by @lgeistlinger) or a Python package, such as RDFLib.

If you download the OBO format you can you use one of Chris Mungall's OBO-scripts tools to extract the OBO blocks (such as obo-grep.pl) . See: https://github.com/cmungall/obo-scripts.

Finally, since you have the numeric part of the URIs, you can write a script to create a file of the full URIs (i.e., http://purl.obolibrary.org/obo/NCBITaxon_1+ numeric id) and use ROBOT (http://robot.obolibrary.org/extract) (http://robot.obolibrary.org/extract) or OntoFox (http://ontofox.hegroup.org/) to extract the NCBI classes.

Hope this helps.

kbeckenrode commented 4 years ago

@wdduncan This certainly does help. Thank you!

The structure of the file denotes the taxonomic hierarchy (p : phylum, c : class, k_ : kingdom). This is the data structure from the MetaPhlan (https://huttenhower.sph.harvard.edu/metaphlan), a metagenomic analysis tool used to extract these taxa.

Thank you for the help!