Questions tagged [pyranges]

Questions about the PyRanges library.

Questions about the PyRanges library (https://doi.org/10.1093/bioinformatics/btz615).

pyranges is a GenomicRanges implementation for Python built on top of pandas.

8 questions
3
votes
1 answer

Difference between overlap and intersect methods in Pyranges

Pyranges class from similarly named package has two methods with slightly different functionality: intersect and overlap. Intersect method description is quite similar to overlap's one: Return overlapping subintervals. vs Return overlapping…
AlexShein
  • 166
  • 1
  • 13
2
votes
1 answer

How to convert chromosome name to same format in pyranges before performing a join

I have multiple .bed files and I want to perform join, intersection etc. operation on them. I am using pyranges library to read the .bed files and perform these operations. As .bed files allows naming chromosome with or without "chr" prefix, I would…
srgothi92
  • 55
  • 4
2
votes
2 answers

pythonic equivalent to reduce() in R GRanges - how to collapse ranged data?

In R (albeit longwinded): Here is a test data.frame df <- data.frame( "CHR" = c(1,1,1,2,2), "START" = c(100, 200, 300, 100, 400), "STOP" = c(150,350,400,500,450) ) First I make GRanges object: gr <- GenomicRanges::GRanges( seqnames =…
mbyvcm
  • 141
  • 2
  • 12
1
vote
1 answer

Faster PyRanges Generation in Python

I have a list of starting coordinates all on the same chromosome for features of fixed size and I am trying to generate a PyRanges object. I timed the generation of the PyRanges object on a list of 125 coordinates and it took around 3.5ms. This…
Fabrizio
  • 1,138
  • 4
  • 18
  • 41
1
vote
1 answer

Using pyranges library, How to check if a chromosome position is contained in any interval?

I have a .vcf file containing variants information and a .bed file containing region studied information. I am using pyranges library to read the .bed file. I want to filter out all the variants in .vcf file that lies in the region studied intervals…
1
vote
2 answers

Finding overlaps between millions of ranges/intervals

I am trying to find pairs of intervals that overlap by at least some minimum overlap length that is set by the user. The intervals are from this pandas dataframe: import pandas as pds print(df1.head()) print(df1.tail()) query_id start_pos …
Michael
  • 13
  • 4
0
votes
0 answers

python PyRanges warning message when the intersection is empty

Dear python community, Im trying to figure out why im getting the following warning message when I try to find the intersection between two pyrange dataframes whenever the resulting intersection is empty: the code is the following: intersection =…
user3289556
  • 155
  • 2
  • 11
0
votes
1 answer

Pyranges gets indices if there are overlaps and NaN if not

I'm trying to use pyranges for some efficient implementation but it's very limited and inflexible compared to R GenomicRanges. Let's say if I have two Pyranges Tables: pr1 & pr2. I want to get the indices of the overlaping rows of pr1 in pr2 and, in…