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

Non-absolute paths don't resolve #8

Closed
lassefolkersen opened this issue Nov 15, 2021 · 5 comments
Closed

Non-absolute paths don't resolve #8

lassefolkersen opened this issue Nov 15, 2021 · 5 comments

Comments

@lassefolkersen
Copy link

Hi! We're trying to implement this package in nf-core modules, and it's stumbling on paths not being able to resolve, unless absolute. So basically, one have to do \$(pwd)/$gtf instead of just e.g. ./$gtf. Makes it a little less clean to implement, any chance you could help with making the next version robust to this?

It seems that this place is (one of) the offending lines. I'm thinking one could put in the \$(pwd)/$gtf logic inside the repo here, to keep it clean in the nf-core implementation. Would also help with general portability of code. I'm thinking just adding os.path.abspath around the path calls would be enough:

ultra/uLTRA

Lines 63 to 64 in a6b6fb0

db = gffutils.create_db(fn, dbfn=database, force=True, keep_order=True, merge_strategy='merge',
sort_attribute_values=True)

@ksahlin
Copy link
Owner

ksahlin commented Nov 15, 2021

Hi @lassefolkersen

After looking into this, I think it would suffice to change within uLTRA lines 61-69 to

    elif not args.disable_infer:
        db = gffutils.create_db(args.gtf, dbfn=database, force=True, keep_order=True, merge_strategy='merge', 
                                sort_attribute_values=True)
        db = gffutils.FeatureDB(database, keep_order=True)
    else:
        db = gffutils.create_db(args.gtf, dbfn=database, force=True, keep_order=True, merge_strategy='merge', 
                                sort_attribute_values=True, disable_infer_genes=True, disable_infer_transcripts=True)

That is, removing the unnecessary line fn = gffutils.example_filename(args.gtf).

This would solve the issue of requiring an absolute path within the program and it doesn't require any change in the call to the program.

Would this be good?

@lassefolkersen
Copy link
Author

I think so - but the verdict really is if it can run the nf-core unit tests. Not whether I like it or not. I can help with running some tests if you'd like. (or just pull down the test-module yourself and maybe replace the containers line to something local where you have your changes in)

@ksahlin
Copy link
Owner

ksahlin commented Nov 16, 2021

I implemented the change proposed above and I uploaded it as a new version of uLTRA to PyPI (v0.0.4.1 https://pypi.org/project/ultra-bioinformatics/). Let me know if this resolves the issue.

@sguizard
Copy link

Tested and validated 👍
Thanks for the patch!
The bioconda recipe has been updated.
The nf-core update is in process.

@ksahlin
Copy link
Owner

ksahlin commented Nov 17, 2021

Super, thanks! I'll close this then.

@ksahlin ksahlin closed this as completed Nov 17, 2021
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