Snakemake expand function
Hello, I have a list of lists such as :
list_ranges=[[0,9],[10,19],[20,29],[30,33]]
How can I used expand in Snakemake in order to create 4 arguments such as :
/user/Temp_dir/Ranges_0-9.tpm
/user/Temp_dir/Ranges_10-19.tpm
/user/Temp_dir/Ranges_20-29.tpm
/user/Temp_dir/Ranges_30-33.tpm
So far I tried ;
expand("/user/Temp_dir/Ranges_{range1}-{range2}.tpm", range1 = [x[0] for x in list_ranges] , range2 = [x[-1] for x in list_ranges]))
The easiest solution here is to use Python:
expanded = [f"/user/Temp_dir/Ranges_{r1}-{r2}.tpm" for r1, r2 in list_ranges]
If you insist on using expand
, then you will want to pass zip
argument:
expand("/user/Temp_dir/Ranges_{r1}-{r2}.tpm", zip, r1 = [x[0] for x in list_ranges] , r2 = [x[-1] for x in list_ranges]))