BAM reheader
0
0
Entering edit mode
2.5 years ago

Thanks all, the problem is solved. it appears that the warning message is not related to the bam header and the header is there already.

Hi everyone, I hope you are all great, I'm trying to convert my sam files into bam using the below command

samtools view -h -b -o file.bam file.sam

it worked fine but the output file has no header. I also tried to add the header using the two steps below

samtools view -H file.bam > header.sam  # extract header only
samtools reheader header.sam file.unique.bam

but the file still has no header. ps: when I run samtools view -h file.bam the output has a header, however, I'm getting an error message with each command that requires the header to be in the bam file. (for example, running bedintersect:

bedtools intersect   -s -header -a file.bam  -b file.bed > file2.bam 

I got the error message below

WARNING: -header option is not valid for BAM input)

any advice, please? your help is much appreciated. Surar

samtools bam reheader sam • 1.1k views
ADD COMMENT
0
Entering edit mode

it worked fine but the output file has no header

and

ps: when I run samtools view -h file.bam the output has a header

Then the bam file does have a header, samtools cannot just make one up. It could just be that bedtools interact -header option does not work with bam files.

ADD REPLY

Login before adding your answer.

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