I think it would be better to loop on samples: start from the first step of sample 1 and proceed through aaaaaall the steps until we've the final files for that sample, then move to another one.
I think it's also easier to parallelize the run, even manually (like: for files in A, for files in B ecc)
solved the issue.
to manually 'parallelize' we can make main_bam_pipeline to accept samplelist as input (as regexp patter), qlogin on different nodes and run with A B C D E and so on.
I think it would be better to loop on samples: start from the first step of sample 1 and proceed through aaaaaall the steps until we've the final files for that sample, then move to another one. I think it's also easier to parallelize the run, even manually (like: for files in A, for files in B ecc)