This is a test version of Biostars. For the public version, visit https://www.biostars.org.
sorting BAM file

I tried sorting the BAM file i created using gatk-package-4.2.5.0-local.jar SortSam the code is :

java -jar gatk-package-4.2.5.0-local.jar SortSam -I {path.bam} -O {path.sorted.bam}  -SO coordinate

but i encountered this error:

INFO: Failed to detect whether we are running on Google Compute Engine.
[Tue May 30 16:08:32 IRST 2023] Executing as hp@hp-HP-Pavilion-Laptop-15-cs3xxx on Linux 5.15.0-72-generic amd64; OpenJDK 64-Bit Server VM 11.0.19+7-post-Ubuntu-0ubuntu120.04.1; Deflater: Intel; Inflater: Intel; Provider GCS is available; Picard version: Version:4.2.5.0
[Tue May 30 16:08:32 IRST 2023] picard.sam.SortSam done. Elapsed time: 0.01 minutes.
Runtime.totalMemory()=314572800
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
htsjdk.samtools.SAMFormatException: Error parsing SAM header. @RG line missing SM tag. Line:
@RG ID:P1; File /media/hp/Amin_Ghalavand/NF2.cases/PGERA1905/p3.bam; Line number 95
    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 htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:209)
    at picard.sam.SortSam.doWork(SortSam.java:152)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:308)
    at org.broadinstitute.hellbender.cmdline.PicardCommandLineProgramExecutor.instanceMain(PicardCommandLineProgramExecutor.java:37)
    at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:160)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:203)
    at org.broadinstitute.hellbender.Main.main(Main.java:289)

what seems to be the problem?

bam

Error parsing SAM header. @RG line missing SM tag.

Looks like you did not include SM tags when you added read groups.

You can simply use samtools sort to get rid of this read group nonsense these Broad institute tools always complain about.

0 answers

No answers yet.

Log in to answer this question.