Hello,
I am trying to perform binning with metabat2 but it is showing error ' the order of contigs in abundance file is not the same as the assembly file: k141_5762'.
I first sorted my BAM file (base) pbaranw@enggpz1p23:~/parul/output$ samtools sort mapped.bam -o sorted.bam
I checked if BAM files is sorted (base) pbaranw@enggpz1p23:~/parul/output$ samtools view -H sorted.bam
@HD VN:1.4 SO:coordinate
*I generated the depth file* (base) pbaranw@enggpz1p23:~/parul/output$ jgi_summarize_bam_contig_depths --outputDepth depth.txt sorted.bam Output depth matrix to depth.txt jgi_summarize_bam_contig_depths v2.15-6-g8b5702b 2021-10-17T15:10:38 Output matrix to depth.txt 0: Opening bam: sorted.bam Processing bam files WARNING: your aligner reports an incorrect NM field. You should run samtools calmd! nm < ins + del: cmatch=0 nm=2 ( insert=0 + del=60 + mismatch=2 == 62) A00405:433:HHYFCDSX2:3:1176:5321:1376 1:N:0:ACGATCAG+ACGGAACA Thread 0 finished: sorted.bam with 15775901 reads and 14529494 readsWellMapped Creating depth matrix file: depth.txt Closing most bam files Closing last bam file Finished
The codes for metabat2 I ran is: (base) pbaranw@enggpz1p23:~/parul/output$ metabat2 -i final.contigs.fa -a depth.txt -o bins
MetaBAT 2 (v2.15-6-g8b5702b) using minContig 2500, minCV 1.0, minCVSum 1.0, maxP 95%, minS 60, maxEdges 200 and minClsSize 200000. with random seed=1643665071 [Error!] the order of contigs in abundance file is not the same as the assembly file: k141_5762
Please any help. Thank you so much
Thank you for quick reply.
I tried running this command but still error is showing
jgi_summarize_bam_contig_depths --outputDepth depth.txt --referenceFasta final.contigs.fa sorted.bam
I get following result:
Output depth matrix to depth.txt Reference fasta file final.contigs.fa jgi_summarize_bam_contig_depths v2.15-6-g8b5702b 2021-10-17T15:10:38 Output matrix to depth.txt Reading reference fasta file: final.contigs.fa ... 6008 sequences 0: Opening bam: sorted.bam Error: referenceFile: final.contigs.fa contig 0 is not the same as in the bam headers (bam reports k141_502 flag=1 multi=2.0000 len=306 with 306 len, reference loaded k141_4762 with 313 len)!
I created the BAM file with following code. should I use referenceFasta as g1_trimmed.fastq
bbmap.sh in= g1_trimmed.fastq out=mapped.bam
You need to map the reads to the same assembly file that will later be used by
jgi_summarize_bam_contig_depths
:Next steps are to sort the files (
samtools sort mapped.bam -o sorted.bam
) and repeat the commands for depth file creation and metabat2.Thank you so much. It worked for me. However, three bins are created. As I am working with one sample (i.e forward and reverse read of one pure bacterial culture), I should get only one bin (Please correct me if I am wrong). Does creation of 3 bins shows the sign of contamination.
Any help appreciated.
Don't know why you were even binning the contigs coming from a single-species assembly, but apparently that is something worth doing.
Yes, you should get a single bin, with some caveats:
Thank you so much for your explanation.