Well congrats. You have a genomic library of high complexity. I have been analyzing NGS data for quiet a while but have never seen any library with PCR duplication rate < 1%. You should be excited rather getting tensed about increase in the bam size. The increase could be due to the mark added by picard as suggested by Dan OR it could be difference in the compression ratio used in the original bam and the bam generated by picard. Not sure though.
hi, I ran the following command for 'marking and removing duplicates' from my WGS data from illumina HiSeq platform:
java -Xms4g \
-jar /usr/local/picard-tools-1.129/picard.jar \
MarkDuplicates \
INPUT=2102.bwa.sam.sort.bam \
OUTPUT=2102.bwa.sam.sort.rmdup1.bam \
METRICS_FILE=2102.bwa.sam.sort.rmdup.txt2 \
REMOVE_DUPLICATES=true \
VALIDATION_STRINGENCY=LENIENT
I found my input file was input file was 6.8G whereas output file formed of 7.0G. Moreover, I didn't find any duplicates removed from the files after visualization by IGV or via command line by samtools i.e.
diff -c <(samtools view 2102.bwa.sam.sort.bam | cut -f -9) <(samtools view 2102.bwa.sam.sort.rmdup1.bam | cut -f -9) | less
Any suggestion where I am missing something?
Thanks,
Ravi
1 answer
hi, thanks for the comment and command. here is the output of this command on both .bam files. Certainly the number of lines seems reduced in 'Mark & Remove Duplicate' file. here it is:
[rsindhu@master test_2102]$ samtools view 2102_L001_R1R2_P.bwa.sam.sort.bam | wc -l
113465731
[rsindhu@master test_2102]$ samtools view 2102_L001_R1R2_P.bwa.sam.sort.rmdup1.bam | wc -l
112352624
Hi, thank you for the suggestion. I am new for this whole area so seeking help at almost every step. Here, since I am using data of only 'ONE' lane out of 8 in my short 'test' experiment so it might be the reason for such small duplication rate. Once I'll use the whole data of a sample (which is about 10 times the current test sample) then the original duplicate rates will appear, which might be much more than 1%. It's my assumption but yes, that's also true that the data quality is really good for this run. Thanks for the comment.
Run samtools view [Dedupped BAM] | less
What you should see is that each record in the BAM file has Picard MarkDuplicates (or something similar) in the optional fields. That's what is increasing your file size after the removal of duplicates.
By the way, you could replace the pipe with samtools view -c, which counts the records itself rather than emitting the full bam only to have it consumed by wc.
In addition, if you want to check to only count reads that have not been flagged as duplicates, you could further replace your calls with samtools view -cF1024 {bam}. -F means skip all reads with any bits in parameter set. This skips all reads marked as duplicates.
I typically use 2816 or 3840 when counting my bams. 2816 just out of habit, as the 1024 bit is usually unset in my workflows.
Log in to answer this question.
Try to use
/usr/local/picard-tools-1.129/MarkDuplicates.jardirectly. Alternatively you can trysamtools rmdupto test if results change.hi, thank you for suggestion. going to try it now.
Hi, the
picard-tools-1.129directory didn't haveMarkDuplicates.jarfile. The only files available are:So I don't think I have the option to use 'MarkDuplicates' the way you suggested?
Can you please post the content (or the basic stats) from the Metrics file that was output? It should be
2102.bwa.sam.sort.rmdup.txt2as you specified in your command line.Thank you. Yes, here is the content of the above file (i shortened the names of files while posting this query):
Thanks! There are definitely some duplicates there that Picard caught. Looks like your duplication rate is just under 1%.
Try running this command on both your input BAM and your MarkDuplicates output BAM:
What value do you get for each file?
I should also add that the discrepancy in size is likely due to the fact that MarkDuplicates adds an entry to each record in the BAM file. See the statement which starts at line 182:
https://github.com/broadinstitute/picard/blob/1dc88674926819984de793bfc1bf04847d1fff1a/src/java/picard/sam/markduplicates/MarkDuplicates.java
yes, i was also assuming this fact that picard might have add some 'mark' in .bam file, which leads in increase in size but at the same time i have read that after 'duplicate removal' the overall size of the file should be reduced. So i am bit confused with my file's size (& number of lines) outcome. Sorry, i can't understand java. Thanks for comment, Ravi