Skip to content

Commit

Permalink
mem/time setting updates; sex params
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinha committed Aug 7, 2018
1 parent f89eb2e commit 3d557f8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions TitanCNA.snakefile
Expand Up @@ -45,7 +45,7 @@ rule runTitanCNA:
numCores=config["TitanCNA_numCores"],
normal=config["TitanCNA_normalInit"],
chrs=config["TitanCNA_chrs"],
gender=config["gender"],
sex=config["sex"],
estimatePloidy=config["TitanCNA_estimatePloidy"],
estimateClonality=config["TitanCNA_estimateClonality"],
estimateNormal=config["TitanCNA_estimateNormal"],
Expand All @@ -58,11 +58,11 @@ rule runTitanCNA:
plotYlim=config["TitanCNA_plotYlim"],
mem=config["TitanCNA_mem"],
runtime=config["TitanCNA_runtime"],
pe=config["TitanCNA_numCores"]
pe=config["TitanCNA_pe"]
log:
"logs/titan/titanCNA_ploidy{ploidy}/{tumor}_cluster{clustNum}.log"
shell:
"Rscript {params.titanRscript} --id {wildcards.tumor} --hetFile {input.alleleCounts} --cnFile {input.corrDepth} --numClusters {wildcards.clustNum} --numCores {params.numCores} --normal_0 {params.normal} --ploidy_0 {wildcards.ploidy} --chrs \"{params.chrs}\" --gender {params.gender} --haplotypeBinSize {params.haplotypeBinSize} --estimateNormal {params.estimateNormal} --estimatePloidy {params.estimatePloidy} --estimateClonality {params.estimateClonality} --centromere {params.centromere} --genomeBuild {params.genomeBuild} --genomeStyle {params.genomeStyle} --libdir {params.libdir} --alphaK {params.alphaK} --alphaR {params.alphaR} --alleleModel Gaussian --txnExpLen {params.txnExpLen} --plotYlim \"{params.plotYlim}\" --cytobandFile {params.cytobandFile} --outFile {output.titan} --outSeg {output.segTxt} --outParam {output.param} --outIGV {output.seg} --outPlotDir {output.outRoot} > {log} 2> {log}"
"Rscript {params.titanRscript} --id {wildcards.tumor} --hetFile {input.alleleCounts} --cnFile {input.corrDepth} --numClusters {wildcards.clustNum} --numCores {params.numCores} --normal_0 {params.normal} --ploidy_0 {wildcards.ploidy} --chrs \"{params.chrs}\" --sex {params.sex} --haplotypeBinSize {params.haplotypeBinSize} --estimateNormal {params.estimateNormal} --estimatePloidy {params.estimatePloidy} --estimateClonality {params.estimateClonality} --centromere {params.centromere} --genomeBuild {params.genomeBuild} --genomeStyle {params.genomeStyle} --libdir {params.libdir} --alphaK {params.alphaK} --alphaR {params.alphaR} --alleleModel Gaussian --txnExpLen {params.txnExpLen} --plotYlim \"{params.plotYlim}\" --cytobandFile {params.cytobandFile} --outFile {output.titan} --outSeg {output.segTxt} --outParam {output.param} --outIGV {output.seg} --outPlotDir {output.outRoot} > {log} 2> {log}"


rule combineTitanAndIchorCNA:
Expand All @@ -80,14 +80,14 @@ rule combineTitanAndIchorCNA:
combineScript=config["TitanCNA_combineTitanIchorCNA"],
libdir=config["TitanCNA_libdir"],
centromere=config["centromere"],
gender=config["gender"],
sex=config["sex"],
mem=config["std_mem"],
runtime=config["std_runtime"],
pe=config["std_numCores"]
log:
"logs/titan/titanCNA_ploidy{ploidy}/{tumor}_cluster{clustNum}.combineTitanIchorCNA.log"
shell:
"Rscript {params.combineScript} --libdir {params.libdir} --titanSeg {input.titanSeg} --titanBin {input.titanBin} --titanParam {input.titanParam} --ichorSeg {input.ichorSeg} --ichorBin {input.ichorBin} --ichorParam {input.ichorParam} --gender {params.gender} --outSegFile {output.segFile} --outBinFile {output.binFile} --centromere {params.centromere} > {log} 2> {log}"
"Rscript {params.combineScript} --libdir {params.libdir} --titanSeg {input.titanSeg} --titanBin {input.titanBin} --titanParam {input.titanParam} --ichorSeg {input.ichorSeg} --ichorBin {input.ichorBin} --ichorParam {input.ichorParam} --sex {params.sex} --outSegFile {output.segFile} --outBinFile {output.binFile} --centromere {params.centromere} > {log} 2> {log}"


rule selectSolution:
Expand Down
4 changes: 2 additions & 2 deletions code/combineTITAN-ichor.R
Expand Up @@ -19,7 +19,7 @@ option_list <- list(
make_option(c("--ichorSeg"), type="character", help="ichorCNA segs.txt file. Required."),
make_option(c("--ichorBin"), type="character", help="ichorCNA cna.seg file. Required."),
make_option(c("--ichorParams"), type="character", help="ichorCNA params.txt file. Required."),
make_option(c("--gender"), type="character", default="female", help="female or male. Default [%default]."),
make_option(c("--sex"), type="character", default="female", help="female or male. Default [%default]."),
make_option(c("--libdir"), type="character", help="TitanCNA directory path to source R files if custom changes made."),
make_option(c("--outSegFile"), type="character", help="New combined segment file. Required"),
make_option(c("--outBinFile"), type="character", help="New combined bin-level file. Required"),
Expand All @@ -36,7 +36,7 @@ titanParams <- opt$titanParams
ichorSeg <- opt$ichorSeg
ichorBin <- opt$ichorBin
ichorParams <- opt$ichorParams
gender <- opt$gender
gender <- opt$sex
outSegFile <- opt$outSegFile
outBinFile <- opt$outBinFile
centromere <- opt$centromere
Expand Down
12 changes: 6 additions & 6 deletions code/titanCNA_v1.15.0_TenX.R
Expand Up @@ -34,7 +34,7 @@ option_list <- list(
make_option(c("--genomeStyle"), type = "character", default = "NCBI", help = "NCBI or UCSC chromosome naming convention; use UCSC if desired output is to have \"chr\" string. [Default: %default]"),
make_option(c("--genomeBuild"), type = "character", default = "hg38", help="Genome build to use; will load Seqinfo from GenomeInfoDb."),
make_option(c("--chrs"), type = "character", default = "c(1:22, 'X')", help = "Chromosomes to analyze; string [Default: %default"),
make_option(c("--gender"), type = "character", default = "male", help = "User specified gender: male or female [Default: %default]"),
make_option(c("--sex"), type = "character", default = "male", help = "User specified sex: male or female [Default: %default]"),
make_option(c("--cytobandFile"), type = "character", default = NULL, help = "Cytoband file should be provided only if reference genome is hg38."),
make_option(c("--mapWig"), type = "character", default = NULL, help = "Mappability score file for bin sizes matching cnfile. [Default: %default]"),
make_option(c("--mapThres"), type = "numeric", default = 0.9, help = "Minimum mappability score threshold to use; float [Default: %default]"),
Expand Down Expand Up @@ -100,7 +100,7 @@ chrs <- eval(parse(text = opt$chrs))
genomeStyle <- opt$genomeStyle
genomeBuild <- opt$genomeBuild
cytobandFile <- opt$cytobandFile
gender <- opt$gender
sex <- opt$sex
mapWig <- opt$mapWig
centromere <- opt$centromere
haplotypeBinSize <- opt$haplotypeBinSize
Expand Down Expand Up @@ -144,8 +144,8 @@ outImage <- gsub(".titan.txt", ".RData", outfile)
## set up chromosome naming convention ##
seqinfo <- Seqinfo(genome=genomeBuild)
seqlevelsStyle(chrs) <- genomeStyle
## exclude chrX if gender==male ##
if (gender == "male" || gender == "Male" || gender == "MALE"){
## exclude chrX if sex==male ##
if (sex == "male" || sex == "Male" || sex == "MALE"){
chrs <- chrs[!grepl("X", chrs)]
}

Expand Down Expand Up @@ -222,7 +222,7 @@ save.image(file=outImage)
#### OUTPUT SEGMENTS ####
segs <- outputTitanSegments(results, id, convergeParams, filename = NULL, igvfilename = outigv)
corrIntCN.results <- correctIntegerCN(results, segs, 1 - norm, ploidy, maxCNtoCorrect.autosomes = maxCN,
maxCNtoCorrect.X = NULL, minPurityToCorrect = 0.2, gender = gender, chrs = chrs)
maxCNtoCorrect.X = NULL, minPurityToCorrect = 0.2, gender = sex, chrs = chrs)
results <- corrIntCN.results$cn
segs <- corrIntCN.results$segs
message("Writing results to ", outfile, ",\n\t", outseg, ",\n\t", outparam)
Expand All @@ -240,7 +240,7 @@ if (genomeBuild == "hg38" && file.exists(cytobandFile)){
#cytoband$V1 <- setGenomeStyle(cytoband$V1, genomeStyle = genomeStyle)
}

if (gender == "male"){
if (sex == "male"){
chrsToPlot <- chrs[!grepl("X", chrs)]
}else{
chrsToPlot <- chrs
Expand Down
11 changes: 6 additions & 5 deletions config/config.yaml
Expand Up @@ -9,7 +9,7 @@ phaseCounts_counts_script: code/getTumourAlleleCountsAtHETSites.py
TitanCNA_rscript: code/titanCNA_v1.15.0_TenX.R
TitanCNA_selectSolutionRscript: code/selectSolution.R
TitanCNA_combineTitanIchorCNA: code/combineTITAN-ichor.R
TitanCNA_libdir: /path/to/TitahCNA/ ## optional
TitanCNA_libdir: /path/to/TitanCNA/ ## optional
ichorCNA_libdir: /path/to/ichorCNA/ ## optional

## reference settings ##
Expand All @@ -18,7 +18,7 @@ genomeStyle: UCSC
snpVCF: /path/to/hapmap_3.3.hg38.vcf.gz ## optional
cytobandFile: data/cytoBand_hg38.txt # only need if hg38
centromere: data/GRCh38.GCA_000001405.2_centromere_acen.txt
gender: male
sex: male

## LongRanger params ##
bamFileName: phased_possorted_bam.bam
Expand Down Expand Up @@ -56,7 +56,7 @@ het_minBaseQuality: 10
het_minMapQuality: 20

## TitanCNA params ##
TitanCNA_maxNumClonalClusters: 1
TitanCNA_maxNumClonalClusters: 2
TitanCNA_chrs: c(1:22, \"X\")
TitanCNA_normalInit: 0.5
TitanCNA_maxPloidy: 3
Expand All @@ -69,9 +69,10 @@ TitanCNA_alphaR: 5000
TitanCNA_txnExpLen: 1e15
TitanCNA_plotYlim: c(-2,4)
TitanCNA_solutionThreshold: 0.05
TitanCNA_numCores: 1
TitanCNA_mem: 16G
TitanCNA_runtime: "10:00:00"
TitanCNA_numCores: -pe smp 1 -binding linear:1
TitanCNA_runtime: "300:00:00"
TitanCNA_pe: -pe smp 1 -binding linear:1



5 changes: 2 additions & 3 deletions getPhasedAlleleCounts.snakefile
Expand Up @@ -10,9 +10,8 @@ def getLRFullPath(base, filename):

rule phasedCounts:
input:
expand("results/phasedCounts/tumCounts/{tumor}/{tumor}.tumCounts.{chr}.txt", tumor=config["pairings"], chr=CHRS),
expand("results/phasedCounts/tumCounts/{tumor}.tumCounts.txt", tumor=config["pairings"])

rule getHETsites:
input:
lambda wildcards: getLRFullPath(config["samples"][config["pairings"][wildcards.tumor]], config["phaseVariantFileName"])
Expand All @@ -33,7 +32,7 @@ rule getHETsites:
log:
"logs/phasedCounts/hetPosns/{tumor}.phasedHETsites.log"
shell:
"Rscript {params.getHETsitesScript} --inVCF {input} --genomeBuild {params.genomeBuild} --genomeStyle {params.genomeStyle} --snpDB {params.snpDB} --minQuality {params.minQual} --minDepth {params.minDepth} --minVAF {params.minVAF} --altCountField AD --libdir {params.libdir} --outVCF {output} 2> {log}"
"Rscript {params.getHETsitesScript} --inVCF {input} --genomeBuild {params.genomeBuild} --genomeStyle {params.genomeStyle} --snpDB {params.snpDB} --minQuality {params.minQual} --minDepth {params.minDepth} --minVAF {params.minVAF} --altCountField AD --libdir {params.libdir} --outVCF {output} > {log} 2> {log}"


rule getAlleleCountsByChr:
Expand Down
2 changes: 1 addition & 1 deletion moleculeCoverage.snakefile
Expand Up @@ -34,7 +34,7 @@ rule bxTile:
bxTools=config["bxTools"],
samTools=config["samTools"],
mapQual=config["bx_mapQual"],
bedFile=config["bx_bedFileRoot"]
bedFile=config["bx_bedFileRoot"],
mem=config["std_mem"],
runtime=config["std_runtime"],
pe=config["std_numCores"]
Expand Down

0 comments on commit 3d557f8

Please sign in to comment.