walaj / bxtools

Tools for analyzing 10X Genomics data
MIT License
42 stars 10 forks source link

error in bxtools convert #17

Closed verne91 closed 6 years ago

verne91 commented 7 years ago

Hello,

I used the following command to sort the bam file by 'BX' tag. bxtools convert $bam -v -k | samtools sort - -o bx_sorted.bam

But I got an error after running about 30 mins.

.....
...at read 853,000,000 at pos 0:-1(+)
...at read 854,000,000 at pos 0:-1(+)
...starting second pass to flip chr and BX
terminate called after throwing an instance of 'std::out_of_range'
  what():  BamHeader::IDtoName - Requested ID is higher than number of sequences
walaj commented 7 years ago

For some reason, it is having a hard time with unmapped reads. A workaround would be to filter these out with samtools and pipe the filtered reads into bxtools. Not a great permanent solutions. @tkamath1, do you know what is going on here?

On Tue, Jul 18, 2017 at 4:27 PM, Chen Sun notifications@github.com wrote:

Hello,

I used the following command to sort the bam file by 'BX' tag. bxtools convert $bam -v -k | samtools sort - -o bx_sorted.bam

But I got an error after running about 30 mins. .... ...at read 853,000,000 at pos 0:-1(+) ...at read 854,000,000 at pos 0:-1(+) ...starting second pass to flip chr and BX terminate called after throwing an instance of 'std::out_of_range' what(): BamHeader::IDtoName - Requested ID is higher than number of sequences

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/walaj/bxtools/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AGmfiPXSDyny58J-KjK_BXICmNQ8HZXKks5sPRVDgaJpZM4Ob4TM .

tkamath1 commented 7 years ago

Hi @verne91, thanks for bringing this up. Unfortunately I agree this may be an issue with unmapped reads. Another solution would be to drop tags when converting your BAM file (i.e. don't add the -k/keep-tags option when running convert). Hopefully this will resolve the issue albeit not being the perfect solution.

verne91 commented 7 years ago

Hello @tkamath1 , thank you for your suggestion. But the purpose I use this program is getting a sorted bam file and then I can get the fragments for each barcode. If I don't keep the tags of chromosomes. I will lose the coordinates. Do you have any idea for my problem?

walaj commented 7 years ago

Right, you'll definitely need the tags. This is a bug in "convert", although it may take me a few days to address. @tkamath1, are you able to see where the bug is?

On Thu, Jul 20, 2017 at 9:20 AM, Chen Sun notifications@github.com wrote:

Hello @tkamath1 https://github.com/tkamath1 , thank you for your suggestion. But the purpose I use this program is getting a sorted bam file and then I can get the fragments for each barcode. If I don't keep the tags of chromosomes. I will lose the coordinates. Do you have any idea for my problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/walaj/bxtools/issues/17#issuecomment-316700809, or mute the thread https://github.com/notifications/unsubscribe-auth/AGmfiIrG_1YtJw3UeN6D1vR6OEhoIMgCks5sP1Q2gaJpZM4Ob4TM .

tcashby commented 6 years ago

Any updates on this? I'm encountering the same issue.

walaj commented 6 years ago

Thank you for your long patience with this. I have fixed this issue with the latest commit and convert is now working.