Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samtools #54

Open
Kkoujin opened this issue Nov 23, 2024 · 0 comments
Open

samtools #54

Kkoujin opened this issue Nov 23, 2024 · 0 comments

Comments

@Kkoujin
Copy link

Kkoujin commented Nov 23, 2024

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!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant