【发布时间】:2019-01-16 13:52:26
【问题描述】:
这来自一个名为 "VariantAnnotation" 的 R 库及其依赖项 "Biostrings"
我有一个 DNAstringsSetList,我想将其转换为普通列表或字符串向量。
library(VariantAnnotation)
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
vcf <- readVcf(fl, "hg19")
tempo <- rowRanges(vcf)$ALT # Here is the DNAstringsSetList I mean.
print(tempo)
A DNAStringSet instance of length 10376
width seq
[1] 1 G
[2] 1 T
[3] 1 A
[4] 1 T
[5] 1 T
... ... ...
[10372] 1 G
[10373] 1 G
[10374] 1 G
[10375] 1 A
[10376] 1 C
tempo[[1]]
A DNAStringSet instance of length 1
width seq
[1] 1 G
但我不想要这种格式。我只想要碱基字符串,以便将它们作为列插入新数据框中。我想要这个:
G
T
A
T
T
我用这个封装方法完成了这个:
as.character(tempo@unlistData)
但是,它返回的行数比 tempo 多 10 行!这个结果的头部和尾部和节奏是完全一样的,所以中间的某个地方有10个额外的不应该形成的行(不是NA)
【问题讨论】:
-
一个可重现的例子在这里会有所帮助!
-
那么你的问题是什么?我们当然需要查看重现错误的数据,以帮助您解决长度问题,如果这是您的问题
-
对不起,我将编辑问题以使其更清晰,也许可以重现。我的问题是:如何将 DNAstringsSetList 转换为普通列表或字符串向量?
标签: r bioinformatics vcf-variant-call-format