Mercurial > repos > iuc > snpfreqplot
annotate snpEffExtract.R @ 0:1062d6ad6503 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
author | iuc |
---|---|
date | Wed, 02 Dec 2020 21:23:06 +0000 |
parents | |
children | dc51db22310c |
rev | line source |
---|---|
0
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env R |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
2 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
3 suppressPackageStartupMessages(library(VariantAnnotation)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
4 suppressPackageStartupMessages(library(tidyverse)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
5 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
6 tsv_eff_from_vcf <- function(input_vcf, output_tab) { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
7 read_vcf <- readVcf(input_vcf) # nolint |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
8 chrom_pos <- data.frame(read_vcf@rowRanges)[, c("seqnames", "start")] |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
9 ref_alt_filter <- read_vcf@fixed[, c("REF", "ALT", "FILTER")] |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
10 dp_af <- read_vcf@info[c("DP", "AF")] |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
11 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
12 ## Unwrap the DNAStringList |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
13 # nolint start |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
14 ref_alt_filter <- data.frame( |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
15 REF = as.character(ref_alt_filter$REF), |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
16 ALT = sapply(seq_len(nrow(ref_alt_filter)), function(i) { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
17 as.character(ref_alt_filter$ALT[[i]]) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
18 }), |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
19 FILTER = as.character(ref_alt_filter$FILTER)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
20 # nolint end |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
21 ## |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
22 ## Don't unwrap EFF yet, we need to preserve rows |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
23 eff <- read_vcf@info["EFF"] |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
24 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
25 stopifnot(nrow(chrom_pos) == nrow(ref_alt_filter)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
26 stopifnot(nrow(ref_alt_filter) == nrow(dp_af)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
27 stopifnot(nrow(dp_af) == nrow(eff)) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
28 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
29 ## EFF data contains nested constructs we need to unify all |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
30 ## data sources first, and then explode the EFF column. |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
31 united <- as_tibble(cbind(chrom_pos, ref_alt_filter, dp_af, eff)) # nolint |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
32 united_exploderows <- unnest(united, cols = c(EFF)) # nolint |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
33 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
34 united_exploderows <- united_exploderows %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
35 dplyr::mutate(CHROM = seqnames, POS = start) %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
36 dplyr::select(CHROM, POS, REF, ALT, FILTER, DP, AF, EFF) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
37 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
38 ## EFF columns are defined here: |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
39 ## https://pcingola.github.io/SnpEff/se_inputoutput/ |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
40 options(warn = -1) ## suppress warnings |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
41 seperated_info <- united_exploderows %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
42 separate(EFF, sep = "[(|)]", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
43 extra = "merge", ## extra values merged into "extra" column |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
44 into = c("EFF[*].EFFECT", "EFF[*].IMPACT", "EFF[*].FUNCLASS", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
45 "codon.change", "EFF[*].AA", "AA.length", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
46 "EFF[*].GENE", "trans.biotype", "gene.coding", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
47 "trans.id", "exon.rank", "gt.num", "warnings", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
48 "extra")) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
49 options(warn = 0) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
50 ## If there is data that has been dropped or filled-in, we will see it in |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
51 ## the "extra" column if it isn't NA or an empty quote. |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
52 test_missing <- seperated_info %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
53 dplyr::select("CHROM", "POS", "extra") %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
54 replace_na(list(extra = "")) %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
55 filter(extra != "") |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
56 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
57 if (nrow(test_missing) > 0) { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
58 print(test_missing) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
59 stop("Extra values were not parsed") |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
60 } |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
61 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
62 vcf_info <- seperated_info %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
63 dplyr::select("CHROM", "POS", "REF", "ALT", "FILTER", "DP", "AF", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
64 "EFF[*].EFFECT", "EFF[*].IMPACT", "EFF[*].FUNCLASS", |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
65 "EFF[*].AA", "EFF[*].GENE") %>% |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
66 ## now we de-duplicate any rows that arise from subselecting columns |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
67 dplyr::distinct() |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
68 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
69 ## At this point, we would still have rows which share a POS and ALT pair |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
70 ## which could be problematic for the heatmap plot later. |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
71 ## |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
72 ## This is not something to worry about here, and is resolved in the heatmap |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
73 ## script later. |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
74 write.table(vcf_info, file = output_tab, |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
75 quote = F, sep = "\t", row.names = F) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
76 } |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
77 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
78 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
79 # M A I N |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
80 stopifnot(exists("samples")) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
81 |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
82 for (i in seq_len(nrow(samples))) { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
83 entry <- samples[i, ]; |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
84 if (entry$exts %in% c("vcf", "vcf.gz")) { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
85 in_vcf <- entry$files |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
86 out_tsv <- paste0(entry$ids, ".tsv") ## use local dir |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
87 tsv_eff_from_vcf(in_vcf, out_tsv) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
88 ## point to the new file |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
89 samples[i, ]$files <- out_tsv |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
90 message(paste(entry$ids, ": converted from VCF to tabular")) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
91 } else { |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
92 message(paste(entry$ids, ": already tabular")) |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
93 } |
1062d6ad6503
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff
changeset
|
94 } |