R: IRanges, extract seqnames values
I have an IRanges object SEQ:
rs60733400 1 [2516781, 2516781] * | <NA> G A
rs876938 1 [2523212, 2523212] * | <NA> G C
rs867435 1 [2523706, 2523706] * | <NA> C T
rs867436 1 [2523723, 2523723] * | <NA> C T
rs10752747 1 [2524915, 2524915] * | <NA> G T
... ... ... ... ... ... ... ...
rs137688 22 [39741091, 39741091] * | <NA> G A
rs137685 22 [39739628, 39739628] * | <NA> C T
rs62323904 X [58426952, 58426952] * | <NA> T G
rs72834512 X [79371195, 79371195] * | <NA> T C
rs3000483 Y [ 3631240, 3631240] * | <NA> T A,C
I want to extract for every rs... a corresponding seqname. In the end I want to have a vector with a seqname of the same length as names(SEQ).
I tried seqnames(SEQ) but it gives me a factor-Rle of length 2040 with 24 runs, but I have no idea how to extract "Values" parameter from there.
• 5,934 views
•
link
1 answer
Given a GRanges object names SEQ:
as.character(seqnames(SEQ))
Not so intuitive, I agree.
• 0 views
•
link
Log in to answer this question.