The current GATK version is 3.7-0
Examples: Monday, today, last week, Mar 26, 3/26/04

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Get notifications!

You can opt in to receive email notifications, for example when your questions get answered or when there are new announcements, by following the instructions given here.

Got a problem?

1. Search using the upper-right search box, e.g. using the error message.
2. Try the latest version of tools.
3. Include tool and Java versions.
4. Tell us whether you are following GATK Best Practices.
5. Include relevant details, e.g. platform, DNA- or RNA-Seq, WES (+capture kit) or WGS (PCR-free or PCR+), paired- or single-end, read length, expected average coverage, somatic data, etc.
6. For tool errors, include the error stacktrace as well as the exact command.
7. For format issues, include the result of running ValidateSamFile for BAMs or ValidateVariants for VCFs.
8. For weird results, include an illustrative example, e.g. attach IGV screenshots according to Article#5484.
9. For a seeming variant that is uncalled, include results of following Article#1235.

Did we ask for a bug report?

Then follow instructions in Article#1894.

Formatting tip!

Wrap blocks of code, error messages and BAM/VCF snippets--especially content with hashes (#)--with lines with three backticks ( ``` ) each to make a code block as demonstrated here.

Jump to another community
Picard 2.10.4 has MAJOR CHANGES that impact throughput of pipelines. Default compression is now 1 instead of 5, and Picard now handles compressed data with the Intel Deflator/Inflator instead of JDK.
GATK version 4.beta.2 (i.e. the second beta release) is out. See the GATK4 BETA page for download and details.

question about MergeBamAlignment

Hi there,
I am trying to use the pipeline from the best practice to analysis some exome data. But I get confused on the step "MergeBamAlignment".

We used bwa to map the fastq file to the reference and then, generated unmapped bam file using picard. After we merged the aligned bam file (A) and unmapped file (B), we got a merged bam file(C). However, the merge file (C) has a smaller size than both A and B.

7.3G sample.aligned.bam(A)
5.7G sample.raw.bam (B)
4.8G sample.merged.bam(C)
6.3M sample.merged.bai

According to informations from the guidance that MergeBamAlignment takes metadata from a SAM or BAM file of unmapped reads (uBAM) and merges it with a SAM or BAM file containing alignment records for a subset of those reads, i thought the merged file would be the largest file in A, B, and C.(

Why the merged file is smaller than others?

Here is my command:


$bwa mem -t 12 \
-M \
-R "@RG\tID:ID001\tLB:sample001\tSM:sample001\tPL:ILLUMINA" \
$ref_dir/ucsc.hg19.fasta \
$data_dir/sample001/ID001_1.clean.fq.gz $data_dir/sample001/ID001_2.clean.fq.gz > $sam_dir/ID001.aligned.sam

sort sam

java -jar $picard/SortSam.jar \
INPUT=$sam_dir/ID001.aligned.sam \
OUTPUT=$bam_dir/ID001.aligned.bam \
SORT_ORDER=queryname \

generate unmapped bam file

java -jar $picard/FastqToSam.jar \
FASTQ=$data_dir/sample001/ID001_1.clean.fq.gz \
FASTQ2=$data_dir/sample001/ID001_2.clean.fq.gz \
OUTPUT=$bam_dir/ID001.raw.bam \
SAMPLE_NAME=sample001 \
SORT_ORDER=queryname \

merge two bam file

java -jar $picard/MergeBamAlignment.jar \
ALIGNED_BAM=$bam_dir/ID001.aligned.bam \
UNMAPPED_BAM=$bam_dir/ID001.raw.bam \
OUTPUT=$bam_dir/ID001.bam \
SORT_ORDER=coordinate \
R=$ref_dir/ucsc.hg19.fasta \

I would be very grateful of any advice!

Issue · Github
by Sheila

Issue Number
Last Updated
Closed By


  • shleeshlee CambridgeMember, Broadie, Moderator

    Hi @ZoeChing,

    You should check to see if your merged.bam (C) represents all your reads from raw.bam (B). You can do this by counting unique read names from each BAM. These numbers should be identical. Here are the commands I would use:

    samtools view merged.bam | cut -f1 | sort | uniq | wc -l
    samtools view raw.bam | cut -f1 | sort | uniq | wc -l
Sign In or Register to comment.