Commit af80020a authored by Blaise Li's avatar Blaise Li
Browse files

Tweaking usage of niceload.

parent bff9d3a7
......@@ -126,7 +126,7 @@ samtools view -H ${bam} \
compute_coverage()
{
cmd="niceload --mem 500M bedtools genomecov -bg -split ${orient_filter} ${scaling} -ibam ${bam}"
cmd="niceload --noswap -q bedtools genomecov -bg -split ${orient_filter} ${scaling} -ibam ${bam}"
eval ${cmd} \
| mawk '{ print $1"\t"$2"\t"$3"\tid-"NR"\t"$4; }' | sort-bed - \
|| error_exit "compute_coverage failed"
......@@ -135,7 +135,7 @@ compute_coverage()
make_bins()
{
cmd="niceload --mem 500M bedmap --faster --echo --mean --delim \"\t\" --skip-unmapped ${bin_file} -"
cmd="niceload --noswap -q bedmap --faster --echo --mean --delim \"\t\" --skip-unmapped ${bin_file} -"
eval ${cmd} || error_exit "make_bins failed"
#eval ${cmd} || cleanup && error_exit "make_bins failed"
}
......@@ -145,7 +145,7 @@ compute_coverage | make_bins \
#> ${bedgraph} || cleanup && error_exit "generating bedgraph failed"
echo "making bigwig"
niceload --mem 500M bedGraphToBigWig ${bedgraph} ${genome_file} ${bigwig} || error_exit "bedGraphToBigWig failed"
niceload --noswap -q bedGraphToBigWig ${bedgraph} ${genome_file} ${bigwig} || error_exit "bedGraphToBigWig failed"
#bedGraphToBigWig ${bedgraph} ${genome_file} ${bigwig} || cleanup && error_exit "bedGraphToBigWig failed"
echo "removing ${bedgraph}"
......
......@@ -63,7 +63,7 @@ trim_random_nt()
{{
# $1: nb of bases to trim at 5' end
# $2: nb of bases to trim at 3' end
niceload --mem 500M cutadapt -u ${{1}} -u -${{2}} - 2> /dev/null || error_exit "trim_random_nt failed"
niceload --noswap -q cutadapt -u ${{1}} -u -${{2}} - 2> /dev/null || error_exit "trim_random_nt failed"
}}
compute_size_distribution()
......
......@@ -88,9 +88,13 @@ mkdir -p ${output_dir}
echo ${cmd} > ${log_base}.log
# https://unix.stackexchange.com/a/245610/55127
# https://stackoverflow.com/a/692407/1878788
eval "niceload --mem 500M ${cmd}" > >(tee -a ${log_base}.log) 2> >(tee -a ${log_base}.err >&2) || error_exit "${cmd} failed, see ${log_base}.err"
# Migh make things too slow?
#eval "niceload --mem 500M ${cmd}" > >(tee -a ${log_base}.log) 2> >(tee -a ${log_base}.err >&2) || error_exit "${cmd} failed, see ${log_base}.err"
eval ${cmd} > >(tee -a ${log_base}.log) 2> >(tee -a ${log_base}.err >&2) || error_exit "${cmd} failed, see ${log_base}.err"
end_day=$(date +"%Y-%m-%d")
echo -e "This run started on ${start_day}.\nIf you want to find all older output, you can run the following command:\n${find_older_output}\n(Use -delete instead of -print to remove those files (do this only in case of full output update).)" 1>&2
#echo -e "This run started on ${start_day}.\nIf you want to find all older output, you can run the following command:\n${find_older_output}\n(Use -delete instead of -print to remove those files (do this only in case of full output update).)" 1>&2
echo -e "This run started on ${start_day} and ended on ${end_day}.\n" 1>&2
exit 0
......@@ -1159,7 +1159,7 @@ rule feature_count_reads:
shell:
"""
tmpdir=$(TMPDIR=/var/tmp mktemp --tmpdir -d "feature_{wildcards.lib}_{wildcards.rep}_{wildcards.read_type}_{wildcards.mapping_type}_{wildcards.biotype}_{wildcards.orientation}_{wildcards.feature_type}.XXXXXXXXXX")
cmd="niceload --mem 500M featureCounts {params.min_mapq} -a {params.annot} -o {output.counts} -t {wildcards.feature_type} -g "gene_id" -O -s {params.stranded} --fracOverlap 1 --tmpDir ${{tmpdir}} {input}"
cmd="niceload --noswap -q featureCounts {params.min_mapq} -a {params.annot} -o {output.counts} -t {wildcards.feature_type} -g "gene_id" -O -s {params.stranded} --fracOverlap 1 --tmpDir ${{tmpdir}} {input}"
featureCounts -v 2> {log.log}
echo ${{cmd}} 1>> {log.log}
eval ${{cmd}} 1>> {log.log} 2> {log.err} || error_exit "featureCounts failed"
......@@ -1458,7 +1458,7 @@ rule small_RNA_seq_annotate:
mem_mb=19150
shell:
"""
niceload --mem 500M small_RNA_seq_annotate.py -p {threads} -b {input.sorted_bam} -g {input.merged_gtf} \\
niceload --noswap -q small_RNA_seq_annotate.py -p {threads} -b {input.sorted_bam} -g {input.merged_gtf} \\
-r {params.reads_out_dir} -o {params.counts_out_dir} -l {log.mapped_log}
"""
......@@ -1509,7 +1509,7 @@ rule small_RNA_seq_annotate_U:
mem_mb=14700
shell:
"""
niceload --mem 500M small_RNA_seq_annotate.py -p {threads} -b {input.sorted_bam} -u -g {input.merged_gtf} \\
niceload --noswap -q small_RNA_seq_annotate.py -p {threads} -b {input.sorted_bam} -u -g {input.merged_gtf} \\
-r {params.reads_out_dir} -o {params.counts_out_dir} -l {log.mapped_log}
"""
......@@ -2657,7 +2657,7 @@ your deepTools settings and check your input files.
#"""
try:
shell("""
cmd="niceload --mem 500M bamCoverage -b {input.bam} --skipNAs {params.orient_filter} \\
cmd="niceload --noswap -q bamCoverage -b {input.bam} --skipNAs {params.orient_filter} \\
-of=bigwig -bs 10 -p={threads} \\
-o {output.bigwig} \\
1>> {log.log} 2>> {log.err}"
......@@ -2722,7 +2722,7 @@ bam2bigwig.sh: bedGraphToBigWig failed
"""
try:
shell("""
niceload --mem 500M bam2bigwig.sh {input.bam} {params.genome_binned} \\
niceload --noswap -q bam2bigwig.sh {input.bam} {params.genome_binned} \\
{wildcards.lib}_{wildcards.rep} {wildcards.orientation} F \\
%f {output.bigwig_norm} \\
> {log.log} 2> {log.err} \\
......@@ -3417,7 +3417,7 @@ rule plot_biotype_mean_meta_profile:
shell:
"""
tmpdir=$(TMPDIR=/var/tmp mktemp --tmpdir -d "plot_meta_profile_meta_scale_{wildcards.meta_scale}_{wildcards.read_type}_by_{wildcards.norm}_{wildcards.orientation}_{wildcards.type_set}_{wildcards.biotype}_{wildcards.min_len}_{wildcards.group_type}_{wildcards.lib_group}.XXXXXXXXXX")
niceload --mem 500M computeMatrix scale-regions -S {input.bws} \\
niceload --noswap -q computeMatrix scale-regions -S {input.bws} \\
-R {input.bed} \\
{params.meta_params} \\
-p {threads} \\
......@@ -3432,7 +3432,7 @@ rule plot_biotype_mean_meta_profile:
--perGroup \\
--labelRotation 90"
echo ${{cmd}} 1>> {log.log} \\
niceload --mem 500M eval ${{cmd}} \\
niceload --noswap -q eval ${{cmd}} \\
1>> {log.log} \\
2>> {log.err} \\
|| error_exit "plotProfile failed"
......@@ -3467,7 +3467,7 @@ rule plot_gene_list_mean_meta_profile:
shell:
"""
tmpdir=$(TMPDIR=/var/tmp mktemp --tmpdir -d "plot_meta_profile_meta_scale_{wildcards.meta_scale}_{wildcards.read_type}_by_{wildcards.norm}_{wildcards.orientation}_{wildcards.type_set}_{wildcards.id_list}_{wildcards.group_type}_{wildcards.lib_group}.XXXXXXXXXX")
niceload --mem 500M computeMatrix scale-regions -S {input.bws} \\
niceload --noswap -q computeMatrix scale-regions -S {input.bws} \\
-R {input.bed} \\
{params.meta_params} \\
-p 1 \\
......@@ -3481,7 +3481,7 @@ rule plot_gene_list_mean_meta_profile:
--samplesLabel {params.labels} \\
--perGroup"
echo ${{cmd}} 1>> {log.log}
niceload --mem 500M eval ${{cmd}} \\
niceload --noswap -q eval ${{cmd}} \\
1>> {log.log} \\
2>> {log.err} \\
|| error_exit "plotProfile failed"
......@@ -3579,7 +3579,7 @@ rule plot_pi_targets_profile:
shell("""
tmpdir=$(TMPDIR=/var/tmp mktemp --tmpdir -d "plot_pi_targets_profile_{wildcards.lib}_{wildcards.rep}_{wildcards.read_type}_by_{wildcards.norm}_{wildcards.orientation}_{wildcards.biotype}.XXXXXXXXXX")
# 501 and 21 are multiples of 3
niceload --mem 500M computeMatrix scale-regions -S {input.bigwig} \\
niceload --noswap -q computeMatrix scale-regions -S {input.bigwig} \\
-R {input.bed} \\
-bs 3 \\
-b 1002 \\
......@@ -3595,7 +3595,7 @@ cmd="plotProfile -m ${{tmpdir}}/meta_profile.gz -out {output.figure} \\
--startLabel \\'\\' \\
--endLabel \\'\\'"
echo ${{cmd}} 1>> {log.log}
niceload --mem 500M eval ${{cmd}} \\
niceload --noswap -q eval ${{cmd}} \\
1>> {log.log} \\
2>> {log.err} \\
|| error_exit "plotProfile failed"
......
......@@ -4,19 +4,19 @@ def mapping_command(aligner):
"""This function returns the shell commands to run given the *aligner*."""
if aligner == "hisat2":
shell_commands = """
cmd="niceload --mem 500M hisat2 -p {snakemake.threads} --dta --seed 123 -t {snakemake.params.settings} --mm -x {snakemake.params.index} -U {snakemake.input.fastq} --no-unal --un-gz {snakemake.output.nomap_fastq} -S {snakemake.output.sam}"
cmd="niceload --noswap -q hisat2 -p {snakemake.threads} --dta --seed 123 -t {snakemake.params.settings} --mm -x {snakemake.params.index} -U {snakemake.input.fastq} --no-unal --un-gz {snakemake.output.nomap_fastq} -S {snakemake.output.sam}"
echo ${{cmd}} 1> {snakemake.log.log}
eval ${{cmd}} 1>> {snakemake.log.log} 2> {snakemake.log.err}
"""
elif aligner == "bowtie2":
shell_commands = """
cmd="niceload --mem 500M bowtie2 -p {snakemake.threads} --seed 123 -t {snakemake.params.settings} --mm -x {snakemake.params.index} -U {snakemake.input.fastq} --no-unal --un-gz {snakemake.output.nomap_fastq} -S {snakemake.output.sam}"
cmd="niceload --noswap -q bowtie2 -p {snakemake.threads} --seed 123 -t {snakemake.params.settings} --mm -x {snakemake.params.index} -U {snakemake.input.fastq} --no-unal --un-gz {snakemake.output.nomap_fastq} -S {snakemake.output.sam}"
echo ${{cmd}} > {snakemake.log.log}
eval ${{cmd}} 1>> {snakemake.log.log} 2> {snakemake.log.err}
"""
elif aligner == "crac":
shell_commands = """
cmd="niceload --mem 500M crac --nb-threads {snakemake.threads} --summary %s --all %s {snakemake.params.settings} -i {snakemake.params.index} -r {snakemake.input.fastq} --sam {snakemake.output.sam}"
cmd="niceload --noswap -q crac --nb-threads {snakemake.threads} --summary %s --all %s {snakemake.params.settings} -i {snakemake.params.index} -r {snakemake.input.fastq} --sam {snakemake.output.sam}"
echo ${{cmd}} > {snakemake.log.log}
eval ${{cmd}} 1>> {snakemake.log.log} 2> {snakemake.log.err}
# TODO: extract non mappers from the sam output
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment