jorvis / biocode

Bioinformatics code libraries and scripts
MIT License
500 stars 248 forks source link

NameError: name 'utils' is not defined #53

Closed arsilan324 closed 6 years ago

arsilan324 commented 6 years ago

I am trying to run convert_gff3_to_ncbi_tbl.py script but getting this error.


ubt80:EMBLmyGFF3 arslan$ python3 convert_gff3_to_ncbi_tbl.py -i juncus.fasta.transdecoder.refined.gff3 -o arslan.tbl -ln TEST -nap JE -gf juncus-rp.fasta
INFO: splitting mRNA off gene Transcript_138016|g.186294
Traceback (most recent call last):
  File "convert_gff3_to_ncbi_tbl.py", line 89, in <module>
    main()
  File "convert_gff3_to_ncbi_tbl.py", line 82, in main
    tbl.print_tbl_from_assemblies(assemblies=assemblies, ofh=ofh, go_obo=args.go_obo, lab_name=args.lab_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/biocode/tbl.py", line 86, in print_tbl_from_assemblies
    print_biogene(gene=new_gene, fh=ofh, obo_dict=go_idx, lab_name=lab_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/biocode/tbl.py", line 117, in print_biogene
    gene_coords = utils.interbase0_to_humancoords(gene_loc.fmin, gene_loc.fmax, gene_loc.strand)
NameError: name 'utils' is not defined

Can you please comment how can I fix it? Thanks

jorvis commented 6 years ago

I'm a little confused by that. Your command line shows you invoking Perl to run the script, but then the stack trace is python. I'm assuming that is a mis-paste.

I'm not at a spot at the moment where I can edit and test this. If you open the tbl.py module there and replace each instance of " utils." with " biocode.utils." does this fix the problem?

arsilan324 commented 6 years ago

I am sorry it was typo. I should have written python3 instead of perl; (fixed now) in the code above. The code is here https://github.com/jorvis/biocode/blob/master/gff/convert_gff3_to_ncbi_tbl.py

Even replacing utils with biocode.utils in the code doesn't work. Instead it says NameError: name 'biocode' is not defined

jorvis commented 6 years ago

Would you mind making your input file available somewhere? Or you could email it to me at Gmail with this user name.

On Feb 9, 2018 5:57 PM, "arsilan324" notifications@github.com wrote:

I am sorry it was typo. I should have written python3 instead of perl; (fixed now) in the code above. The code is here https://github.com/jorvis/biocode/blob/master/gff/ convert_gff3_to_ncbi_tbl.py

Even replacing utils with utils with biocode.utils in the code doesn't work. Instead it says NameError: name 'biocode' is not defined

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jorvis/biocode/issues/53#issuecomment-364603301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUMkw9Eu3v5djWRaXaSPl9l4VNKaVf7ks5tTNtlgaJpZM4SAmQY .

arsilan324 commented 6 years ago

I just wrote you email with the dropbox links..

bernt-matthias commented 6 years ago

as a follow up: replacing "utils." with " biocode.utils." does this fix the problem

jorvis commented 6 years ago

Thanks for the report. Corrected in commit 3e095dd

eloguh commented 2 years ago

I have the same problem, i can't resolve it, NameError: name 'biocode' is not defined

jorvis commented 2 years ago

@eloguh Did you happen to see if your script has the changes from the commit linked above? If not, maybe you still have the older script version. There are 4 lines of code that were corrected.

eloguh commented 2 years ago

what i did was correct the import

El mié., 2 feb. 2022 21:05, Joshua Orvis @.***> escribió:

@eloguh https://github.com/eloguh Did you happen to see if your script has the changes from the commit linked above? If not, maybe you still have the older script version. There are 4 lines of code that were corrected.

— Reply to this email directly, view it on GitHub https://github.com/jorvis/biocode/issues/53#issuecomment-1028312146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXK3BFI63MN4BREFIVF5YPDUZGFBVANCNFSM4EQCMQMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

jorvis commented 2 years ago

If you're not using a GitHub checkout then you should probably replace your tbl file with this one:

https://raw.githubusercontent.com/jorvis/biocode/3e095dd233dcf3353654f3958b6117a6f2d3ea44/lib/biocode/tbl.py

That's a critical part which uses the module name as needed.

eloguh commented 2 years ago

thanks

El mié., 2 feb. 2022 22:08, Joshua Orvis @.***> escribió:

If you're not using a GitHub checkout then you should probably replace your tbl file with this one:

https://raw.githubusercontent.com/jorvis/biocode/3e095dd233dcf3353654f3958b6117a6f2d3ea44/lib/biocode/tbl.py

That's a critical part which uses the module name as needed.

— Reply to this email directly, view it on GitHub https://github.com/jorvis/biocode/issues/53#issuecomment-1028359737, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXK3BFLB7PC3BMDSWFCCWRTUZGMOTANCNFSM4EQCMQMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

jorvis commented 2 years ago

I'm surprised you're seeing this if you're using an updated version of biocode, as I've made a release since this bugfix was added.

eloguh commented 2 years ago

I still do not control much the general operation of the upload of codes

El mié., 2 feb. 2022 22:39, Joshua Orvis @.***> escribió:

I'm surprised you're seeing this if you're using an updated version of biocode, as I've made a release since this bugfix was added.

— Reply to this email directly, view it on GitHub https://github.com/jorvis/biocode/issues/53#issuecomment-1028382894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXK3BFP3XVT2IWFDAA6PEMTUZGQCVANCNFSM4EQCMQMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>