Entering edit mode
9 months ago
QX
▴
60
Hi all,
I have a Grange objects look like this:
GRanges object with 4598553 ranges and 2 metadata columns:
seqnames ranges strand | ref alt
<Rle> <IRanges> <Rle> | <character> <character>
1 chr1 51479 * | T A
2 chr1 51803 * | T C
3 chr1 52238 * | T G
4 chr1 54490 * | G A
5 chr1 54712 * | TTTTCTTTC T
and a bed files in Grange:
GRanges object with 57736 ranges and 1 metadata column:
seqnames ranges strand | gene_name
<Rle> <IRanges> <Rle> | <character>
[1] 1 11869-14412 * | DDX11L1
[2] 1 14363-29806 * | WASH7P
[3] 1 29554-31109 * | MIR1302-10
[4] 1 34554-36081 * | FAM138A
[5] 1 52473-54936 * | OR4G4P
... ... ... ... . ...
How can I merge two Grange objects so that I can know which SNP is belongs to which genes, for e.g: from this post
GRanges object with 4 ranges and 1 metadata column:
seqnames ranges strand | names
<Rle> <IRanges> <Rle> | <character>
[1] I 1-3 * | ENS001912
[2] I 6-8 * | <NA>
[3] I 11-13 * | ENS003901
[4] I 16-18 * | <NA>
Use
findOverlaps
but be sure that the chromosome identifiers are the same. Here you have 1, chr1 and I all three mixed.