Comments (8)
I've been having issues like this as well. Rolling back to 0.0.127
seems to work for me to solve some issues.
from pyranges.
I'll look into it soon. Thanks!
from pyranges.
To give some more detail, I'm having issues when trying to use join
on two stranded PyRanges objects. I suspect something under the hood is causing this issue.
Pdb) bed1.head()
+--------------+-----------+-----------+--------------+----------------------+----------------------------+------------+-------+
| Chromosome | Start | End | Strand | Name | source | novelty | +3 |
| (category) | (int64) | (int64) | (category) | (object) | (object) | (object) | ... |
|--------------+-----------+-----------+--------------+----------------------+----------------------------+------------+-------|
| chr1 | 75945539 | 75945646 | + | ENCODEMG000099158_1 | lapa | Novel | ... |
| chr1 | 85973317 | 85973418 | + | ENCODEMG000101206_1 | lapa,polya_atlas | Novel | ... |
| chr1 | 166166458 | 166166560 | + | ENSMUSG00000000544_1 | vM25,vM21,lapa,polya_atlas | Known | ... |
| chr1 | 166154085 | 166154186 | + | ENSMUSG00000000544_2 | vM25,vM21,lapa,polya_atlas | Known | ... |
| chr1 | 166157478 | 166157579 | + | ENSMUSG00000000544_3 | vM25,vM21 | Known | ... |
| chr1 | 36528186 | 36528287 | + | ENSMUSG00000001138_1 | vM25,vM21,lapa,polya_atlas | Known | ... |
| chr1 | 36519523 | 36519624 | + | ENSMUSG00000001138_2 | vM25,vM21,lapa | Known | ... |
| chr1 | 36520384 | 36520485 | + | ENSMUSG00000001138_3 | vM25,vM21,lapa | Known | ... |
+--------------+-----------+-----------+--------------+----------------------+----------------------------+------------+-------+
Stranded PyRanges object has 8 rows and 10 columns from 1 chromosomes.
For printing, the PyRanges was sorted on Chromosome and Strand.
3 hidden columns: gene_id, tes, id
Pdb) bed2.head()
+--------------+-----------+-----------+--------------+----------------------+------------+--------------------+-----------+-------+
| Chromosome | Start | End | Strand | Name | source | gene_id | tes | +2 |
| (category) | (int64) | (int64) | (category) | (object) | (object) | (object) | (int64) | ... |
|--------------+-----------+-----------+--------------+----------------------+------------+--------------------+-----------+-------|
| chr1 | 36527164 | 36527265 | + | ENSMUSG00000001138_1 | s2 | ENSMUSG00000001138 | 1 | ... |
| chr1 | 36528186 | 36528287 | + | ENSMUSG00000001138_2 | s2 | ENSMUSG00000001138 | 2 | ... |
| chr1 | 39545328 | 39545429 | + | ENSMUSG00000003135_1 | s2 | ENSMUSG00000003135 | 1 | ... |
| chr1 | 39546822 | 39546933 | + | ENSMUSG00000003135_2 | s2 | ENSMUSG00000003135 | 2 | ... |
| chr1 | 172130960 | 172131061 | + | ENSMUSG00000003464_1 | s2 | ENSMUSG00000003464 | 1 | ... |
| chr1 | 172135229 | 172135333 | + | ENSMUSG00000003464_2 | s2 | ENSMUSG00000003464 | 2 | ... |
| chr1 | 172135725 | 172135826 | + | ENSMUSG00000003464_3 | s2 | ENSMUSG00000003464 | 3 | ... |
| chr1 | 172136439 | 172136540 | + | ENSMUSG00000003464_4 | s2 | ENSMUSG00000003464 | 4 | ... |
+--------------+-----------+-----------+--------------+----------------------+------------+--------------------+-----------+-------+
Stranded PyRanges object has 8 rows and 10 columns from 1 chromosomes.
For printing, the PyRanges was sorted on Chromosome and Strand.
2 hidden columns: novelty, id
PyRanges join
command:
temp_joined = bed1.join(bed2,
strandedness='same',
suffix='_new',
slack=slack,
how='left')
Error:
AssertionError: Can only do stranded operations when both PyRanges contain strand info
Hopefully this extra detail helps!
from pyranges.
Okay I've actually taken a look at what is actually going on here. Looks like when PyRanges objects are initialized, possibly from older PyRanges objects that were already read in, or from PyRanges objects that have been converted to pandas DataFrames and back, this condition is satisfied because the Strand
PyRanges column is by default given a Categorical dtype with categories '.', '+', and '-'
:
(From check_strandedness()
in methods/init.py
if str(df.Strand.dtype) == "category" and (set(df.Strand.cat.categories) - set("+-")):
contains_more_than_plus_minus_in_strand_col = True
I'm not going to try to submit a PR to change this because I want to make sure the bug can be addressed in a way that's consistent with how the rest of the package behaves, but I will probably just comment out the above code in my fork so that I can get on with my life. Hopefully this also helps!
from pyranges.
Thanks. I have Friday in two weeks off and will look at it then.
from pyranges.
Looking at it now :) Perhaps related to the fix for
from pyranges.
I am unable to reproduce. Can you show me a reproducible example? Perhaps by sharing the data you use? :D
from pyranges.
The reported issue might also be different from yours @fairliereese Would you mind creating a new issue and I'll have a look?
Btw: I started a hypothesis run that generated 10,000 example triplets of PyRanges and tried joining them in a chain with how="left"
and I did not get your reported error once.
from pyranges.
Related Issues (20)
- Additional how-to-pages HOT 1
- Stable non-conflicting interface: v.1.0.0 HOT 2
- Return overlap between PyRanges objects, keeping columns from both? HOT 6
- subtract does not respect strandedness default
- when using .coverage: AttributeError: module 'numpy' has no attribute 'long' HOT 1
- count_overlaps causes overflow errors when number of reads are large HOT 1
- ModuleNotFoundError: No module named 'pyfaidx' HOT 2
- count_overlaps documentation says it supports nb_cpu but it is not implemented HOT 4
- overlap default strandedness argument incorrectly documented
- pr.get_sequence may not be working? HOT 4
- PyRanges.intersect - "invert=True" kwarg behavior HOT 1
- pyranges.cluster() Exception: Starts/Ends not int64 or int32: int64 HOT 9
- PyRanges read_bed produces wrong number of chromosomes when cast to categorical HOT 1
- ResourceWarning: files opened in readers.read_bed are never closed HOT 3
- SyntaxError: invalid syntax for L131 in names.py HOT 12
- `join` method exits unexpectedly HOT 4
- `np.bool` error in gr.head()
- Add importable constants for Chromosome, Start, End, etc. HOT 2
- Can only do stranded operations when both PyRanges contain strand info HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyranges.