From 3739682bef0adddf342f29d3b44fb07951aec53b Mon Sep 17 00:00:00 2001 From: depristo Date: Fri, 24 Apr 2009 19:15:55 +0000 Subject: [PATCH] Actually has working version of the python script to merge multiple bam files git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@530 348d0f76-0448-11de-a6fe-93d51630548a --- python/MergeBAMBatch.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python/MergeBAMBatch.py b/python/MergeBAMBatch.py index b8535f3d7..20bcb3a8d 100755 --- a/python/MergeBAMBatch.py +++ b/python/MergeBAMBatch.py @@ -36,18 +36,15 @@ if __name__ == "__main__": if ( s <> [] and s[0] <> '#' ): merged_filename = s[0] output = os.path.join(directory, merged_filename + '.stdout') - current_link = os.path.join(directory, merged_filename + bam_ext) - stamped_filename = os.path.join(directory, merged_filename + '_' + time_stamp + bam_ext) + output_filename = os.path.join(directory, merged_filename + bam_ext) + output_index = output_filename + ".bai" sources = reduce( operator.__add__, map( glob.glob, s[1:] ), [] ) - if OPTIONS.ignoreExistingFiles or not os.path.exists(stamped_filename): - cmd = 'java -Xmx4096m -jar ' + MERGE_BIN + ' AS=true O=' + stamped_filename + ' VALIDATION_STRINGENCY=SILENT ' + ' I=' + (' I='.join(sources)) + if OPTIONS.ignoreExistingFiles or not os.path.exists(output_filename): + cmd = 'java -Xmx4096m -jar ' + MERGE_BIN + ' AS=true O=' + output_filename + ' VALIDATION_STRINGENCY=SILENT ' + ' I=' + (' I='.join(sources)) print cmd farm_commands.cmd(cmd, OPTIONS.farm_sub, output) - - if OPTIONS.ignoreExistingFiles or not os.path.lexists(current_link): - print 'os.path.exists(current_link)', os.path.exists(current_link) - cmd = 'ln -s ' + stamped_filename + " " + current_link - farm_commands.cmd(cmd, False, '') - ValidateGATK.indexBAM(current_link) + + if OPTIONS.ignoreExistingFiles or not os.path.exists(output_index): + ValidateGATK.indexBAM(output_filename)