Exception in thread "main" htsjdk.samtools.SAMFormatException: Error parsing SAM header. @RG line missing SM tag.
1
0
Entering edit mode
3.4 years ago
Flexogore ▴ 10

Hello, everyone. Currently I am trying to perform variant calling. Prior to that I should run picard and I'm getting using this command:

 java -jar picard.jar AddOrReplaceReadGroups I=illumina.new.bam O=illumina.sorted.rgs.bam RGID=1M RGLB=lib1M RGSM=1M RGPL=illumina RGPU=unit1

The following error occurs:

Exception in thread "main" htsjdk.samtools.SAMFormatException: Error parsing SAM header. @RG line missing SM tag. Line:                   
@RG ID:LANE1; File /home/flexogore/ngs/illumina.sorted.bam; Line number 86
at htsjdk.samtools.SAMTextHeaderCodec.reportErrorParsingLine(SAMTextHeaderCodec.java:258)
at htsjdk.samtools.SAMTextHeaderCodec.access$200(SAMTextHeaderCodec.java:46)
at htsjdk.samtools.SAMTextHeaderCodec$ParsedHeaderLine.requireTag(SAMTextHeaderCodec.java:358)
at htsjdk.samtools.SAMTextHeaderCodec.parseRGLine(SAMTextHeaderCodec.java:168)
at htsjdk.samtools.SAMTextHeaderCodec.decode(SAMTextHeaderCodec.java:110)
at htsjdk.samtools.BAMFileReader.readHeader(BAMFileReader.java:704)
at htsjdk.samtools.BAMFileReader.<init>(BAMFileReader.java:298)
at htsjdk.samtools.BAMFileReader.<init>(BAMFileReader.java:176)
at htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:406)
at picard.sam.AddOrReplaceReadGroups.doWork(AddOrReplaceReadGroups.java:152)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:308)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)

Looking into the header of my BAM file I see 4 empty @RG lines

@HD VN:1.6  SO:coordinate
@SQ SN:1    LN:249250621    AS:human_g1k_v37_modified.ndx
@SQ SN:2    LN:243199373    AS:human_g1k_v37_modified.ndx
@SQ SN:3    LN:198022430    AS:human_g1k_v37_modified.ndx
@SQ SN:4    LN:191154276    AS:human_g1k_v37_modified.ndx
@SQ SN:5    LN:180915260    AS:human_g1k_v37_modified.ndx
@SQ SN:6    LN:171115067    AS:human_g1k_v37_modified.ndx
@SQ SN:7    LN:159138663    AS:human_g1k_v37_modified.ndx
@SQ SN:8    LN:146364022    AS:human_g1k_v37_modified.ndx
@SQ SN:9    LN:141213431    AS:human_g1k_v37_modified.ndx
@SQ SN:10   LN:135534747    AS:human_g1k_v37_modified.ndx
@SQ SN:11   LN:135006516    AS:human_g1k_v37_modified.ndx
@SQ SN:12   LN:133851895    AS:human_g1k_v37_modified.ndx
@SQ SN:13   LN:115169878    AS:human_g1k_v37_modified.ndx
@SQ SN:14   LN:107349540    AS:human_g1k_v37_modified.ndx
@SQ SN:15   LN:102531392    AS:human_g1k_v37_modified.ndx
@SQ SN:16   LN:90354753 AS:human_g1k_v37_modified.ndx
@SQ SN:17   LN:81195210 AS:human_g1k_v37_modified.ndx
@SQ SN:18   LN:78077248 AS:human_g1k_v37_modified.ndx
@SQ SN:19   LN:59128983 AS:human_g1k_v37_modified.ndx
@SQ SN:20   LN:63025520 AS:human_g1k_v37_modified.ndx
@SQ SN:21   LN:48129895 AS:human_g1k_v37_modified.ndx
@SQ SN:22   LN:51304566 AS:human_g1k_v37_modified.ndx
@SQ SN:X    LN:155270560    AS:human_g1k_v37_modified.ndx
@SQ SN:Y    LN:59373566 AS:human_g1k_v37_modified.ndx
@SQ SN:MT   LN:16569    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000207.1   LN:4262 AS:human_g1k_v37_modified.ndx
@SQ SN:GL000226.1   LN:15008    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000229.1   LN:19913    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000231.1   LN:27386    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000210.1   LN:27682    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000239.1   LN:33824    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000235.1   LN:34474    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000201.1   LN:36148    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000247.1   LN:36422    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000245.1   LN:36651    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000197.1   LN:37175    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000203.1   LN:37498    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000246.1   LN:38154    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000249.1   LN:38502    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000196.1   LN:38914    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000248.1   LN:39786    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000244.1   LN:39929    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000238.1   LN:39939    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000202.1   LN:40103    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000234.1   LN:40531    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000232.1   LN:40652    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000206.1   LN:41001    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000240.1   LN:41933    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000236.1   LN:41934    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000241.1   LN:42152    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000243.1   LN:43341    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000242.1   LN:43523    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000230.1   LN:43691    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000237.1   LN:45867    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000233.1   LN:45941    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000204.1   LN:81310    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000198.1   LN:90085    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000208.1   LN:92689    AS:human_g1k_v37_modified.ndx
@SQ SN:GL000191.1   LN:106433   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000227.1   LN:128374   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000228.1   LN:129120   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000214.1   LN:137718   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000221.1   LN:155397   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000209.1   LN:159169   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000218.1   LN:161147   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000220.1   LN:161802   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000213.1   LN:164239   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000211.1   LN:166566   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000199.1   LN:169874   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000217.1   LN:172149   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000216.1   LN:172294   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000215.1   LN:172545   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000205.1   LN:174588   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000219.1   LN:179198   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000224.1   LN:179693   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000223.1   LN:180455   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000195.1   LN:182896   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000212.1   LN:186858   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000222.1   LN:186861   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000200.1   LN:187035   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000193.1   LN:189789   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000194.1   LN:191469   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000225.1   LN:211173   AS:human_g1k_v37_modified.ndx
@SQ SN:GL000192.1   LN:547496   AS:human_g1k_v37_modified.ndx
@RG ID:LANE1
@RG ID:LANE2
@RG ID:LANE3
@RG ID:LANE4
@PG ID:samtools PN:samtools VN:1.10 CL:samtools sort -o illumina.sorted.bam illumina.bam
@PG ID:samtools.1   PN:samtools PP:samtools VN:1.10 CL:samtools view -H illumina.sorted.bam

What should I do to solve this problem?

picard VCF BAM • 1.3k views
ADD COMMENT
0
Entering edit mode
3.4 years ago

try to add VALIDATION_STRINGENCY=LENIENT to your cmd line.

ADD COMMENT

Login before adding your answer.

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