snakemake_examples/exercise0/Snakefile @ b4041cdc
| b4041cdc | c.toffano-nioche | samples=["P01325", "P01308"]
  | 
      |
| 1e5111ea | chloe.quignot | ||
rule targets:
  | 
      |||
    input:
  | 
      |||
        expand("fasta/{sample}.fasta", sample=samples),
  | 
      |||
        "fusionFasta/allSequences.fasta",
  | 
      |||
        "mafft/mafft_res.fasta",
  | 
      |||
rule loadData:
  | 
      |||
    output:
  | 
      |||
        "fasta/{sample}.fasta",
  | 
      |||
    log:
  | 
      |||
        stdout = "logs/{sample}_wget.stdout",
  | 
      |||
        stderr = "logs/{sample}_wget.stderr",
  | 
      |||
    params:
  | 
      |||
        dirFasta = "fasta",
  | 
      |||
    threads: 1 
  | 
      |||
    shell:
  | 
      |||
        """
  | 
      |||
          wget --output-file {log.stderr} \
  | 
      |||
               --directory-prefix {params.dirFasta} \
  | 
      |||
               https://www.uniprot.org/uniprot/{wildcards.sample}.fasta > {log.stdout}
  | 
      |||
        """
  | 
      |||
rule fusionFasta:
  | 
      |||
    input:
  | 
      |||
        expand("fasta/{sample}.fasta", sample=samples),
  | 
      |||
    output:
  | 
      |||
        "fusionFasta/allSequences.fasta",
  | 
      |||
    log:
  | 
      |||
        "logs/fusionData.stderr",
  | 
      |||
    threads: 1
  | 
      |||
    shell:
  | 
      |||
        """
  | 
      |||
            cat {input} > {output} 2> {log}
  | 
      |||
        """
  | 
      |||
rule mafft:
  | 
      |||
    input: 
  | 
      |||
        rules.fusionFasta.output,
  | 
      |||
    output:
  | 
      |||
        "mafft/mafft_res.fasta",
  | 
      |||
    log:
  | 
      |||
        "logs/whichMafft.txt",
  | 
      |||
    threads: 1
  | 
      |||
    shell:
  | 
      |||
        """
  | 
      |||
            mafft {input} > {output} 2> {log}
  | 
      |||
        """
  |