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

Remember objects created in previous blocks? #12

Open
endrebak opened this issue May 16, 2018 · 2 comments
Open

Remember objects created in previous blocks? #12

endrebak opened this issue May 16, 2018 · 2 comments

Comments

@endrebak
Copy link
Contributor

First off, thanks for maintaining this package. Wonderful work!

I have docs that have code example interspersed with text. It might look like this:

Subsetting Ranges
=================

There are many ways to subset a PyRanges object. Each returns a new PyRanges object and does not change the old one.

.. runblock:: pycon
   >>> import pandas as pd
   >>> import pyranges as pr

   >>> gr = pr.load_dataset("chipseq")


Chromosome only
~~~~~~~~~~~~~~~

.. runblock:: pycon
   >>> import pandas as pd # ignore
   >>> import pyranges as pr # ignore

   >>> gr = pr.load_dataset("chipseq") # ignore

   >>> gr["chrX"]

Is there a way to let me reuse the object gr in the second pycon block? I can use the #ignore hack, but it would be nice to be able to avoid it.

@WhyNotHugo
Copy link
Owner

I'm not entirely sure how to implement this yet, but it sounds like a useful feature. I'd definitely accept a PR for this. 😛

I'll try to look into it soon, but I can't commit to anything for now.

@inkychris
Copy link

Only just came across this extension but from a stackoverflow question that then points to a now old fork which claims to do this.

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