sam to bam conversion
1
0
Entering edit mode
7.0 years ago
sa1987 ▴ 20

hi

i m working on rna seq analysis in human

i got my sam file

@HD VN:1.0  SO:unsorted
@SQ SN:NC_000001.11 LN:248956422
@SQ SN:NT_187361.1  LN:175055
@SQ SN:NT_187362.1  LN:32032
@SQ SN:NT_187363.1  LN:127682
@SQ SN:NT_187364.1  LN:66860
@SQ SN:NT_187365.1  LN:40176
@SQ SN:NT_187366.1  LN:42210
@SQ SN:NT_187367.1  LN:176043
@SQ SN:NT_187368.1  LN:40745

my tired converting to BAM result file looks like this

BAMU�:^@HD VN:1.0  SO:unsorted
@SQ SN:NC_000001.11 LN:248956422
@SQ SN:NT_187361.1  LN:175055
@SQ SN:NT_187362.1  LN:32032
@SQ SN:NT_187363.1  LN:127682
@SQ SN:NT_187364.1  LN:66860
@SQ SN:NT_187365.1  LN:40176
@SQ SN:NT_187366.1  LN:42210
@SQ SN:NT_187367.1  LN:176043
@SQ SN:NT_187368.1  LN:40745

my bam file siz is more than 5 gb

i want to sort it but when i try sorting i get this error

[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).

Segmentation fault (core dumped)

plz help

shafna

next-gen sequencing rna-seq • 2.3k views
ADD COMMENT
1
Entering edit mode

result file looks like this

it's a binary file, you shouldn't open it with more or another text viewer

i want to sort it but when i try sorting i get this error

show us the full command lines.

ADD REPLY
0
Entering edit mode

this is the command i used samtools sort humangenome_1.bam humangenome_1_sorted

my samtools version is 0.1.19

ADD REPLY
1
Entering edit mode

You probably converted without adding the -h option that keeps the header. The full conversion command is:

samtools view -b -h input.sam > output.bam
ADD REPLY
0
Entering edit mode

You have to be careful with pipes and redirects when converting between SAM and BAM. Don't clip off anything (such as the header) that may be needed for a complete file.

Brent Wilson, PhD | Project Scientist | Cofactor Genomics 4044 Clayton Ave. | St. Louis, MO 63110 | tel. 314.531.4647 Catch the latest from Cofactor on our blog.

ADD REPLY
0
Entering edit mode

Which version of samtools?

ADD REPLY
0
Entering edit mode

samtool 0.1.19..its a older version ...i also ahave another question how to update the samtools 1.4?..i tired "sudo apt-get install samtools 1.4"--> but i am getting error

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: libstarpu-1.1-4 : Conflicts: libstarpu-contrib-1.1-4 but 1.1.0+dfsg-2ubuntu1 is to be installed libstarpu-contrib-1.1-4 : Conflicts: libstarpu-1.1-4

after this i tired checking the version ...its the same old version..

plz help

ADD REPLY
0
Entering edit mode
7.0 years ago
shmaisrael • 0

If you use samtools 1.3 you can do it with next command

samtools sort -n -o out.bam in.sam

ADD COMMENT

Login before adding your answer.

Traffic: 2987 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