Skip to content
Snippets Groups Projects
Verified Commit 53877492 authored by Mia Croiset's avatar Mia Croiset
Browse files

ARGS hicstuff align_bowtie2 & fragment_enzyme

parent 88bb01fc
No related branches found
No related tags found
No related merge requests found
...@@ -7,10 +7,22 @@ if __name__ == "__main__": ...@@ -7,10 +7,22 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-e", "--enzyme") parser.add_argument("-e", "--enzyme")
parser.add_argument("-i", "--index") parser.add_argument("-i", "--index")
parser.add_argument("-m", "--min_size")
parser.add_argument("-c", "--circular")
parser.add_argument("-o", "--output_contigs")
parser.add_argument("-f", "--output_frags")
parser.add_argument("-p", "--plot")
parser.add_argument("-g", "--fig_path")
args = parser.parse_args() args = parser.parse_args()
enzyme = args.enzyme enzyme = args.enzyme
index = args.index index = args.index
min_size = args.min_size
circular = args.circular
output_contigs = args.output_contigs
output_frags = args.output_frags
plot = args.plot
fig_path = args.fig_path
#hicstuff case sensitive enzymes adaptation #hicstuff case sensitive enzymes adaptation
...@@ -30,11 +42,11 @@ if __name__ == "__main__": ...@@ -30,11 +42,11 @@ if __name__ == "__main__":
hcd.write_frag_info( hcd.write_frag_info(
index, index,
enzyme, enzyme,
min_size=0, min_size,
circular=False, circular,
output_contigs="info_contigs.txt", output_contigs,
output_frags="fragments_list.txt", output_frags
) )
# Log fragment size distribution # Log fragment size distribution
hcd.frag_len(frags_file_name="fragments_list.txt", plot=False, fig_path="frags_hist.pdf") hcd.frag_len(output_frags, plot=plot, fig_path=fig_path)
process {
//Default
publishDir = [
path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
mode: 'copy',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
withName: 'BOWTIE2_ALIGNMENT' {
ext.prefix = { "${meta.id}_${meta.chunk}_${meta.mates}" }
publishDir = [
path: { "${params.outdir}/hicstuff/reads"},
mode: 'copy'
]
}
withName: 'FRAGMENT_ENZYME' {
publishDir = [
path: { "${params.outdir}/hicstuff/fragment_enzyme" },
mode: 'copy'
]
}
withName: 'BAM2PAIRS' {
publishDir = [
path: { "${params.outdir}/hicstuff/pairs" },
mode: 'copy'
]
}
withName: 'BUILD_MATRIX' {
publishDir = [
path: { "${params.outdir}/hicstuff/matrix" },
mode: 'copy'
]
}
//**********************************************
// PREPARE_GENOME
withName: 'BOWTIE2_BUILD' {
publishDir = [
path: { "${params.outdir}/genome/bowtie2_index" },
mode: 'copy'
]
}
withName: 'CUSTOM_GETCHROMSIZES' {
publishDir = [
path: { "${params.outdir}/genome" },
mode: 'copy'
]
}
withName: 'GET_RESTRICTION_FRAGMENTS' {
publishDir = [
path: { "${params.outdir}/genome" },
mode: 'copy'
]
}
}
params { params {
// Input options // Input options
...@@ -179,7 +118,86 @@ params { ...@@ -179,7 +118,86 @@ params {
max_cpus = 16 max_cpus = 16
max_time = '240.h' max_time = '240.h'
// Hicstuff
hicstuff_bwt2_align_opts = '--very-sensitive-local'
hicstuff_min_size = 0
hicstuff_circular = 'False'
hicstuff_output_contigs = 'info_contigs.txt'
hicstuff_output_frags = 'fragments_list.txt'
hicstuff_frags_plot = 'False'
hicstuff_frags_plot_path = 'frags_hist.pdf'
} }
process {
//Default
publishDir = [
path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
mode: 'copy',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
withName: 'BOWTIE2_ALIGNMENT' {
ext.prefix = { "${meta.id}_${meta.chunk}_${meta.mates}" }
ext.args = params.hicstuff_bwt2_align_opts
publishDir = [
path: { "${params.outdir}/hicstuff/reads"},
mode: 'copy'
]
}
withName: 'FRAGMENT_ENZYME' {
ext.args = { [
" -m ${params.hicstuff_min_size}",
" -c ${params.hicstuff_circular}",
" -o ${params.hicstuff_output_contigs}",
" -f ${params.hicstuff_output_frags}",
" -p ${params.hicstuff_frags_plot}",
" -g ${params.hicstuff_frags_plot_path}"
].join('').trim() }
publishDir = [
path: { "${params.outdir}/hicstuff/fragment_enzyme" },
mode: 'copy'
]
}
withName: 'BAM2PAIRS' {
publishDir = [
path: { "${params.outdir}/hicstuff/pairs" },
mode: 'copy'
]
}
withName: 'BUILD_MATRIX' {
publishDir = [
path: { "${params.outdir}/hicstuff/matrix" },
mode: 'copy'
]
}
//**********************************************
// PREPARE_GENOME
withName: 'BOWTIE2_BUILD' {
publishDir = [
path: { "${params.outdir}/genome/bowtie2_index" },
mode: 'copy'
]
}
withName: 'CUSTOM_GETCHROMSIZES' {
publishDir = [
path: { "${params.outdir}/genome" },
mode: 'copy'
]
}
withName: 'GET_RESTRICTION_FRAGMENTS' {
publishDir = [
path: { "${params.outdir}/genome" },
mode: 'copy'
]
}
}
profiles { profiles {
debug { process.beforeScript = 'echo $HOSTNAME' } debug { process.beforeScript = 'echo $HOSTNAME' }
conda { conda {
......
...@@ -16,13 +16,14 @@ process BOWTIE2_ALIGNMENT { ...@@ -16,13 +16,14 @@ process BOWTIE2_ALIGNMENT {
script: script:
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ''
""" """
INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/\\.rev.1.bt2\$//"` INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/\\.rev.1.bt2\$//"`
[ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed "s/\\.rev.1.bt2l\$//"` [ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed "s/\\.rev.1.bt2l\$//"`
[ -z "\$INDEX" ] && echo "Bowtie2 index files not found" 1>&2 && exit 1 [ -z "\$INDEX" ] && echo "Bowtie2 index files not found" 1>&2 && exit 1
bowtie2 --very-sensitive-local -p $task.cpus -x \$INDEX -U $reads > ${prefix}.tmp bowtie2 $args -p $task.cpus -x \$INDEX -U $reads > ${prefix}.tmp
samtools view -F 2048 -h -@ $task.cpus ${prefix}.tmp | samtools sort -n -@ $task.cpus -o ${prefix}.bam - samtools view -F 2048 -h -@ $task.cpus ${prefix}.tmp | samtools sort -n -@ $task.cpus -o ${prefix}.bam -
""" """
......
...@@ -10,12 +10,15 @@ process FRAGMENT_ENZYME { ...@@ -10,12 +10,15 @@ process FRAGMENT_ENZYME {
tuple val(meta), path(fasta) tuple val(meta), path(fasta)
output: output:
tuple val(meta), path("info_contigs.txt") , emit: info_contigs tuple val(meta), path(params.hicstuff_output_contigs) , emit: info_contigs
tuple val(meta), path("fragments_list.txt"), emit: fragments_list tuple val(meta), path(params.hicstuff_output_frags), emit: fragments_list
script: script:
def args = task.ext.args ?: ''
""" """
hicstuff_fragments.py -e ${digestion} -i ${fasta} hicstuff_fragments.py -e ${digestion} -i ${fasta} ${args}
""" """
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment