在 R 中使用 haploNet (pegas) 识别单倍型之间的突变
Identifying mutations between haplotypes using haploNet (pegas) in R
我认为这可能是一个简单的问题,但在阅读了 pegas 文档后我无法解决它。我想使用 FASTA 文件绘制单倍型网络,并确定哪些突变正在分离不同的单倍型。
示例:
fa <- read.FASTA("example.fa")
haps <- haplotype(fa)
haps50 <- subset(haps, minfreq = 50)
(network <- haploNet(haps50))
plot(network, size = attr(network, "freq"),show.mutation=1,labels=T)
如何识别突变在我的 FASTA 文件中的位置,例如单倍型 XX
与 V
?
附加问题:
是否也有可能知道例如其中一种单倍型的单倍型序列是什么?例如单倍型V
,这是相当频繁的?
pegas
包包含一个函数 diffHaplo
,它指定单倍型之间的差异。
diffHaplo(haps50, a = "XX", b = "V")
提取频繁单倍型V
的DNA序列,classhaplotype
对象中的索引将识别哪个DNA序列包含单倍型。
# haplotype index from its name
i <- which(attr(haps50, "dimnames")[[1]] == "V")
# index of the first sequence with the haplotype
s <- attr(haps50, "index")[[i]][1]
然后可以在比对中识别相应的序列 fa
以保存或打印在屏幕上。
write.dna(fa[s], file = "hapV.fas", format = "fasta", nbcol = -1, colsep = "")
paste(unlist(as.character(fa[s])), collapse = "")
我认为这可能是一个简单的问题,但在阅读了 pegas 文档后我无法解决它。我想使用 FASTA 文件绘制单倍型网络,并确定哪些突变正在分离不同的单倍型。
示例:
fa <- read.FASTA("example.fa")
haps <- haplotype(fa)
haps50 <- subset(haps, minfreq = 50)
(network <- haploNet(haps50))
plot(network, size = attr(network, "freq"),show.mutation=1,labels=T)
如何识别突变在我的 FASTA 文件中的位置,例如单倍型 XX
与 V
?
附加问题:
是否也有可能知道例如其中一种单倍型的单倍型序列是什么?例如单倍型V
,这是相当频繁的?
pegas
包包含一个函数 diffHaplo
,它指定单倍型之间的差异。
diffHaplo(haps50, a = "XX", b = "V")
提取频繁单倍型V
的DNA序列,classhaplotype
对象中的索引将识别哪个DNA序列包含单倍型。
# haplotype index from its name
i <- which(attr(haps50, "dimnames")[[1]] == "V")
# index of the first sequence with the haplotype
s <- attr(haps50, "index")[[i]][1]
然后可以在比对中识别相应的序列 fa
以保存或打印在屏幕上。
write.dna(fa[s], file = "hapV.fas", format = "fasta", nbcol = -1, colsep = "")
paste(unlist(as.character(fa[s])), collapse = "")