-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extending dpclust master function to read from bb rho_psi files and a…
…dding an example pipeline
- Loading branch information
Stefan Dentro
committed
Nov 2, 2018
1 parent
6b7a6bc
commit 9ec2a9f
Showing
2 changed files
with
66 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#' | ||
#' Simple pipeline that produces a DPClust master file | ||
#' | ||
#' v1.0 - 2018-11-02 - sd11 [at] sanger.ac.uk | ||
|
||
library(dpclust3p) | ||
library(optparse) | ||
|
||
option_list = list( | ||
make_option(c("-s", "--samplenames"), type="character", default=NULL, help="Comma separated list of samplenames", metavar="character"), | ||
make_option(c("-d", "--donornames"), type="character", default=NULL, help="Comma separated list of donornames (use the same donor name to match multiple samples)", metavar="character"), | ||
make_option(c("-p", "--purities"), type="character", default=NULL, help="Comma separated list of purities (supply -p or -r)", metavar="character"), | ||
make_option(c("-r", "--rho_and_psi"), type="character", default=NULL, help="List of Battenberg rho and psi output files (supply -p or -r)", metavar="character"), | ||
make_option(c("--sex"), type="character", default=NULL, help="Comma separated list of sex of the sample", metavar="character"), | ||
make_option(c("-o", "--output"), type="character", default=NULL, help="Output file", metavar="character") | ||
) | ||
|
||
opt_parser = OptionParser(option_list=option_list) | ||
opt = parse_args(opt_parser) | ||
|
||
donornames = strsplit(opt$donornames, ",") | ||
samplenames = strsplit(opt$samplenames, ",") | ||
sex = strsplit(opt$sex, ",") | ||
outputfile = opt$output | ||
|
||
if (!is.null(opt$rho_and_psi)) { | ||
rho_and_psi_files = strsplit(opt$rho_and_psi, ",") | ||
} else { | ||
rho_and_psi_files = NULL | ||
} | ||
if (!is.null(opt$purities)) { | ||
purities = strsplit(opt$purities, ",") | ||
} else { | ||
purities = NULL | ||
} | ||
|
||
if (!all(sex %in% c("male", "female"))) { | ||
stop("Provide male or female as sex") | ||
} | ||
|
||
createProjectFile(outputfile=outputfile, | ||
donornames=donornames, | ||
samplenames=samplenames, | ||
sex=sex, | ||
purities=purities, | ||
rho_and_psi_files=rho_and_psi_files) |