I started to learn Snakemake and here is my first code:
SAM_DIR = "/mnt/c/Code/sam_tiny"
BAM_DIR = "/mnt/c/Code/bam"
SAM_FILES = glob_wildcards(os.path.join(SAM_DIR, "{sample}.sam"))
SAMPLES = [wildcards[0] for wildcards in SAM_FILES]
rule all:
input:
expand(os.path.join(STATS_DIR, "{sample}.txt"), sample=SAM_FILES)
rule sam_to_bam:
input:
os.path.join(SAM_DIR, "{sample}.sam")
output:
os.path.join(BAM_DIR, "{sample}.bam")
shell:
"samtools view -b {input.sam} > {output.bam}"
and, of course, it was not without error.
On running it gives the following error:
MissingInputException in rule sam_to_bam in file /mnt/c/Code/Snakefile.smk, line 16:
Missing input files for rule sam_to_bam:
output: /mnt/c/Code/bam/['ERR024604_tiny', 'ERR024605_tiny', 'ERR024606_tiny', 'ERR024607_tiny', 'ERR024608_tiny', 'ERR024609_tiny'].bam
wildcards: sample=['ERR024604_tiny', 'ERR024605_tiny', 'ERR024606_tiny', 'ERR024607_tiny', 'ERR024608_tiny', 'ERR024609_tiny']
affected files:
/mnt/c/Code/sam_tiny/['ERR024604_tiny', 'ERR024605_tiny', 'ERR024606_tiny', 'ERR024607_tiny', 'ERR024608_tiny', 'ERR024609_tiny'].sam
I have already checked several times the correct path to the SAM files, the correctness of the files themselves, etc., but I can not understand what the problem is. This might be the easiest problem, but since I just started learning this, I need some support. Thanks!