Skip to content

samtools #54

@Kkoujin

Description

@Kkoujin

Many thanks to the author's team for developing a user-friendly analytical tool, unfortunately, a difficult problem has arisen during use.
Problem description: I have no problem running a single sample, and I have no problem running 5 samples together, but strangely, when I try to run 18 samples together, I have a problem converting sam to bam in samtools.
Error code:def convert_sam_to_sorted_bam(input_sam_file, num_threads):
    # Open the SAM file in reading mode
    samfile = pysam.AlignmentFile(input_sam_file, "r")
    # Create a BAM file in writing mode
    out_bam_file = input_sam_file.replace('.sam', '.bam', 1)
    bamfile = pysam.AlignmentFile(out_bam_file, "wb", template=samfile)
    # Iterate through the records in the SAM file and write them to the BAM file
    for record in samfile:
        bamfile.write(record)
    # Close the files
    samfile.close()
    bamfile.close()
    # Sort the BAM file
    out_sorted_bam_file = input_sam_file.replace('.sam', '.sorted.sam', 1)
    pysam.sort("-o", out_sorted_bam_file, out_bam_file)
I would appreciate your help in resolving the issue! Thanks again for all your hard work!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions