-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/vastgroup/vast-tools
- Loading branch information
Showing
5 changed files
with
133 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
# Author: Tim Sterne-Weiler, 2014 | ||
# [email protected] | ||
# Modifications Ulrich Braunschweig 2018 | ||
# Modifications Ulrich Braunschweig 2018-2019 | ||
|
||
# Copyright (C) 2014 Tim Sterne-Weiler | ||
# | ||
|
@@ -70,7 +70,7 @@ option.list <- list( | |
help = "Threshold for min diff where P( (psi1 - psi2) > threshold ) > --prob [default %default]"), | ||
make_option(c("-e", "--minReads"), type = "numeric", default = 10, | ||
help = "Threshold for min reads in a sample (use this flag unless you believe the prior) [default %default]"), | ||
make_option(c("-S","--minSamples"), type = "numeric", default = 1, | ||
make_option(c("-S","--minSamples"), type = "integer", default = 1, | ||
help = "Threshold for min samples with min reads in a group [default %default]"), | ||
make_option(c("--alpha"), type = "numeric", default = 1, | ||
help = "First shape parameter for the Beta prior distribution P(psi), Uniform by default [default %default]"), | ||
|
@@ -101,6 +101,16 @@ if (length(commandArgs(TRUE)) == 2 & commandArgs(TRUE)[1] == "-o") { | |
stop("No input") | ||
} | ||
|
||
## input checks | ||
if (opt$prob < 0 | opt$prob >= 1) { | ||
stop ("--prob must be a positive number < 1") | ||
} | ||
|
||
if (opt$minDiff < 0 | opt$minDiff >= 1) { | ||
stop ("--minDiff must be a positive number < 1") | ||
} | ||
|
||
|
||
loadPackages(c("MASS", "RColorBrewer", "reshape2", "ggplot2", "grid", "parallel"), local.lib=paste(c(scriptPath,"/Rlib"), collapse="")) | ||
|
||
## move to output directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,17 @@ | |
# Updates: Manuel Irimia, 2015-present | ||
# [email protected] | ||
|
||
argv <- commandArgs(trailingOnly = F) | ||
scriptPath <- dirname(sub("--file=","",argv[grep("--file",argv)])) | ||
suppressPackageStartupMessages(require(optparse)) | ||
|
||
option_list <- list( | ||
make_option(c("-p", "--prompt"), action="store_true", default=TRUE, type="logical", help="User prompt during installation [default %default]"), | ||
make_option(c("-q", "--quiet"), action="store_false", dest="prompt", type="logical", help="Quiet installation, no prompt"), | ||
make_option(c("-f", "--file"), action="store", default=".", type='character', help="From where to run install script") | ||
) | ||
|
||
opt <- parse_args(OptionParser(option_list=option_list)) | ||
|
||
scriptPath <- dirname( opt$file ) | ||
|
||
joinStr <- function(x,y) { | ||
return(paste(c(as.character(x), as.character(y)), collapse="")) | ||
|
@@ -57,64 +66,66 @@ planariaUrl <- joinStr("http://vastdb.crg.eu/libs/", planariaDbFile) | |
NveUrl <- joinStr("http://vastdb.crg.eu/libs/", NveDbFile) | ||
|
||
# | ||
|
||
writeLines("Looking for VAST Database [VASTDB]") | ||
auto <- "invalid" | ||
if(!file.exists("VASTDB")) { | ||
cat("Cannot find 'VASTDB'.. Do you want to download it? [y/n]: ") | ||
auto <- readLines(file("stdin"),1) | ||
close(file("stdin")) | ||
} | ||
if(file.exists("VASTDB")) { | ||
cat("Found 'VASTDB'.. Do you want to download yet uninstalled datasets or update installed datasets? [y/n]: ") | ||
auto <- readLines(file("stdin"),1) | ||
close(file("stdin")) | ||
} | ||
|
||
if(as.character(auto) == 'y') { | ||
cat("Please choose one or more, e.g. Hsa,Mmu,Dre, from [all, Hsa, Mmu, Dre, Bla, Spu, Dme, Sma, Cel, Sme, Nve] : ") | ||
db <- readLines(file("stdin"),1) | ||
db <- as.character(db) | ||
close(file("stdin")) | ||
if ( opt$prompt ) { | ||
|
||
writeLines("Looking for VAST Database [VASTDB]") | ||
auto <- "invalid" | ||
if(!file.exists("VASTDB")) { | ||
cat("Cannot find 'VASTDB'.. Do you want to download it? [y/n]: ") | ||
auto <- readLines(file("stdin"),1) | ||
close(file("stdin")) | ||
} | ||
if(file.exists("VASTDB")) { | ||
cat("Found 'VASTDB'.. Do you want to download yet uninstalled datasets or update installed datasets? [y/n]: ") | ||
auto <- readLines(file("stdin"),1) | ||
close(file("stdin")) | ||
} | ||
|
||
dbs<-strsplit(db,"\\s*,\\s*",perl=TRUE)[[1]] | ||
for(db in dbs){ | ||
if(db == 'Hsa' || db == 'all') { | ||
downloadDb(humanUrl, humanDbFile) | ||
} | ||
if(db == 'Mmu' || db == 'all') { | ||
downloadDb(mouseUrl, mouseDbFile) | ||
} | ||
if(db == 'Gga' || db == 'all') { | ||
downloadDb(chickenUrl, chickenDbFile) | ||
} | ||
if(db == 'Dre' || db == 'all') { | ||
downloadDb(DreUrl, DreDbFile) | ||
} | ||
if(db == 'Bla' || db == 'all') { | ||
downloadDb(BlaUrl, BlaDbFile) | ||
} | ||
if(db == 'Spu' || db == 'all') { | ||
downloadDb(SpuUrl, SpuDbFile) | ||
} | ||
if(db == 'Dme' || db == 'all') { | ||
downloadDb(DmeUrl, DmeDbFile) | ||
} | ||
if(db == 'Sma' || db == 'all') { | ||
downloadDb(SmaUrl, SmaDbFile) | ||
} | ||
if(db == 'Cel' || db == 'all') { | ||
downloadDb(CelUrl, CelDbFile) | ||
} | ||
if(db == 'Sme' || db == 'all') { | ||
downloadDb(planariaUrl, planariaDbFile) | ||
} | ||
if(db == 'Nve' || db == 'all') { | ||
downloadDb(NveUrl, NveDbFile) | ||
if(as.character(auto) == 'y') { | ||
cat("Please choose one or more, e.g. Hsa,Mmu,Dre, from [all, Hsa, Mmu, Dre, Bla, Spu, Dme, Sma, Cel, Sme, Nve] : ") | ||
db <- readLines(file("stdin"),1) | ||
db <- as.character(db) | ||
close(file("stdin")) | ||
|
||
dbs<-strsplit(db,"\\s*,\\s*",perl=TRUE)[[1]] | ||
for(db in dbs){ | ||
if(db == 'Hsa' || db == 'all') { | ||
downloadDb(humanUrl, humanDbFile) | ||
} | ||
if(db == 'Mmu' || db == 'all') { | ||
downloadDb(mouseUrl, mouseDbFile) | ||
} | ||
if(db == 'Gga' || db == 'all') { | ||
downloadDb(chickenUrl, chickenDbFile) | ||
} | ||
if(db == 'Dre' || db == 'all') { | ||
downloadDb(DreUrl, DreDbFile) | ||
} | ||
if(db == 'Bla' || db == 'all') { | ||
downloadDb(BlaUrl, BlaDbFile) | ||
} | ||
if(db == 'Spu' || db == 'all') { | ||
downloadDb(SpuUrl, SpuDbFile) | ||
} | ||
if(db == 'Dme' || db == 'all') { | ||
downloadDb(DmeUrl, DmeDbFile) | ||
} | ||
if(db == 'Sma' || db == 'all') { | ||
downloadDb(SmaUrl, SmaDbFile) | ||
} | ||
if(db == 'Cel' || db == 'all') { | ||
downloadDb(CelUrl, CelDbFile) | ||
} | ||
if(db == 'Sme' || db == 'all') { | ||
downloadDb(planariaUrl, planariaDbFile) | ||
} | ||
if(db == 'Nve' || db == 'all') { | ||
downloadDb(NveUrl, NveDbFile) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
# custom install from include.R | ||
loadPackages(c("MASS", "getopt", "optparse", "RColorBrewer", "reshape2", "ggplot2", "grid", "parallel", "devtools"), local.lib=paste(c(scriptPath,"/R/Rlib"), collapse="")) | ||
|