Question: How Do I Assign Names To Granges Without It Forcing Elementmetadata
0
Jeremy Leipzig ♦ 19k wrote:
It seems like the casting routine to assign names to GRanges from GappedAlignments is more natural than the GRanges constructor.
library("GenomicRanges")
feature1 <- GRanges(names="feature1",seqnames="chr1", IRanges(start=1, width=100), strand="*")
featureGA <- GappedAlignments(names="feature2", seqnames = Rle("chr1"), pos = as.integer(25),cigar = "100M", strand = strand("*"))
feature2<-as(feature2,"GRanges")
> feature1
GRanges with 1 range and 1 elementMetadata col:
seqnames ranges strand | names
<Rle> <IRanges> <Rle> | <character>
[1] chr1 [1, 100] * | feature1
---
seqlengths:
chr1
NA
> feature2
GRanges with 1 range and 0 elementMetadata cols:
seqnames ranges strand
<Rle> <IRanges> <Rle>
feature2 chr1 [25, 124] *
---
seqlengths:
chr1
NA
both<-GRangesList(features=feature1,feature2=feature2)
Error in .Method(..., deparse.level = deparse.level) :
number of columns for arg 2 do not match those of first arg
> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] GenomicRanges_1.8.4 IRanges_1.14.2 BiocGenerics_0.2.0
loaded via a namespace (and not attached):
[1] stats4_2.15.0 tools_2.15.0
ADD COMMENT
• link
•
modified 8.7 years ago
by
Steve Lianoglou ♦ 5.1k
•
written
8.7 years ago by
Jeremy Leipzig ♦ 19k