Hi,
I am using the samtools in Galaxy and got exactly the same error as described in the thread above. It is our own local Galaxy server, but the samtools tools are taken as is from the Galaxy production server.


tool_id=sam_to_bam

An error occurred running this job: Error extracting alignments from (/net/bs-gridhome/sw-repo/grid/applications/galaxy_dist/database/files/000/dataset_861.dat), requested number of bytes is more than a Python string can hold

The try/except block throwing this error is:

 try:
# Extract all alignments from the input SAM file to BAM format ( since no region is specified, all the alignments will be extracted ).
        tmp_aligns_file = tempfile.NamedTemporaryFile( dir=tmp_dir )
        tmp_aligns_file_name = tmp_aligns_file.name
        tmp_aligns_file.close()
# IMPORTANT NOTE: for some reason the samtools view command gzips the resulting bam file without warning, # and the docs do not currently state that this occurs ( very bad ). command = samtools_binary_path.SAMTOOLS+' view -bt %s -o %s %s' % ( fai_index_file_path, tmp_aligns_file_name, options.input1 )
        tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name
        tmp_stderr = open( tmp, 'wb' )
proc = subprocess.Popen( args=command, shell=True, cwd=tmp_dir, stderr=tmp_stderr.fileno() )
        returncode = proc.wait()
        tmp_stderr.close()
        # get stderr, allowing for case where it's very large
        tmp_stderr = open( tmp, 'rb' )
        stderr = ''
        buffsize = 1048576000
        try:
            while True:
                stderr += tmp_stderr.read( buffsize )
                if not stderr or len( stderr ) % buffsize != 0:
                    break
        except OverflowError:
            pass
        tmp_stderr.close()
        if returncode != 0:
            raise Exception, stderr
        if len( open( tmp_aligns_file_name ).read() ) == 0:
            raise Exception, 'Initial BAM file empty'
    except Exception, e:
        #clean up temp files
        if os.path.exists( tmp_dir ):
            shutil.rmtree( tmp_dir )
stop_err( 'Noooo, Error extracting alignments from (%s), %s' % ( options.input1, str( e ) ) )
    try:


So could you provide me the fix you applied?


Kind regards,
Manuel
_______________________________________________
galaxy-user mailing list
galaxy-user@lists.bx.psu.edu
http://lists.bx.psu.edu/listinfo/galaxy-user

Reply via email to