0

I would like to change the folder names and the names of the read files. From here I found something similar (Move and rename files from multiple folders using snakemake):

workdir: "/path/to/workdir/"

import pandas as pd
from io import StringIO

sample_file = StringIO("""fastq sampleID
BOB_1234/fastq/BOB_1234.R1.fastq.gz TAG_1/fastq/TAG_1.R1.fastq.gz
BOB_1234/fastq/BOB_1234.R2.fastq.gz TAG_1/fastq/TAG_1.R2.fastq.gz
BOB_3421/fastq/BOB_3421.R1.fastq.gz TAG_2/fastq/TAG_2.R1.fastq.gz
BOB_3421/fastq/BOB_3421.R2.fastq.gz TAG_2/fastq/TAG_2.R2.fastq.gz""")

df = pd.read_table(sample_file, sep="\s+", header=0)
sampleID = df.sampleID
fastq = df.fastq

rule all:
    input:
       expand("{sample}", sample=df.sampleID)

rule move_and_rename_fastqs:
    input: fastq = lambda w: df[df.sampleID == w.sample].fastq.tolist()
    output: "{sample}"
    shell:
        """echo mv {input.fastq} {output}"""

I can an error:

MissingOutputException in line 19 of snakefile:
Job Missing files after 5 seconds:
TAG_1/fastq/TAG_1.R1.fastq.gz
user3224522
  • 1,119
  • 8
  • 19
  • 1
    Your move_and_rename_fastqs is just echoing the mv command, not executing it. Remove the `echo` and try again. You can run snakemake with `-np` to get a dryrun with the commands that will run instead of putting echos in your shell directives – Troy Comi Feb 09 '21 at 15:37
  • How can one be so stupid... :/ thanks a lot... it is working – user3224522 Feb 09 '21 at 16:41

0 Answers0