1、vcfR
BiocManager::install('vcfR') library('vcfR') library(pinfsc50) library(reshape2) library(ggplot2) vcf <- system.file('extdata','pinf_sc50.vcf.gz',package = 'pinfsc50') vcf <- vcfR::read.vcfR(vcf, verbose = FALSE) dp <- extract.gt(vcf, element='DP', as.numeric = TRUE) str(vcf) dpf <- melt(dp, varnames=c('Index', 'Sample'),value.name = 'Depth', na.rm=TRUE) p <- ggplot(dpf, aes(x=Sample, y=Depth)) +geom_violin(fill='#C0C0C0', adjust=1.0,scale = 'count', trim=TRUE) p <- p + theme_bw() p <- p + ylab('Read Depth (DP)') p <- p + theme(axis.title.x = element_blank(),axis.text.x = element_text(angle = 60, hjust = 1)) p <- p + stat_summary(fun.data=mean_sdl,geom='pointrange', color='black') p <- p + scale_y_continuous(trans=scales::log2_trans(),) breaks=c(1, 10, 100, 1000) p heatmap.bp(dp[501:1500,], rlabels = FALSE) dna_file <- system.file('extdata','pinf_sc50.fasta',package = 'pinfsc50') gff_file <- system.file('extdata','pinf_sc50.gff',package = 'pinfsc50') dna <- ape::read.dna(dna_file, format = 'fasta') gff <- read.table(gff_file, sep='\t',quote='') chrom <- create.chromR(name='Supercontig',vcf=vcf, seq=dna,ann=gff) chrom <- masker(chrom, min_QUAL=0, min_DP=350,max_DP=650, min_MQ=59.5,max_MQ=60.5) chrom <- proc.chromR(chrom) chromoqc(chrom, dp.alpha=20)