diff --git a/conf/quest.config b/conf/quest.config index e2960e1..12a191e 100644 --- a/conf/quest.config +++ b/conf/quest.config @@ -2,11 +2,11 @@ // Configuration for Quest (slurm) -process { +// process { - conda = "/projects/b1059/software/conda_envs/concordance-nf_env" - module = 'R/3.6.0' -} +// conda = "/projects/b1059/software/conda_envs/concordance-nf_env" +// module = 'R/3.6.0' +// } params { diff --git a/conf/quest_debug.config b/conf/quest_debug.config index fe5dc04..eca8298 100644 --- a/conf/quest_debug.config +++ b/conf/quest_debug.config @@ -1,7 +1,7 @@ // For quest debug -singularity { singularity.enabled = true } +// singularity { singularity.enabled = true } process { @@ -14,18 +14,18 @@ process { // } // container = 'docker://faithman/concordance:latest' - module = "R/3.6.0" + // module = "R/3.6.0" } params { debug = true date = new Date().format( 'yyyyMMdd' ) - genome = "WS245" + genome = "WS283" fq_file_prefix = "test_data" params.out = "DEBUG_concordance-${date}" //reference = "WS245/WS245.fa.gz" - reference = "/projects/b1059/data/genomes/c_elegans/${genome}" + // reference = "/projects/b1059/data/genomes/c_elegans/${genome}" fq_file = 'test_data/sample_sheet.tsv' min_depth = 0 diff --git a/main.nf b/main.nf index e5249c3..5be6fa7 100644 --- a/main.nf +++ b/main.nf @@ -19,9 +19,7 @@ date = new Date().format( 'yyyyMMdd' ) params.out = "concordance-${date}" params.debug = false params.help = false -//params.info_sheet = "(required)" params.species == "c_elegans" -params.R_libpath = "/projects/b1059/software/R_lib_3.6.0" // Debug @@ -95,16 +93,18 @@ workflow { vcf_index = Channel.fromPath("${params.vcf}.tbi") // make sure the index format is consistent in process inputs bam_coverage = Channel.fromPath("${params.bam_coverage}") + hard_filtered_vcf.combine(vcf_index) | (calculate_gtcheck) -if (params.species == "c_elegans") { +// moved npr1 allele check to alignment +// if (params.species == "c_elegans") { - hard_filtered_vcf.combine(vcf_index) | (calculate_gtcheck & npr1_allele_check) +// hard_filtered_vcf.combine(vcf_index) | (calculate_gtcheck & npr1_allele_check) -} else { +// } else { - hard_filtered_vcf.combine(vcf_index) | (calculate_gtcheck) +// hard_filtered_vcf.combine(vcf_index) | (calculate_gtcheck) -} +// } calculate_gtcheck.out.combine(bam_coverage) @@ -137,10 +137,7 @@ process get_species_sheet { file("*.tsv") """ - # add R_libpath to .libPaths() into the R script, create a copy into the NF working directory - echo ".libPaths(c(\\"${params.R_libpath}\\", .libPaths() ))" | cat - ${workflow.projectDir}/bin/download_google_sheet.R > download_google_sheet.R - - Rscript --vanilla download_google_sheet.R ${params.species} + Rscript --vanilla ${workflow.projectDir}/bin/download_google_sheet.R ${params.species} """ @@ -184,11 +181,8 @@ process process_concordance_results { file("problem_strains.tsv") """ - # add R_libpath to .libPaths() into the R script, create a copy into the NF working directory - echo ".libPaths(c(\\"${params.R_libpath}\\", .libPaths() ))" | cat - ${workflow.projectDir}/bin/process_concordance.R > process_concordance.R - # Run concordance analysis - Rscript --vanilla process_concordance.R SM_coverage.tsv WI_info_sheet.tsv ${params.concordance_cutoff} + Rscript --vanilla ${workflow.projectDir}/bin/process_concordance.R SM_coverage.tsv WI_info_sheet.tsv ${params.concordance_cutoff} """ } @@ -228,10 +222,8 @@ process within_group_pairwise { isotype = pair_group[2] """ - echo ".libPaths(c(\\"${params.R_libpath}\\", .libPaths() ))" | cat - ${workflow.projectDir}/bin/plot_pairwise.R > plot_pairwise.R - bcftools query -f '%CHROM\t%POS[\t%GT]\n' -s ${pair} concordance.vcf.gz > out.tsv - Rscript --vanilla plot_pairwise.R ${pair} ${group} ${isotype} + Rscript --vanilla ${workflow.projectDir}/bin/plot_pairwise.R ${pair} ${group} ${isotype} """ } @@ -327,32 +319,32 @@ process between_group_pairwise { sp2 = pair_group[1] """ - echo ".libPaths(c(\\"${params.R_libpath}\\", .libPaths() ))" | cat - ${workflow.projectDir}/bin/process_strain_pairwise.R > process_strain_pairwise.R csvtk cut -t -f CHROM,POS,${sp1},${sp2} out_gt.tsv > ${sp1}-${sp2}.queried.tsv - Rscript --vanilla process_strain_pairwise.R ${sp1} ${sp2} ${sp1}-${sp2}.queried.tsv + Rscript --vanilla ${workflow.projectDir}/bin/process_strain_pairwise.R ${sp1} ${sp2} ${sp1}-${sp2}.queried.tsv mv condition_results.tsv ${sp1}-${sp2}.tsv mv for_distribution.tsv ${sp1}-${sp2}-distribution.tsv rm ${sp1}-${sp2}.queried.tsv """ } -process npr1_allele_check { +// Moved this process to alignment now +// process npr1_allele_check { - cpus params.cores +// cpus params.cores - publishDir "${params.out}/concordance", mode: 'copy', overwrite: true +// publishDir "${params.out}/concordance", mode: 'copy', overwrite: true - input: - tuple file("concordance.vcf.gz"), file("concordance.vcf.gz.tbi") //from npr1_allele +// input: +// tuple file("concordance.vcf.gz"), file("concordance.vcf.gz.tbi") //from npr1_allele - output: - file("npr1_allele_strain.tsv") //into npr1_out +// output: +// file("npr1_allele_strain.tsv") //into npr1_out - """ - echo -e 'problematic_strain\\tgt' > npr1_allele_strain.tsv - bcftools view --threads ${params.cores} -t X:4768788 concordance.vcf.gz | bcftools query -f '[%SAMPLE\\t%GT\\n]' | awk '\$2 != "1/1"' >> npr1_allele_strain.tsv - """ -} +// """ +// echo -e 'problematic_strain\\tgt' > npr1_allele_strain.tsv +// bcftools view --threads ${params.cores} -t X:4768788 concordance.vcf.gz | bcftools query -f '[%SAMPLE\\t%GT\\n]' | awk '\$2 != "1/1"' >> npr1_allele_strain.tsv +// """ +// } process merge_betweengroup_pairwise_output { @@ -402,8 +394,7 @@ process combine_pairwise_results { file("new_isotype_groups.tsv") """ - echo ".libPaths(c(\\"${params.R_libpath}\\", .libPaths() ))" | cat - ${workflow.projectDir}/bin/merge_groups_info.R > merge_groups_info.R - Rscript --vanilla merge_groups_info.R isotype_groups.tsv merge_betweengroup_pairwise_output.tsv npr1_allele_strain.tsv + Rscript --vanilla ${workflow.projectDir}/bin/merge_groups_info.R isotype_groups.tsv merge_betweengroup_pairwise_output.tsv npr1_allele_strain.tsv """ } diff --git a/nextflow.config b/nextflow.config index a23b973..5cc839e 100644 --- a/nextflow.config +++ b/nextflow.config @@ -63,3 +63,14 @@ dag { file = "${params.tracedir}/${params.timestamp}_dag.svg" } +singularity { + + enabled = true + autoMounts = true + + cacheDir = "/projects/b1059/singularity" + pullTimeout = '20 min' +} + +process.container = 'andersenlab/concordance' +