comparison snpEffExtract.R @ 2:dc51db22310c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit d1c54d077cfc0eeb9699719760e668948cb9bbbc"
author iuc
date Fri, 18 Dec 2020 23:48:01 +0000
parents 1062d6ad6503
children
comparison
equal deleted inserted replaced
1:e362b3143cde 2:dc51db22310c
3 suppressPackageStartupMessages(library(VariantAnnotation)) 3 suppressPackageStartupMessages(library(VariantAnnotation))
4 suppressPackageStartupMessages(library(tidyverse)) 4 suppressPackageStartupMessages(library(tidyverse))
5 5
6 tsv_eff_from_vcf <- function(input_vcf, output_tab) { 6 tsv_eff_from_vcf <- function(input_vcf, output_tab) {
7 read_vcf <- readVcf(input_vcf) # nolint 7 read_vcf <- readVcf(input_vcf) # nolint
8 if (!nrow(read_vcf@fixed)) {
9 # no variants in file -> just write a valid header line
10 write(c("CHROM", "POS", "REF", "ALT", "AF", "EFF[*].GENE", "EFF[*].EFFECT"),
11 ncolumns = 7, file = output_tab, sep = "\t")
12 return()
13 }
8 chrom_pos <- data.frame(read_vcf@rowRanges)[, c("seqnames", "start")] 14 chrom_pos <- data.frame(read_vcf@rowRanges)[, c("seqnames", "start")]
9 ref_alt_filter <- read_vcf@fixed[, c("REF", "ALT", "FILTER")] 15 ref_alt_filter <- read_vcf@fixed[, c("REF", "ALT", "FILTER")]
10 dp_af <- read_vcf@info[c("DP", "AF")] 16 dp_af <- read_vcf@info[c("DP", "AF")]
11 17
12 ## Unwrap the DNAStringList 18 ## Unwrap the DNAStringList