Questions tagged [iranges]

IRanges is a Bioconductor package: Infrastructure for manipulating intervals on sequences

The package provides efficient low-level and highly reusable S4 classes for storing ranges of integers, RLE vectors (Run-Length Encoding), and, more generally, data that can be organized sequentially (formally defined as Vector objects), as well as views on these Vector objects. Efficient list-like classes are also provided for storing big collections of instances of the basic classes. All classes in the package use consistent naming and share the same rich and consistent "Vector API" as much as possible.

Author: H. Pagès, P. Aboyoun and M. Lawrence Maintainer: Bioconductor Package Maintainer

Citation (from within R, enter citation("IRanges")):

Lawrence M, Huber W, Pagès H, Aboyoun P, Carlson M, Gentleman R, Morgan M and Carey V (2013). “Software for Computing and Annotating Genomic Ranges.” PLoS Computational Biology, 9.

42 questions
7
votes
1 answer

Efficiently construct GRanges/IRanges from Rle vector

I have a Run length encoded vector representing some value at every position on the genome, in order. As a toy example suppose I had just one chromosome of length 10, then I would have a vector looking…
5
votes
4 answers

Extend range in both directions

I have a GRanges object and I would like to extend all ranges eg 1kb on both sides, so each range will become 2kb longer. It is strange but I couldn't manage to do this using the inter-range-methods of GenomicRanges or IRanges. One way that would…
Ludo
  • 417
  • 5
  • 8
4
votes
1 answer

R: How do I reduce the ranges of genes into a single vector?

I created var_nt dataframe by subsetting tx_df columns based on row variant - "J3", "J10", "J11", "J13". Then, I converted the var_nt dataframe to a GRanges object (varnt_grange) using the makeGRangesFromDataFrame function. Now, I want to write a…
melolili
  • 1,237
  • 6
  • 16
4
votes
2 answers

Find all ranges outside of defined set of ranges

I am wondering what would be the best way to define all ranges which are not covered by given set of ranges. For example, if I have a set of genes with known coordinates: dtGenes <- fread( "id,start,end 1,1000,1300 2,1200,1500 3,1600,2600 …
Vasily A
  • 8,256
  • 10
  • 42
  • 76
3
votes
3 answers

Find closest non-overlapping ranges from start to end

I would like to find the closest ranges that do not overlap from the first start to the last end position. Any idea how to proceed? In the example below c(8, 33) and c(155, 161) should be filtered out because they overlap with the preceding…
Nivel
  • 629
  • 4
  • 12
3
votes
1 answer

Counting overlaps as expected with R data.table foverlaps() or IRanges

I'm having difficulty counting overlaps of intervals as I would expect. Here is an R data.table with intervals defined by start to end: > library(data.table) > dt1 = data.table(start=c(1, 5, 3), end=c(10, 15, 8)) > print(dt1) start end 1: 1 …
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234
2
votes
1 answer

Break region into smaller regions based on cutoff

This is I assume a somewhat simple programming issue, but I've been struggling with it. Mostly because I don't know the right words to use, perhaps? Given a set of "ranges" (in the form of 1-a set of numbers as below, 2-IRanges, or…
Gaius Augustus
  • 940
  • 2
  • 15
  • 37
2
votes
1 answer

Merge linear intervals

I have a data.frame which consists of linear intervals for each id: df <- data.frame(id = c(rep("a",3),rep("b",4),rep("d",4)), start = c(3,4,10,5,6,9,12,8,12,15,27), end = c(7,8,12,8,9,13,13,10,15,26,30)) I'm…
user1701545
  • 5,706
  • 14
  • 49
  • 80
2
votes
1 answer

Overlap between dual ranges compared to sampel of dual ranges

I have found other posts on generally finding overlapping ranges in R iRanges but could you help me with this extra little twist: i have two ranges that are linked (a possible genomic rearrangement with a start range and an end range) and i would…
1
vote
1 answer

grouping overlapping regions based on a clustering factor in R

Using the foverlaps function from the data.table package I get overlapping regions (it shows only 25 lines but it's more than 50 thousand) and I would like to group the overlapping regions for each id taking into account the following criteria: If…
darrinK
  • 35
  • 3
1
vote
1 answer

Can convert Granges to data.frame

I have follow data: # you can input data by run following script in Rstudio R_gui or R # this is a dput output # so you can run it for import data library(GenomicRanges) gr_test <- new("GRanges", seqnames = new("Rle", values = structure(1L, …
zhang
  • 185
  • 7
1
vote
1 answer

A fast way tp spread a linear range

I have a data.frame where each row is a linear interval - specifically these intervals are start and end coordinates on chromosomes (chr below): df <- data.frame(chr = c("chr1","chr2","chr2","chr3"), strand = c("+","+","-","-"), …
dan
  • 6,048
  • 10
  • 57
  • 125
1
vote
0 answers

Genomic Ranges - Merge Overlaps in Single File (R STUDIO)

I would like to find overlapped regions in the file and merge them keeping the earlier start and the later stop (merge 2 regions in 1) I meant to use Genomic Ranges but I am not sure how to code the script. This is what the file fileA.txt…
Kaitsja
  • 23
  • 3
1
vote
1 answer

Include list of IRanges as column in a data.frame

I have some data structured a bit like this: x01 <- c("94633X94644Y95423X96130", "124240X124494Y124571X124714", "135654X135660Y136226X136786") That I end up using later as an IRanges object through some steps that look like: x02 <- sapply(x01, …
Nick
  • 312
  • 1
  • 14
1
vote
1 answer

Find Islands in GenomicRanges

In GenomicRanges one interesting problem is the identification of gene islands. I am trying to find the largest subset of ranges in which neighboring ranges dont exceed a certain distance. To solve the issue I have tried to assign groups based on…
1
2 3