Nextomics / NextPolish

Fast and accurately polish the genome generated by long reads.
GNU General Public License v3.0
205 stars 28 forks source link

Ignore the secondary alignment #116

Open lilinzhou opened 1 year ago

lilinzhou commented 1 year ago

Hi, Jiang I modified the parameters of the minimap2 (add --secondary=no to prevent possible wrong alignments). But there was an error in nextpolish step which showed "python3: ctg_cns.c:2787: find_sup_alns: Assertion `i != sup_aln->i' failed.". The strange thing is that nextpolish doesn't stop running, but it doesn't produce new results either. How can I avoid this?

The version I used is NextPolish v1.4.1, Python 3.9.6.

Best Charlie

moold commented 1 year ago

Did you successfully complete NextPolish without setting --secondary=no?

lilinzhou commented 1 year ago

I am sorry, I forgot to mention that I also modified the main script nextPolish to filter out some alignments with low mapping quality and supplementary alignments ( the FLAG for this kind of alignments is "2048") (detailed changed see below) apart from adding secondary=no in the config file. I reran nextpolish without making any changes to the main script by adding secondary=no to the config file only, and it ran successfully. This indicates the error may happen during the alignment filtering step. I was wondering whether these changes will cause the above errors.

This is what I changed.

diff nextPolish nextPolish_filter_bam 203c203 before SCRIPT_PATH + '/bin/samtools view --threads 5 -F 0x4 -b - |' after SCRIPT_PATH + '/bin/samtools view -q 30 --threads 5 -F 0x4 -b - |' 210,211c210,211 before genomefile + ' ' + LGS_READS + '|' + SCRIPT_PATH + '/bin/samtools view --threads 5 -F 0x4 -b - |' + SCRIPT_PATH + \ '/bin/samtools sort - -m 2g --threads ' + THREADS + ' -o lgs.part%03d.sort.bam\n'

after genomefile + ' ' + LGS_READS + '|' + SCRIPT_PATH + '/bin/samtools view --threads 5 -q 30 -F 2052 -b - |' + SCRIPT_PATH + \ '/bin/samtools sort - -m 2g --threads ' + THREADS + ' -o lgs.part%03d.sort.bam\n'