Skip to content

Commit

Permalink
merge the master mask bed
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed Mar 27, 2020
1 parent 427b10e commit f974be2
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 26 deletions.
3 changes: 2 additions & 1 deletion docs/process/process_reference_genome.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ ${reference_genome_gb_local.baseName} gbff The locall

**Shell script**::

gunzip -f ${reference_genome_local}
gunzip -f ${reference_genome_fna_local}
gunzip -f ${reference_genome_gb_local}

------------

Expand Down
30 changes: 30 additions & 0 deletions docs/process/process_snippy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,33 @@ ${params.snippy_variant_density}_${workflow.runName}.txt bed)
**Shell script**::

sort -k1,1 -k2,2n ${snippy_subs_bed} | bedtools merge > ${params.snippy_variant_density}_${workflow.runName}.txt


------------

Snippy Merge Mask Bed
------------------------------

Sort and merge regions of high SNP density.

========================================= =========================== ===========================
Input Type Description
========================================= =========================== ===========================
ch_bed_mask_master_merge bed Combined BED files of repeats, low-complexity and (optional) high-density SNP regions.
========================================= =========================== ===========================

========================================= =========================== ===========================
Output Type Description
========================================= =========================== ===========================
ch_bed_mask_snippy_multi bed Master masking BED file for process snippy_multi
========================================= =========================== ===========================

========================================================= =========================== ===========================
Publish Type Description
========================================================= =========================== ===========================
master.bed bed Master masking BED file.
========================================================= =========================== ===========================

**Shell script**::

cat ${bed_mask} | sort -k1,1 -k2,2n | bedtools merge > master.bed
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ params{
skip_snippy_detect_snp_high_density = false
skip_reference_detect_repeats = false
skip_reference_detect_low_complexity = false
skip_snippy_multi = false

// Other to be sorted
max_datasets = 100
Expand Down
92 changes: 67 additions & 25 deletions pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ if (!params.skip_reference_download){
*/

// Other variables and config
tag "$reference_genome_local"
tag "$reference_genome_fna_local"
publishDir "${params.outdir}/reference_genome", mode: 'copy'

// IO and conditional behavior
Expand Down Expand Up @@ -620,49 +620,91 @@ if(!params.skip_snippy_detect_snp_high_density){

}

//------------------------------Multiple Alignment----------------------------//

// --------------------------Merge Filtering BED Files------------------------//

process snippy_multiple{
/*
process snippy_merge_mask_bed{
/*
Input:
ch_():
ch_bed_mask_master_merge (bed): Combined BED files of repeats, low-complexity and (optional) high-density SNP regions.
Output:
ch_ ():
ch_bed_mask_snippy_multi (bed): Master masking BED file for process snippy_multi
Publish:
*/
master.bed (bed): Master masking BED file.
*/
// Other variables and config
tag ""
publishDir
tag "bed_snippy_subs_density"
publishDir "${params.outdir}/snippy_filtering", mode: 'copy'
if (params.skip_snippy_detect_snp_high_density){
ch_bed_ref_detect_repeats
.mix(ch_bed_ref_low_complex)
.collectFile(name: "master_unmerged_skip_snp_density.bed")
.set{ch_bed_mask_master_merge}
}

else{
ch_bed_ref_detect_repeats
.mix(ch_bed_ref_low_complex, ch_snippy_subs_bed_density_multi)
.collectFile(name: "master_unmerged.bed")
.set{ch_bed_mask_master_merge}
}
// IO and conditional behavior
input:
file reference_genome_fna from ch_reference_genome_snippy_multi

file bed_mask from ch_bed_mask_master_merge
output:

file "master.bed" into ch_bed_mask_snippy_multi

// Shell script to execute
script:
"""
# Store a list of all the Snippy output directories in a file
ls -d1 ${params.outdir}/snippy_pairwise/output${params.snippy_ctg_depth}X/* > allDir;
# Save the contents of that file as a variable
allDir=`cat allDir`;
# Perform multiple genome alignment (with custom filtering)
snippy-core \
--ref /mnt/c/Users/ktmea/Projects/Bacterial-Phylogenetics/reference/Yersinia_pestis_CO92_whole_genome.gb \
--prefix raw \
--mask ../mask/master.bed \
--mask-char N \
$allDir 2>&1 | tee snippy-raw.log
cat ${bed_mask} | sort -k1,1 -k2,2n | bedtools merge > master.bed
"""
}


//------------------------------Multiple Alignment----------------------------//

if(!params.skip_snippy_multi){

process snippy_multi{
/*
Input:
ch_():
Output:
ch_ ():
Publish:
*/
// Other variables and config
tag ""
echo true

// IO and conditional behavior
input:
file reference_genome_gb from ch_reference_genome_snippy_multi

output:


// Shell script to execute
script:
"""
echo ${reference_genome_gb}
# Store a list of all the Snippy output directories in a file
ls -d1 ${params.outdir}/snippy_pairwise/output${params.snippy_ctg_depth}X/* > allDir;
# Save the contents of that file as a variable
allDir=`cat allDir`;
echo \$allDir;
"""
}

}

// -------------------------------------------------------------------------- //
// Visualization MultiQC //
// -------------------------------------------------------------------------- //
Expand Down

0 comments on commit f974be2

Please sign in to comment.