You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!!
The text was updated successfully, but these errors were encountered:
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!!
The text was updated successfully, but these errors were encountered: