I'm not sure this is the right place for this question, but please let me know if it's not.
I'm currently using Snakemake to annotate some genes. I have a config file, in which my fastq filenames are listed. It looks something like this:
Samples:
Sample A:
R1:
SampleA_R1.fq.gz
R2:
SampleA_R2.fq.gz
Sample B:
R1:
SampleB_R1.fq.gz
R2:
SampleB_R2.fq.gz
This is just a simplification of the config file, as it is much longer, but the pattern is the same. Now, I want to concatenate SampleA R1 and SampleA R2 into one fq.gz file. The same goes for Sample B and so forth, if the config was longer. I guess I should be using wildcards, but I'm unsure about how to access the config file and how to use it with wildcards.
Thanks in advance!!
Thanks for your reponse! I haven't really tried anything worth mentioning, as I'm pretty ignorant on the topic. I'll definitely give this a go and look at the link. Will your proposed code also work, if my config is in a different file? I use the:
in the top of the file.
configfile
will populate what's in the yaml intoconfig
. As to whether the code will work, there's only one way to find out.So by this approach, the input doesn't access r1 and r2 of the config does it? It uses the key "a", but I specify in my input that it should end with _r1.txt og _r2.txt. Is there any way to not having to write this? Can I just fetch it directly from the config file? I failed to mention, that in my config file, the R1 and R2 key, also have paths like:
R1: FASTQ/SampleA_R1.fq.gz
I generally dislike specifying the entire file path in config, but you can use a function or
lambda
to read those in. These techniques are all clearly described in the documentation, and I'd seriously recommend you spending some time with it.Function as input files: https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#functions-as-input-files
lambda: https://snakemake.readthedocs.io/en/stable/tutorial/advanced.html (Step 3)
Unless you start sharing you efforts and code in this learning process, I'm afraid I won't be able to help you further.