I have a massive Snakefile. The bits that are likely important are these below. I want to make this a bit more flexible with input files.
in the runini file; if lanenumlanelaeve = 1, I want snakemake to start on rule cutadapt (as samples would have been merged already) with corresponding input files, if not follow what normal flow of rules with those corresponding input files. I know an if else needs to placed. But, I am not seeing how to add this/where. Maybe add something in the configfile?
# config fileconfigfile:'rna.config.yaml# check run.ini file for various thingsrunini = configparser.ConfigParser()runini.read('../Run/ini')ss = runini['File']['SS']rule all: input: completedef fastq(wildcards): names = glob.glob(config['fq_glob'] %wildcards.sampleID) return sorted(names)rule merge: input: fastq output: 'merged_{sampleID}_merged_R1.fastq.gz''merged_{sampleID}_merged_R2.fastq.gz' threads: 8 params: r1 = config['pari_id'][0], r2 = config['pari_id'][1] run: r1 = [x for x in input if params.r1 in x] r2 = [x for x in input if params.r2 in x] shell('cat %s > {output[0]}' %''.join(r1)) shell('cat %s > {output[1]}' %''.join(r2))rule cutadapt: input: rules.merge_fastqs.output output: r1 = 'trimmed/{sampleID}_trimmed_R1.fastq.gz', r2 = 'trimmed/{sampleID}_trimmed_R2.fastq.gz' log: 'multiqc/cutadapt/{sampleID}.cutadapt.log' threads: 16 params: adapter = config['adapter_fa'] run: shell('cutadapt -b {params.adapter} -B {params.adapter} \ --cores={threads} \ --minimum-length=20 \ -q 20 \ -o {output.r1} \ -p {output.r2} \ {input} > {log}')