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

how to index bam files after sorting by reads name ? #612

Open
wu123tj opened this issue Jan 8, 2024 · 1 comment
Open

how to index bam files after sorting by reads name ? #612

wu123tj opened this issue Jan 8, 2024 · 1 comment

Comments

@wu123tj
Copy link

wu123tj commented Jan 8, 2024

hi,nservant:
i met an error when running mergeSAM.py as follows:
/share/nas1/xiazb/02.soft/conda/conda3/envs/hicpro/bin/python /share/nas1/xiazb/02.soft/HiC-Pro/HiC-Pro_3.1.0/scripts/mergeSAM.py -q 10 -t -v -f bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.bam -r bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.bam -o bowtie_results/bwt2/rename/BM089_BM089.bwt2pairs.bam
[E::idx_find_and_load] Could not retrieve index file for 'bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.bam'
[E::idx_find_and_load] Could not retrieve index file for 'bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.bam'

mergeBAM.py

forward= bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.bam

reverse= bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.bam

output= bowtie_results/bwt2/rename/BM089_BM089.bwt2pairs.bam

min mapq= 10

report_single= False

report_multi= False

verbose= True

Merging forward and reverse tags ...

Forward and reverse reads not paired. Check that BAM files have the same read names and are sorted.

the BM089_R1_BM089.bwt2merged.bam was sorted successly :

/share/nas1/xiazb/02.soft/cactus-bin-v2.5.0/bin/samtools sort -@ 10 -m 1000M -n -T tmp/BM089_R1_BM089 -o bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.sorted.bam bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.bam
/share/nas1/xiazb/02.soft/cactus-bin-v2.5.0/bin/samtools sort -@ 10 -m 1000M -n -T tmp/BM089_R2_BM089 -o bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.sorted.bam bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.bam
[bam_sort_core] merging from 160 files and 10 in-memory blocks...
[bam_sort_core] merging from 160 files and 10 in-memory blocks...
mv bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.sorted.bam bowtie_results/bwt2/rename/BM089_R1_BM089.bwt2merged.bam
mv bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.sorted.bam bowtie_results/bwt2/rename/BM089_R2_BM089.bwt2merged.bam

when checking the command samtools sort -n , it shows than sorting by read name is not compatible with samtools index command

how to index bam files after sorting by reads name , sence mergeSAM.py requires an index file ?

@nservant
Copy link
Owner

Hi,
mergeSAM.py requires the reads to be in the same order.
I do not think the index is mandatory here
N

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

2 participants