Ftp Bam Files Error On Samtools
2
1
Entering edit mode
12.2 years ago

Hi everyone,

I've been trying to split huge BAM files (80Gb) by chromosomal location. For that I'm running samtools with FTP. I'm using the following command:

samtools view -bh ftp://ftp-mouse.sanger.ac.uk/current_bams/PWK_PhJ.bam chr11

It gives the error: Segmentation fault. However, if I just try to print the same sequence, it works fine. Does anyone know why it is giving this error and what am I doing wrong?

Would it be better to download the complete files to the computer?

Thanks.

samtools bam • 4.3k views
ADD COMMENT
0
Entering edit mode

Hi Leandro, please add the following information for completeness: the version of samtools, and in a terminal type uname -a and paste the output.

ADD REPLY
4
Entering edit mode
12.2 years ago
Michael 54k

Sorry works for me but your command was missing the ftp:// protocol:

samtools view -bh ftp://ftp-mouse.sanger.ac.uk/current_bams/PWK_PhJ.bam chr11 > chr11.bam

It started to happily print the content of the bam file, it is not finished yet, but if I understood correctly, the segfault occurred immediately? I bet there is something wrong with your installation of samtools. How did you build samtools? Get the sysadmin to build the latest version from scratch. My server has 128GB RAM and that is more than sufficient.

Version: 0.1.18 (r982:295)

$ uname -a
Linux mybas 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:44 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

Update: process finished without complaints yielding a 5.3GB bam file.

Edit: for the sake of completeness I would like to cross post my solution from samtools-help, apart from the segfault, there seems to be a slight glitch in the documentation or the program:


I checked a bit more and there are in fact several aspects to this.

  • There is a slight discrepancy between the documentation and how it really works. From the documentation:

"A region can be presented, for example, in the following format: ‘chr2’ (the whole chr2)"

a) However, what happens in my version is that the whole bam file is written without filtering, that is why I have gotten that 5.3GB bam file.

I used this specifier 'chr11:', note extra ':', then my version works as expected. That means in particular

b) for 'chr11:' which is not contained in the original file, a BAM file is created which contains only header lines, (weird characters) plus a warning is given on standard error:

[bam_parse_region] fail to determine the sequence name. [main_samview] region "chr11:" specifies an unknown reference name. Continue anyway.

c) for using '11:' which is actually the only correct way, I get the filtered bam file as output which are the binary data you pasted below.

Thus the difference between our builds is only that your version crashes when the sequence name is entered in the 'wrong' format AND the unfiltered BAM file would be returned without warning in my build.

As a result please try the following commands:

  • open the terminal application
  • into a new window type: cd /Users/leandro/Desktop/SAMTOOLS/
./samtools view -bh ftp://ftp-mouse.sanger.ac.uk/current_bams/PWK_PhJ.bam 11:  > chr11.bam

you should be able to view the resulting file with:

samtools view chr11.bam

That way, you can check that the chromosome filter actually worked.

ADD COMMENT
0
Entering edit mode

Thank YOU for your answer. I forgot the ftp:// protocol here, but I entered that when running on samtools. Yes, the error occurred immediately, I will try to reinstall samtools like you said!

ADD REPLY
0
Entering edit mode
12.2 years ago
Khoops66 ▴ 20

samtools view -h ftp://ftp-file.bam chr11

works for me. Segmentation fault is just a warning, I think. Data strips clean

ADD COMMENT
0
Entering edit mode

unfortunately seg fault is not only a warning...

ADD REPLY

Login before adding your answer.

Traffic: 2589 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6