Question: Error in some hog codes using pyham
0
gravatar for Biojl
4 days ago by
Biojl1.6k
Barcelona
Biojl1.6k wrote:

Hi, I am having trobules with the pyham library to access OMA database from python.

#Python3
from omadb import Client
c = Client()
prot_id = 'PADI1_HUMAN'
r = c.proteins[prot_id]  # Can also be called as c.proteins.info(prot_id)

import pyham
# Initialise pyHam with a phyloxml tree and orthoXML HOGs
phyloxml_path = "simpleEx.phyloxml"
orthoxml_path3 = "simpleEx.orthoxml"

pyham_analysis = pyham.Ham(phyloxml_path, orthoxml_path3, use_internal_name=True, tree_format='phyloxml')

# Get the hog of interest
hog = pyham_analysis.get_hog_by_id(r['oma_hog_id'])

Using the above code I obtain a

KeyError: ' Id HOG:0374330 cannot match any HOG Id.'

I have tried other proteins with the same problem. I have browsed the website and the HOG ID is apparently correct. The HOG code in the Treeprofile example seems to work:

a='HOG:0355161'
hog = pyham_analysis.get_hog_by_id(a)

Not sure what is happening or where is my mistake.

oma • 78 views
ADD COMMENTlink modified 3 days ago by clement.train10 • written 4 days ago by Biojl1.6k

this is the best name for a package in the history of bioinformatics!

ADD REPLYlink written 3 days ago by Martombo2.4k
1
gravatar for clement.train
3 days ago by
clement.train10 wrote:

Hi Biojl,

If you want to load a single HOG from the public OMA database please consider using the following code:

my_gene_query = 'P53_RAT'
pyham_analysis = pyham.Ham(query_database=my_gene_query, use_data_from='oma')

This will automatically fetch all required data from OMA to launch a pyHam session with your HOG of interest. You can find a bit more in the documentation regarding the 'remote load' here

I hope this is answering your question,

Clement

ADD COMMENTlink written 3 days ago by clement.train10

I am able to generate the pyham_analysis object but one of the things I want to do is generate a TreeProfile for a specific HOG as explained here. https://zoo.cs.ucl.ac.uk/tutorials/tutorial_pyHam_get_started.html#genomedef

It requires hog_of_interest = ham_analysis.get_hog_by_id(HOG_ID), there is where the package fails.

The other error I get is this one (if I start from ham_analysis):

>>> treeprofile = ham_analysis.create_tree_profile(outfile="treeprofile_example.html")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jl/.local/lib/python3.6/site-packages/pyham/ham.py", line 404, in create_tree_profile
    tp = TreeProfile(self, hog=hog)
  File "/home/jl/.local/lib/python3.6/site-packages/pyham/TreeProfile.py", line 34, in __init__
    self.treemap = self.compute_tree_profile_full()
  File "/home/jl/.local/lib/python3.6/site-packages/pyham/TreeProfile.py", line 168, in compute_tree_profile_full
    node_genome = self.ham.get_ancestral_genome_by_namenode.name)
  File "/home/jl/.local/lib/python3.6/site-packages/pyham/ham.py", line 638, in get_ancestral_genome_by_name
    raise KeyError('No ancestral genomes match the query name: {}'.format(name))
KeyError: 'No ancestral genomes match the query name: LUCA'
ADD REPLYlink modified 2 days ago • written 2 days ago by Biojl1.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 539 users visited in the last hour