amplab / snap

Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data
https://www.microsoft.com/en-us/research/project/snap/
Apache License 2.0
287 stars 66 forks source link

Error - Segmentation fault (core dumped) #151

Closed klamens closed 1 year ago

klamens commented 2 years ago

Hi,

Love the SNAP mapper. We encountered several samples that give a similar error when we try to map its reads to an assembly made in SPAdes.

Commands we use:

The error disappears when we omit the '-so'. However, we would like to keep utilizing this option. It would be most appreciated if you could help us with either telling what we do wrong or to fix the bug if present.

Many thanks spades_contigs.fasta.txt 1513536597387975271_err.fastq.txt !

bolosky commented 2 years ago

I was able to repro this. I'm not sure what's causing it, but guessing from where it crashed I suspect I'll have a fix later today.

-Bill

From: klamens @.> Sent: Wednesday, February 9, 2022 8:14 AM To: amplab/snap @.> Cc: Subscribed @.***> Subject: [amplab/snap] Bug - Segmentation fault (core dumped) (Issue #151)

Hi,

Love the SNAP mapper. We encountered several samples that give a similar error when we try to map its reads to an assembly made in SPAdes.

Commands we use:

making index

./snap-aligner index spades_contigs.fasta index_default

mapping

./snap-aligner_2 single index_default ./1513536597387975271_err.fastq -I -xf 2 -o snap_output.bam -so

The error disappears when we omit the '-so'. However, we would like to keep utilizing this option. It would be most appreciated if you could help us with either telling what we do wrong or to fix the bug if present.

Many thanks spades_contigs.fasta.txthttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famplab%2Fsnap%2Ffiles%2F8034232%2Fspades_contigs.fasta.txt&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523931839%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=XYOoUjTbE9l0UISnFvx4WSJmpwVV3CMPwwnXxq1qoHY%3D&reserved=0 1513536597387975271_err.fastq.txthttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famplab%2Fsnap%2Ffiles%2F8034233%2F1513536597387975271_err.fastq.txt&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523931839%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ZY972nt%2BdtVJGsQWxDWjyQ58KkyucH%2BKQ4zZTXhMEMU%3D&reserved=0 !

- Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famplab%2Fsnap%2Fissues%2F151&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523931839%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=khwQIxzX4N0PXcf0btYCGUY0C%2B%2BfQBXFnUJLLbkxdhs%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAHPTWOPCLX3TJ63KT6SWJTU2KHFDANCNFSM5N56T2YQ&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523981830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7mhXXnBWSoRhRArRk%2B%2F1RqK9tXV%2Fypdx00fIuVxccFM%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523981830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=MfqmDjySZBB5UlXsAQmJ3xZyuB7Ergx%2Fq859s3gP4lQ%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cbolosky%40microsoft.com%7C67f81af5be7a48c9941108d9ebe7342d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637800200523981830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dyZAq3pd5hyfYm1NuC%2FSGqQgsgg5Qf%2B903PJMPhhoNY%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

bolosky commented 2 years ago

I was a little optimistic on the time frame.

What happened was that that read was aligning off the beginning of the first contig and while the output code correctly soft clipped and adjusted the alignment, the old genome location got put in as the sort key and when it looked up the contig to use for the sort key, it got NULL and crashed.

You'd think that it would be easy to just use the right genome location for the sort key, but the code that adjusts alignments in the output stage is a tangled mess and a swamp of hackery. So, for now I "fixed" it in the same way that one fixes a dog. Reads that align off the beginning of contigs will just not be aligned at all.

The fix is in the dev branch. do "git pull; git checkout dev; make clean; make" to get a binary, which should be version 2.0.2.dev.1. Try it out and let me know if it works for you.

Let's leave this issue open until I fix it properly (which probably means refactoring the alignment adjusting code) and get it into master.

klamens commented 2 years ago

Hi,

I tested it and it works for the samples that gave us previously errors. However, since we use it in production (for clients), we will still opt to use the main 2.0.0 version and will sort with samtools afterwards.

Thank you for the swift aid!

bolosky commented 1 year ago

In 2.0.2

zhen0506 commented 11 months ago

This error still appears for some of samples using the version 2.0.3 with the -so parameter. Here is the log. Loading index from directory... 0s. 191,865,422 bases, seed size 24. Aligning. /tmp/slurmd/job10959467/slurm_script: line 17: 1946394 Segmentation fault (core dumped) snap-aligner paired

bolosky commented 11 months ago

This is probably a different bug. #151 was crashing during sort, which from the output you showed hasn't started for you.

Could you please open a new issue for this, and if possible send me a way to reproduce it (i.e., send me your FASTA and the read(s) that cause the crash).