Subsetting a data by a regions from BED file
0
0
Entering edit mode
4.0 years ago
zizigolu ★ 4.3k

Hello

I have a big data like

> head(r@data)
   Tumor_Sample_Barcode Chromosome Start_Position End_Position Reference_Allele
1:    LP6005334-DNA_H01       chr1       89616151     89616151                -
2:    LP6005334-DNA_H01       chr6       51909815     51909815                A
3:    LP6005334-DNA_H01      chr16       20556547     20556547                -
4:    LP6005334-DNA_H01      chr17       66992092     66992092                -
5:    LP6005334-DNA_H01      chr20       13251339     13251339                -
6:    LP6005334-DNA_H01      chr20       35929770     35929771

> dim(r@data)
[1] 6461  141
>

I also have a bed file like

1   11866   12229
1   12610   12723
1   13218   14411
1   30363   30505
1   34551   35176

How I can subset my first data to this BED regions in R?

r BED • 834 views
ADD COMMENT
1
Entering edit mode

Search for "merge by range overlap", related SO post: https://stackoverflow.com/q/24480031/680068

And see my example answer here: A: Subsetting large list of SNPs with R

ADD REPLY
0
Entering edit mode

Thank you so much

I used your example answer without error

ADD REPLY

Login before adding your answer.

Traffic: 2406 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6