annotate helperFunctions.R @ 1:e362b3143cde draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
author iuc
date Thu, 10 Dec 2020 13:41:29 +0000
parents 1062d6ad6503
children dc51db22310c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ## Helper functions for processing variant data, especially for
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
4 ## data which contains duplicate variants differing only on
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
5 ## annotation.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
6
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
7 difference_in_group <- function(lines) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
8 #' Find the columns containing the differences between a
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
9 #' group of lines sharing the same POS and ALT.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
10 #' e.g.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
11 #' CHROM POS REF ALT IMPACT FUNCLASS AA GENE
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
12 #' 1 NC_045512.2 3037 C T LOW SILENT F924 ORF1ab
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
13 #' 2 NC_045512.2 3037 C T LOW SILENT F106 ORF1ab
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
14 #' 3 NC_045512.2 3037 C T MEDIUM SILENT F106 ORF1ab
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
15 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
16 #' should yield:
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
17 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
18 #' unique.name
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
19 #' 1 3037 T (LOW|F924)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
20 #' 2 3037 T (LOW|F106)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
21 #' 3 3037 T (MEDIUM|F106)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
22 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
23 #' i.e. it identifies that IMPACT and AA are the differing
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
24 #' columns for each of the rows
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
25 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
26 #' Ideally this function should just be used as
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
27 #' ``tab %>% group_by(POS, ALT) %>% difference_in_group()``
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 diff.colnames <- c()
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
30 nlines <- nrow(lines)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
31 if (nlines > 1) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
32 for (i in 1:(nlines - 1)) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
33 test1 <- lines[i, ]
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
34 for (j in i:nlines) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
35 test2 <- lines[j, ]
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
36 diff.colnames <- c(diff.colnames,
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
37 names(test1[!(test1 %in% test2)]))
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
38 }
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
39 }
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
40 }
1
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
41 group_select <- c("POS", "REF", "ALT", diff.colnames)
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
42 return(lines[, group_select] %>% unite(group_select, sep = " ")) # nolint
0
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
43 }
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
44
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
45 split_table_and_process <- function(tab) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
46 #' Split TAB into groups sharing the same POS and ALT
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
47 #' and create distinguishing labels.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
48 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
49 #' Calls the above ``difference_in_group`` for each
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
50 #' discovered group.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
51 #'
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
52 #' This function is necessary because tidyr is difficult
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
53 #' to write custom group binding functions.
1
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
54 group_ind <- tab %>% group_by(POS, REF, ALT) %>% select(POS, REF, ALT) # nolint
0
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
55 nlines <- nrow(tab)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
56 groups <- list()
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
57 groups[[1]] <- c(1, 1)
1
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
58 last_pa <- paste(group_ind[1, ])
0
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
59 for (r in 2:nlines) {
1
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
60 curr_pa <- paste(group_ind[r, ])
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
61 group_ind_diff_between_lines <- !all(last_pa == curr_pa)
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
62 if (group_ind_diff_between_lines) {
0
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
63 ## end of current group, start of new
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
64 groups[[length(groups)]][2] <- r - 1 ## change prev end
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
65 groups[[length(groups) + 1]] <- c(r, r) ## set (start, end)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
66 } else if (r == nlines) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
67 ## i.e. if the very last line shares
1
e362b3143cde "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1bde09fccd1a5412240ebd5c1f34a45ad73cebe2"
iuc
parents: 0
diff changeset
68 ## the same POS REF ALT as the one before,
0
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
69 ## close current group.
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
70 groups[[length(groups)]][2] <- r
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 last_pa <- curr_pa
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
73 }
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
74 as_tibble(do.call(
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
75 "rbind",
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
76 lapply(groups, function(grange) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
77 expand_range <- grange[1]:grange[2]
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
78 difference_in_group(tab[expand_range, ])
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
79 })
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
80 ))
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
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
83 read_and_process <- function(id) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
84 file <- (samples %>% filter(ids == id))$files # nolint
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
85 variants <- read.table(file, header = T, sep = "\t")
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
86 uniq_ids <- split_table_and_process(variants)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
87 if (nrow(variants) != nrow(uniq_ids)) {
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
88 stop(paste0(id, " '", file, "' failed: ", file, "\"",
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
89 "nrow(variants)=", nrow(variants),
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
90 " but nrow(uniq_ids)=", nrow(uniq_ids)))
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
91 }
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
92 variants <- as_tibble(cbind(variants, uniq_ids)) # nolint
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
93 return(variants)
1062d6ad6503 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snpfreqplot/ commit 1f35303af979c16d9a3126dbc882a59f686ace5d"
iuc
parents:
diff changeset
94 }