I am struggling for creating python script in Linux terminal. I am trying to make command to analyze hundreds of files.
And there is a python program(
ngCGH) which analyze
ngCGH's command is following:
ngCGH -o /mnt/data/A/B/C.txt [normal.bam] [tumor.bam]
.bam files have following naming role
In short, files having matched number should be analyzed.
In addition, I want to make output file name differently like in following way.
Result: 1NT analysis.txt
Result: 2NT analysis.txt
The output files should be txt files having different names.
import os j = 1 files = set(x[2:len(x)-4] for x in os.listdir() if x.endswith('.bam')) for i in files: command = 'ngCGH -o <path>/'+str(j)+'NT analysis.txt '+str(j)+'N'+i+'.bam '+str(j)+'T'+i+'.bam' os.system(command)
<path> with actual path.
Hope this was what you were expecting.