Some code taken from: Snakemake - How do I use each line of a file as an input?
def read_tissues_output(): with open('accessions.txt') as f: samples = [sample for sample in f.read().split('\n') if len(sample) > 0] # we dont want empty lines return expand("{sample}.txt", sample=samples)rule all: input: read_tissues_output()rule create_directory: output:"{n}/{n}.txt" shell:""" echo this is a {wildcards.n} > {output}"""
accessions.txt is a txt file with different accession numbers per line. I want to generate a new directory of the same name as the text file being generated, and move the text file generated in that directory.
When the output is output:"{n}.txt", each text file is being generated at the same directory of the Snakefile, which is good. but when I do as above, the expected result is the .txt file of different accession number is moved a folder of its own name, but instead I get an error saying:
"Missing input files for rule all:affected files:SRRXXXXX.txt"
not sure why this is the case.