【问题标题】:Convert vcf to hap file, collapse genotypes将 vcf 转换为 hap 文件,折叠基因型
【发布时间】:2018-07-10 08:33:14
【问题描述】:

我用照片来提问。

我希望我的输出文件只有数字/行/样本。

我怎样才能删除newdata...C...和“”

有什么建议吗?

注意:我是第一次在这里提问。我试图遵守规则。 我还在学习。

【问题讨论】:

标签: r bioinformatics vcf-variant-call-format


【解决方案1】:

试试这个例子:

library(data.table)

# example vcf
hap <- fread('
##fileformat=VCFv4.0
##fileDate=20090805
##source=myImputationProgramV3.1
##reference=1000GenomesPilot-NCBI36
##phasing=partial
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##FILTER=<ID=q10,Description="Quality below 10">
##FILTER=<ID=s50,Description="Less than 50% of samples have data">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  NA00001 NA00002 NA00003
19  111 .   A   C   9.6 .   .   GT  0|0 0|0 0|1
19  112 .   A   G   10  .   .   GT  0|0 1|0 1|1
19  112 .   A   G   4   .   .   GT  1|0 1|0 1|1
')

data.table(gsub("|", "", do.call(paste0, hap[, -c(1:9)]), fixed = TRUE))
#        V1
# 1: 000001
# 2: 001011
# 3: 101011

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-28
    • 1970-01-01
    • 2017-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多