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

Example failed #74

Closed
xapple opened this issue Feb 6, 2013 · 6 comments
Closed

Example failed #74

xapple opened this issue Feb 6, 2013 · 6 comments

Comments

@xapple
Copy link

xapple commented Feb 6, 2013

I ran these commands successfully in my Ubuntu shell:

$ sudo apt-get install bedtools
$ sudo easy_isntall pybedtools

And then these commands in ipython:

In [1]: import pybedtools
In [2]: a = pybedtools.example_bedtool('x.bam')
In [3]: a.genome_coverage()

NotImplementedError                       Traceback (most recent call last)
/home/sinclair/OD1/raw/<ipython-input-4-bfb19364e87a> in <module>()
----> 1 a.genome_coverage()

/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in decorated(self, *args, **kwargs)
    621             # this calls the actual method in the first place; *result* is

    622             # whatever you get back

--> 623             result = method(self, *args, **kwargs)
    624 
    625             # add appropriate tags


/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in not_implemented_func(*args, **kwargs)
    139         if not_implemented:
    140             def not_implemented_func(*args, **kwargs):
--> 141                 raise NotImplementedError(help_str)
    142             return not_implemented_func
    143 

NotImplementedError: "genomeCoverageBed" does not appear to be installed or on the path, so this method is disabled.  Please install a more recent version of BEDTools and re-import to use this method.

The program is in my $PATH:

$ which genomeCoverageBed
/usr/bin/genomeCoverageBed 
@daler
Copy link
Owner

daler commented Feb 6, 2013

Hmm. Are you able to run other tools, or is this specific to genome_coverage? For example, does this work:

   a.intersect(a)

@xapple
Copy link
Author

xapple commented Feb 6, 2013

Same for a.intersect(a)


NotImplementedError                       Traceback (most recent call last)
/home/sinclair/<ipython-input-4-bbdb221e5a4c> in <module>()
----> 1 a.intersect(a)

/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in decorated(self, *args, **kwargs)
    621             # this calls the actual method in the first place; *result* is

    622             # whatever you get back

--> 623             result = method(self, *args, **kwargs)
    624 
    625             # add appropriate tags


/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in not_implemented_func(*args, **kwargs)
    139         if not_implemented:
    140             def not_implemented_func(*args, **kwargs):
--> 141                 raise NotImplementedError(help_str)
    142             return not_implemented_func
    143 

NotImplementedError: "intersectBed" does not appear to be installed or on the path, so this method is disabled.  Please install a more recent version of BEDTools and re-import to use this method.

@daler
Copy link
Owner

daler commented Feb 6, 2013

Ah, it looks like the bedtools package you get through apt-get is an old version (2.14.3-1). Not sure who is maintaining that package, but there have been a lot of improvements and bug fixes since then. The calling syntax for BEDTools programs changed in 2.15, and pybedtools only supports the new version in part to prevent users from using out-of-date versions of BEDTools . . .

I would strongly suggest installing the latest version (see http://bedtools.readthedocs.org/en/latest/content/installation.html). After installing the latest (currently 2.17.0), do you still get this problem?

@xapple
Copy link
Author

xapple commented Feb 6, 2013

So it was indeed the version that was too old. However the error message did not suggest this at all. I would advise that if your library doesn't work with the current ubuntu distribution; you should check for it and instruct the user.

However, the example still doesn't work:

In [6]: a.genome_coverage()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/sinclair/OD1/raw/<ipython-input-6-bfb19364e87a> in <module>()
----> 1 a.genome_coverage()

/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in decorated(self, *args, **kwargs)
    621             # this calls the actual method in the first place; *result* is

    622             # whatever you get back

--> 623             result = method(self, *args, **kwargs)
    624 
    625             # add appropriate tags


/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in wrapped(self, *args, **kwargs)
    174                             check_for_genome = True
    175             if check_for_genome:
--> 176                 kwargs = self.check_genome(**kwargs)
    177 
    178             # Add the implicit values to kwargs.  If the current BedTool is


/usr/local/lib/python2.7/dist-packages/pybedtools-0.6.2-py2.7-linux-x86_64.egg/pybedtools/bedtool.pyc in check_genome(self, **kwargs)
   1176                 kwargs['g'] = self.chromsizes
   1177             else:
-> 1178                 raise ValueError('No genome specified. Use the "g" or '
   1179                                  '"genome" kwargs, or use the '
   1180                                  '.set_chromsizes() method')

If you use a BED file you need to specify a genome, but this is not the case for a BAM file. See http://bedtools.readthedocs.org/en/latest/content/tools/genomecov.html

@daler
Copy link
Owner

daler commented Feb 6, 2013

Thanks for pointing this out. As of 79dd4dc, I re-added support for older versions, including the 2.14.3 from Ubuntu repository. After thinking about this, I decided it's not nice for pybedtools to force a user into any particular BEDTools version, and I'm sure you're not the only one using the outdated Ubuntu package.

I also fixed genome_coverage (and associated tests) so that a genome is not required for BAM file input.

Can you confirm that this works?

@xapple
Copy link
Author

xapple commented Feb 7, 2013

Nice, it works like a charm now. There I was with my snarky comments about how your library didn't work on my first try and you fixed it in a day. Props to you !

@xapple xapple closed this as completed Feb 7, 2013
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

2 participants