There are totally 6 bam files. In that:

1,2,3 are one group
4,5,6 are in other group[cfg.tool_cmd("cuffdiff"),
"-p", str(cfg.project["analysis"]["threads"]),
"-b", str(cfg.project["genome"]["fasta"]),
"-u", cfg.project["experiment"]["merged"],
"-L", "%s,%s" % (str(cfg.project["phenotype"][0])[2:8],str(cfg.project["phenotype"][1])[2:7]),
"-o", output_folder] + [cfg.project["samples"][0]["files"]["bam"]] + [cfg.project["samples"][1]["files"]["bam"]]

In this call:

[cfg.project["samples"][0]["files"]["bam"]] should take 1,2,3 (first group) bam files.
[cfg.project["samples"][1]["files"]["bam"]] should take 4,5,6 (Second group) bam files.


[cfg.project["samples"][0]["files"]["bam"]] is taking only 1st bam file
[cfg.project["samples"][1]["files"]["bam"]] also taking only 4th bam file

Can anyone help in this? Thankyou

What is the content and type of cfg.project["samples"][0]["files"]["bam"]? A Tuple/List/Set/Dict? Maybe stepping through a debugger, or even a simple debug-print would help you see what you are getting, or why you're not getting what you think you should.

testdata = cfg.project['samples'][0]['files']
print('Actual files content:')

print('Actual bam content:')

Also, there are a lot of lists being concatenated here, I guess to build up command-line arguments. Command line args are fickle at times, and could possibly be broken by the concatenation (or concatenating in a certain order). I'm reaching here, but it's possible.