Question: Reference genome and samtools reheader option
0
gravatar for shuksi1984
2.2 years ago by
shuksi198450
shuksi198450 wrote:

With respect to the reference sequence hg38 and gatkbundlehg38, I used gatkbundlehg38 and hg38.fa for alignment of exome sequence. I am getting error while using samtools reheader.

my command is: path/to/samtools reheader -i HG100.sam > HG100.bam

I got following error both the times.

[E::hts_open] fail to open file '-i' [main_reheader] fail to read the header from -i.

HG100.sam is 4.9GB

Following shows it's header details:

@SQ SN:chr1 LN:248956422
@SQ SN:chr2 LN:242193529
@SQ SN:chr3 LN:198295559
@SQ SN:chr4 LN:190214555
@SQ SN:chr5 LN:181538259
@SQ SN:chr6 LN:170805979
@SQ SN:chr7 LN:159345973
@SQ SN:chr8 LN:145138636
@SQ SN:chr9 LN:138394717
@SQ SN:chr10 LN:133797422
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by shuksi198450

Can you clear, from where you are getting "your_alignments.bam" in second command. We get BAM file only when we convert SAM to BAM after alignment with reference genome. I have just aligned my exome data with the reference genome, hence do not have any BAM file.

This is my actual command: sudo path/to/samtools-1.2/bin samtools reheader -i HG100.aligned_reads.sam > HG100_aligned_reads_reheader.bam

samtool version is 1.2

ADD REPLYlink written 2.2 years ago by shuksi198450
1

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized.

This comment belongs under @Devon's answer.

A side note. Running user programs should never need sudo.

ADD REPLYlink modified 2.2 years ago • written 2.2 years ago by genomax84k
1

Most people don't ever produce SAM files, they invoke samtools view to produce BAM files directly. You can probably use a SAM file as input into samtools reheader, though since it's already a text file that one can directly edit I've never tried.

ADD REPLYlink written 2.2 years ago by Devon Ryan95k

BTW, the -i option was added to samtools reheader in version 1.3.

ADD REPLYlink written 2.2 years ago by Devon Ryan95k
0
gravatar for Devon Ryan
2.2 years ago by
Devon Ryan95k
Freiburg, Germany
Devon Ryan95k wrote:

The version of samtools you're using apparently doesn't support the -i option. Also, your command is wrong, it should be samtools reheader -i some_header_file_or_sam_file your_alignments.bam or samtools reheader some_header_file_or_sam_file your_alignments.bam > alignments_with_new_header.bam.

ADD COMMENTlink written 2.2 years ago by Devon Ryan95k

This command does not perform replacement within the same bam file rather is spitting binary in std out. Any suggestion?

samtools reheader -i some_header_file_or_sam_file your_alignments.bam

ADD REPLYlink written 6 weeks ago by lakhujanivijay5.0k
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: 821 users visited in the last hour