1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f0a96002a553/ Changeset: f0a96002a553 User: natefoo Date: 2015-01-28 18:36:35+00:00 Summary: Merged in natefoo/galaxy-central/samtools1_bam_index (pull request #651) Allow BAM's set_meta() to use samtools 1 to generate the index, if the samtools found on $PATH is samtools 1. Affected #: 1 file diff -r c8ba5ce3b64af0fa6564744c0e45fc4c4ae1d450 -r f0a96002a5538b1b5e2ebafe8f80a64ed299b418 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -264,10 +264,23 @@ ##$ samtools index ##Usage: samtools index <in.bam> [<out.index>] stderr_name = tempfile.NamedTemporaryFile( prefix = "bam_index_stderr" ).name - command = 'samtools index %s %s' % ( dataset.file_name, index_file.file_name ) - proc = subprocess.Popen( args=command, shell=True, stderr=open( stderr_name, 'wb' ) ) + command = [ 'samtools', 'index', dataset.file_name, index_file.file_name ] + proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) exit_code = proc.wait() #Did index succeed? + if exit_code == -6: + # SIGABRT, most likely samtools 1.0+ which does not accept the index name parameter. + dataset_symlink = os.path.join( os.path.dirname( index_file.file_name ), + '__dataset_%d_%s' % ( dataset.id, os.path.basename( index_file.file_name ) ) ) + os.symlink( dataset.file_name, dataset_symlink ) + try: + command = [ 'samtools', 'index', dataset_symlink ] + exit_code = subprocess.call( args=command, stderr=open( stderr_name, 'wb' ) ) + shutil.move( dataset_symlink + '.bai', index_file.file_name ) + except Exception, e: + open( stderr_name, 'ab+' ).write( 'Galaxy attempted to build the BAM index with samtools 1.0+ but failed: %s\n' % e) + finally: + os.unlink( dataset_symlink ) stderr = open( stderr_name ).read().strip() if stderr: if exit_code != 0: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.