diff --git a/.misc/meta.yml b/.misc/meta.yml index 15c625f..9631ef8 100644 --- a/.misc/meta.yml +++ b/.misc/meta.yml @@ -1,4 +1,4 @@ -{% set version = "3.6.2" %} +{% set version = "3.6.3" %} {% set sha256 = "0f0998ecd50b586d69b50e53d9a0b3d5aa3afa70bd96fe85c2fa3ba02e58278b" %} package: diff --git a/scripts/LASummary.r b/scripts/LASummary.r index 0729769..79321dc 100755 --- a/scripts/LASummary.r +++ b/scripts/LASummary.r @@ -1,7 +1,7 @@ #! /usr/bin/env Rscript -library(dplyr) -library(tidyr) +suppressPackageStartupMessages(library(dplyr)) +suppressPackageStartupMessages(library(tidyr)) library(ggplot2) library(readr) diff --git a/scripts/LepWrapTrim.r b/scripts/LepWrapTrim.r index 463361d..901a576 100755 --- a/scripts/LepWrapTrim.r +++ b/scripts/LepWrapTrim.r @@ -1,7 +1,7 @@ #! /usr/bin/env Rscript -library(dplyr) -library(tidyr) +suppressPackageStartupMessages(library(dplyr)) +suppressPackageStartupMessages(library(tidyr)) library(ggplot2) args <- commandArgs(trailingOnly = TRUE) diff --git a/scripts/MapSummary.r b/scripts/MapSummary.r index 03b3899..aa68e9f 100755 --- a/scripts/MapSummary.r +++ b/scripts/MapSummary.r @@ -21,47 +21,46 @@ if (file_test("-f", args[1])) { # if args[1] is the target directory } else if (file_test("-d", args[1])) { -library(stringr) -targetdir <- args[1] + library(stringr) + targetdir <- args[1] -# pattern match to find the map files -flist <- list.files(targetdir, full.names = TRUE, pattern = "^LOD.") -# natural language sort -flist <- str_sort(flist, numeric = TRUE) + # pattern match to find the map files + flist <- list.files(targetdir, full.names = TRUE, pattern = "^LOD.") + # natural language sort + flist <- str_sort(flist, numeric = TRUE) -for (i in flist){ - # pull the file name from the end - mapfile <- tail(strsplit(i, "\\/")[[1]], n = 1) - # pull out the LOD value - lod<- strsplit(mapfile, "\\.")[[1]][2] - # read in the file - .dat <- read.table(i, header = FALSE, skip = 1) - # make a table of counts - .counts <- as.data.frame(table(.dat$V1)) - # rename columns - names(.counts) <- c("LG", paste0("LOD.", lod)) - if (i == flist[1]){ - # if it's the first file, instantiate the counts dataframe - summtable <- .counts - } else { - # otherwise do a matchy-matchy (outer join) to update/bind the dataframe - summtable <- merge(summtable, .counts, by = "LG", all.x = TRUE, all.y = TRUE) + for (i in flist){ + # pull the file name from the end + mapfile <- tail(strsplit(i, "\\/")[[1]], n = 1) + # pull out the LOD value + lod<- strsplit(mapfile, "\\.")[[1]][2] + # read in the file + .dat <- read.table(i, header = FALSE, skip = 1) + # make a table of counts + .counts <- as.data.frame(table(.dat$V1)) + # rename columns + names(.counts) <- c("LG", paste0("LOD.", lod)) + if (i == flist[1]){ + # if it's the first file, instantiate the counts dataframe + summtable <- .counts + } else { + # otherwise do a matchy-matchy (outer join) to update/bind the dataframe + summtable <- merge(summtable, .counts, by = "LG", all.x = TRUE, all.y = TRUE) + } } -} - -# replace NA's as 0 -summtable[is.na(summtable)] <- 0 -summtable <- summtable[order(summtable$LG),] -# generate output filenames -out_tmp <-paste0(targetdir, "/.all.LOD.summary") -out_file <- paste0(targetdir, "/all.LOD.summary") + # replace NA's as 0 + summtable[is.na(summtable)] <- 0 + summtable <- summtable[order(summtable$LG),] -write.table(summtable, file = out_tmp, quote = FALSE, row.names = FALSE, col.names = TRUE) -# use GNU column command to make the table fixed-width and remove the tmp file -cmd <- paste("column -t", out_tmp, ">", out_file, "&& rm", out_tmp) -system(cmd) + # generate output filenames + out_tmp <-paste0(targetdir, "/.all.LOD.summary") + out_file <- paste0(targetdir, "/all.LOD.summary") + write.table(summtable, file = out_tmp, quote = FALSE, row.names = FALSE, col.names = TRUE) + # use GNU column command to make the table fixed-width and remove the tmp file + cmd <- paste("column -t", out_tmp, ">", out_file, "&& rm", out_tmp) + system(cmd) } else { cat("Error: the argument must be either a mapfile or a directory of mapfiles") } \ No newline at end of file diff --git a/scripts/MarkerPlot.r b/scripts/MarkerPlot.r index e784a76..fb80aed 100755 --- a/scripts/MarkerPlot.r +++ b/scripts/MarkerPlot.r @@ -1,7 +1,7 @@ #! /usr/bin/env Rscript -library(dplyr) -library(tidyr) +suppressPackageStartupMessages(library(dplyr)) +suppressPackageStartupMessages(library(tidyr)) library(ggplot2) args <- commandArgs(trailingOnly = TRUE) diff --git a/scripts/RecombinationSummary.r b/scripts/RecombinationSummary.r index e07dddb..af15f05 100755 --- a/scripts/RecombinationSummary.r +++ b/scripts/RecombinationSummary.r @@ -1,10 +1,10 @@ #! /usr/bin/env Rscript # This script will parse all the recombination logs of LepWrap -library(dplyr) -library(tidyr) +suppressPackageStartupMessages(library(dplyr)) +suppressPackageStartupMessages(library(tidyr)) library(stringr) -library(purrr) +suppressPackageStartupMessages(library(purrr)) ## setup outfile # format trailing arguments for script diff --git a/scripts/TrimSummaryPlot.r b/scripts/TrimSummaryPlot.r index 9dd3946..57903e3 100755 --- a/scripts/TrimSummaryPlot.r +++ b/scripts/TrimSummaryPlot.r @@ -1,7 +1,7 @@ #! /usr/bin/env Rscript -suppressMessages(library(dplyr)) -suppressPackageStartupMessages((library(tidyr)) +suppressPackageStartupMessages(library(dplyr)) +suppressPackageStartupMessages(library(tidyr)) library(ggplot2) library(readr) @@ -28,5 +28,4 @@ tbl %>% ) + scale_y_continuous(limits = c(-0.05, max(tbl$n_removed)+10)) -ggsave(paste0(args[1], ".pdf"), height = 4, width = 7, units = "in") -#ggsave(paste0(args[1], ".svg"), height = 4, width = 7, units = "in") \ No newline at end of file +ggsave(paste0(args[1], ".pdf"), height = 4, width = 7, units = "in") \ No newline at end of file