Hi all,
When I tried to add Read Groups using Picard AddOrReplaceReadGroups
I got the following error. Help me with a solution.
[ Mon Aug 27 16:22:33 MDT 2012] net.sf.picard.sam.AddOrReplaceReadGroups INPUT=<filename.fastq> OUTPUT=<filename.fastq> SORT_ORDER=coordinate RGID=<rgid> RGLB=<rglib> RGPL=illumina RGPU=<rgpu> RGSM=<rgsm> VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false
[Mon Aug 27 16:22:33 MDT 2012] Executing as deepthi@coe03 on Linux 2.6.18-308.4.1.el5 amd64; Java HotSpot(TM) 64-Bit Server VM 1.6.0_21-b06; Picard version: 1.66(1178)
[Mon Aug 27 16:22:33 MDT 2012] net.sf.picard.sam.AddOrReplaceReadGroups done. Elapsed time: 0.01 minutes.
Runtime.totalMemory()=2058027008
FAQ: http://sourceforge.net/apps/mediawiki/picard/index.php?title=Main_Page
Exception in thread "main" java.lang.IllegalArgumentException: Cannot add sequence that already exists in SAMSequenceDictionary: 7180001696929
at net.sf.samtools.SAMSequenceDictionary.setSequences(SAMSequenceDictionary.java:62)
at net.sf.samtools.SAMSequenceDictionary.<init>(SAMSequenceDictionary.java:40)
at net.sf.samtools.SAMTextHeaderCodec.decode(SAMTextHeaderCodec.java:106)
at net.sf.samtools.BAMFileReader.readHeader(BAMFileReader.java:393)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:146)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:114)
at net.sf.samtools.SAMFileReader.init(SAMFileReader.java:514)
at net.sf.samtools.SAMFileReader.<init>(SAMFileReader.java:167)
at net.sf.samtools.SAMFileReader.<init>(SAMFileReader.java:122)
at net.sf.picard.sam.AddOrReplaceReadGroups.doWork(AddOrReplaceReadGroups.java:68)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:177)
at net.sf.picard.cmdline.CommandLineProgram.instanceMainWithExit(CommandLineProgram.java:119)
at net.sf.picard.sam.AddOrReplaceReadGroups.main(AddOrReplaceReadGroups.java:61)
Hi I just checked the @SQ lines of the bam files. Chr Y is missing. Why is that so? What should I do to resolve that?
FYI: I used the bam files in the command. That is a typo error. Sorry for that.
I've edited my original answer with my best guess for an answer.
Some @SQ lines are repeating . That may be the reason the error "Cannot add sequence that already exists in SAMSequenceDictionary: 7180001696929" is coming.
I created my sam file using
bowtie -S -q <ref_genome> <filename.fastq> <filename.sam> --un <filename.fastq> --best --quiet
and converted it to bam file
samtools view -S <filename.sam> -b > <filename.bam>
The above bam file is the input to AddOrReplaceReadGroups.
Do you have any idea why the @SQ lines are repeating?
Which file I have to use in
java -Xmx2g -jar CreateSequenceDictionary.jar REFERENCE=reference.fa OUTPUT=reference.dict java -Xmx2g -jar ReorderSam.jar INPUT=filename.bam OUTPUT=filename.reordered.bam REFERENCE=reference.fa
as REFERENCE?
I created the sam file from a Genome.
Steps in my process are:
1.bowtie-build Chr1.fa,Chr2.fa.....ChrY.fa genome_reads 2.bowtie -S -q <ref_genome> <filename.fastq> <filename.sam> --un <filename.fastq> --best --quiet 3.samtools view -S <filename.sam> -b > <filename.bam>