Question: Conversion of sam to bam using samtools
0
gravatar for abhilashreddy495
8 months ago by
abhilashreddy4950 wrote:

Hello,

The alignment with the whole human genome and my data, the sam files are genertaed but when I tried to use the samtools for conversion sam to bam facing problem of header. with the reference sequence also am not able to do it.

Any other way to do it?

output:

[sam_header_line_parse] expected '@XY', got [@A00306:15:H3WG3DMXX:1:1101:14705:1000 2:N:0:TAGCTTAT]
Hint: The header tags must be tab-separated.
[sam_header_read2] 0 sequences loaded.
[samopen] no @SQ lines in the header.
[main_samview] random alignment retrieval only works for indexed BAM files.
rna-seq sam samtools bam ngs • 1.3k views
ADD COMMENTlink modified 7 months ago by Biostar ♦♦ 20 • written 8 months ago by abhilashreddy4950
1

I've changed your post type to a question. Tools are for promoting new pieces of software etc, not for questions regarding tools.

ADD REPLYlink modified 8 months ago • written 8 months ago by jrj.healey11k

Can you post the command you are using to convert sam to bam? Typical command would be: samtools view -S -bh sample.sam > sample.bam

ADD REPLYlink written 8 months ago by Sej Modha4.1k
samtools view -bT ref.fastq test.sam >output.bam
ADD REPLYlink modified 8 months ago by finswimmer11k • written 8 months ago by abhilashreddy4950
1

Hello,

  • Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
    code_formatting

  • Also it isn't necessary to answer to each post with the same content. Everyone who already posted here is informed about new messages.

Thank you!

fin swimmer

ADD REPLYlink modified 8 months ago • written 8 months ago by finswimmer11k

to the above command suggested

 [samopen] no @SQ lines in the header.
 [sam_read1] missing header? Abort!
ADD REPLYlink modified 8 months ago by finswimmer11k • written 8 months ago by abhilashreddy4950
0
gravatar for finswimmer
8 months ago by
finswimmer11k
Germany
finswimmer11k wrote:

Hello abhilashreddy495,

what was the exact command use for the alignment? Also please post the beginning of your sam file e.g. with head input.sam.

fin swimmer

ADD COMMENTlink written 8 months ago by finswimmer11k
head '/media/abhilash/Abhilash/grch38/outputn.sam' 

�BC!sr�ed�|�t�
ADD REPLYlink modified 8 months ago by finswimmer11k • written 8 months ago by abhilashreddy4950

Your sam file is already a binary file.

What happens here?

samtools view -H outputn.sam

fin swimmer

ADD REPLYlink written 8 months ago by finswimmer11k
[bam_header_read] EOF marker is absent. The input is probably truncated.
ADD REPLYlink modified 8 months ago by finswimmer11k • written 8 months ago by abhilashreddy4950

That's sounds like your file is broken or it isn't a bam/sam file. One last try:

$ samtools view outputn.sam|head

You haven't answer the question how your alignment file was created. For more help we need to know this.

fin swimmer

ADD REPLYlink modified 8 months ago • written 8 months ago by finswimmer11k

It sounds a little like its already converted to a BAM, but the headers haven't been preserved?

ADD REPLYlink written 8 months ago by jrj.healey11k
1

That was my intention ;)

ADD REPLYlink written 8 months ago by finswimmer11k

The same error as above. by using hisat2

ADD REPLYlink written 8 months ago by abhilashreddy4950
1

Exact command please.

But at all it looks like your data is corrupted and you have to start from the beginning.

ADD REPLYlink written 8 months ago by finswimmer11k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1101 users visited in the last hour