The logging file for snakemake
1
0
Entering edit mode
5.9 years ago
wangdp123 ▴ 340

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:

  1. What is the function of the symbol "&" before ">"?
  2. What do the number "1" and "2" mean? especially what does this mean (2>&1 >>)?

Many thanks,

Regards,

Tom

snakemake log • 4.1k views
ADD COMMENT
2
Entering edit mode
5.9 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 2176 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6