AttributeError In godag/gp_taks.py file
dinavod12 opened this issue · comments
In godag/gp_taks.py file when I am using this code
def get_id_to_parents(objs):
id_to_parents = {}
for obj in objs:
_get_id2parents(id_to_parents,obj.item_id,obj)
return {i:j for i,j in id_to_parents.items() if j}
get_id_to_parents(['GO:0048869'])
it providing me this error
AttributeError Traceback (most recent call last)
Input In [87], in <cell line: 1>()
----> 1 get_id_to_parents(['GO:0048869'])
Input In [86], in get_id_to_parents(objs)
2 id_to_parents = {}
3 for obj in objs:
----> 4 _get_id2parents(id_to_parents,obj.item_id,obj)
5 return {i:j for i,j in id_to_parents.items() if j}
AttributeError: 'str' object has no attribute 'item_id'
But when I am making the change instead of using this obj.item_id I am using go[obj].item_id ..It's working
Is this is correct????
The second usage seems correct.
As the error suggests, _get_id2parents
is expecting GO object, not GO id (which is a str
). Also, check a similar function in the same module get_id2parents
- that's also expecting GO object.
I had found all the go parents for the one go id ..these are the parents
{'GO:0008150': set(),
'GO:0065007': {'GO:0008150'},
'GO:0050789': {'GO:0008150', 'GO:0065007'},
'GO:0050794': {'GO:0008150', 'GO:0050789', 'GO:0065007'},
'GO:0051128': {'GO:0008150', 'GO:0050789', 'GO:0050794', 'GO:0065007'},
'GO:0050807': {'GO:0008150',
'GO:0050789',
'GO:0050794',
'GO:0051128',
'GO:0065007'}}
is there is any way to draw DAG graph for this in hierarchical structure..
The second usage seems correct.
As the error suggests,
_get_id2parents
is expecting GO object, not GO id (which is astr
). Also, check a similar function in the same moduleget_id2parents
- that's also expecting GO object.
oky ....