The logging file for snakemake
Hi there,
I am trying to correctly understand how logging system works in snakemake.
In the original tutorial, it states like this:
shell:
"(bwa mem -R '{params.rg}' -t {threads} {input} | "
"samtools view -Sb - > {output}) 2> {log}"
And in other places, I keep seeing something like this:
macs2 callpeak -t {input[0]} \
-c {input[1]} -f BAM -g {config[macs_g]} \
--outdir 04peak -n {wildcards.sample} -q 0.001 &> {log}
wigToBigWig -clip samples/bwig/{wildcards.smp}_min.wig {params.chr} {output.min} 2>&1 >> {output.min}.log
bam2wig.py -i {input.min} -s {params.chr} -o samples/bwig/{wildcards.smp}_min &> {output.min}.log
I just wonder:
- What is the function of the symbol "&" before ">"?
- What do the number "1" and "2" mean? especially what does this mean (2>&1 >>)?
Many thanks,
Regards,
Tom
• 4,711 views
•
link
1 answer
http://www.tldp.org/LDP/abs/html/io-redirection.html
&>filename
# Redirect both stdout and stderr to file "filename."
# This operator is now functional, as of Bash 4, final release.
M>&N
# "M" is a file descriptor, which defaults to 1, if not set.
# "N" is another file descriptor.
2>&1
# Redirects stderr to stdout.
# Error messages get sent to same place as standard output.
>>filename 2>&1
bad_command >>filename 2>&1
# Appends both stdout and stderr to the file "filename" ...
2>&1 | [command(s)]
bad_command 2>&1 | awk '{print $5}' # found
# Sends stderr through a pipe.
# |& was added to Bash 4 as an abbreviation for 2>&1 |.
https://unix.stackexchange.com/questions/99263/what-does-21-in-this-command-mean
• 1 views
•
link
Log in to answer this question.