Entering edit mode
5.7 years ago
ddzhangzz
▴
90
I have a bam file with header such like this:
@RG ID:S1-L001 LB:L001 PL:Illumina SM:L001 PU:novaSeq
@RG ID:S1-L002 LB:L002 PL:Illumina SM:L002 PU:novaSeq
This bam file was generated by picard MergeSamFiles
where one sample library was sequenced in two lanes (L001, L002) but I need to correct the SM tag to a single library name such like:
@RG ID:S1-L001 LB:L001 PL:Illumina SM:S1 PU:novaSeq
@RG ID:S1-L002 LB:L002 PL:Illumina SM:S1 PU:novaSeq
What I tried
samtools view -H abc.bam > header.sam
and manually edit the SM tages in header.sam and reheader using samtools:
samtools reheader header.sam abc.bam
But the terminal printed out unrecogniziable characters and I thought something went wrong. Any suggestions?