Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract NCBI Taxon #1

Open
kbeckenrode opened this issue Jul 22, 2020 · 4 comments
Open

Extract NCBI Taxon #1

kbeckenrode opened this issue Jul 22, 2020 · 4 comments

Comments

@kbeckenrode
Copy link
Collaborator

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
Copy link
Collaborator Author

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

@lgeistlinger
Copy link

lgeistlinger commented Jul 23, 2020

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
Copy link
Collaborator

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 c__Gammaproteobacteria.

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
Copy link
Collaborator Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants