rule download_samples:
	output: "DATA/single/{sample}/{sample}.sra"
	log: "00_logs/{sample}_download_data.log"
	resources:
		mem_mb = 1024 * 16, # Last number is memory in GB
		time = 60 * 24 * 1, # Last number is days
		#account = "publicgrp", # Placeholder for SLURM submission
		#partition = "high", # Placeholder for SLURM submission
	shell: "prefetch {wildcards.sample} -O 'DATA/single/' 2> '{log}'"
	
rule sra_to_fastq:
	input: "DATA/single/{sample}/{sample}.sra"
	output: "DATA/single/{sample}.fastq.gz"
	log: "00_logs/{sample}_sra_to_fastq.log"
	resources:
		mem_mb = 1024 * 16, # Last number is memory in GB
		time = 60 * 24 * 3, # Last number is days
		#account = "publicgrp", # Placeholder for SLURM submission
		#partition = "high", # Placeholder for SLURM submission
	shell: """
	fasterq-dump '{input}' --outdir 'DATA/single/' 2> '{log}'
	gzip 'DATA/single/{wildcards.sample}.fastq'
	"""

rule link_reads:
	input: "DATA/single/{sample}.fastq.gz"
	output: "01_raw_data/{sample}.fastq.gz"
	log: "00_logs/{sample}_link_reads.log"
	resources:
		mem_mb = 1024 * 5, # Last number is memory in GB
		time = 60 * 24 * 1, # Last number is days
		#account = "publicgrp", # Placeholder for SLURM submission
		#partition = "high", # Placeholder for SLURM submission
	shell: "ln -sf '{input}' '{output}'"
		
