BAMAUXMERGE2(1)
BAMAUXMERGE2 π
okay bestie, welcome to the bamauxmerge2 page, from the General Commands Manual corner of the universe β¨ this one is genuinely iconic β it's the little tool that takes your unmapped reads and your freshly aligned reads and merges them into one gorgeous alignment file. no cap.
β¨ NAME β¨
bamauxmerge2 β merge information in unmapped and mapped BAM files π§¬π
π SYNOPSIS π
bamauxmerge2 [options] in_unmapped in_mapped
π¦ DESCRIPTION π¦
So here's the vibe: bamauxmerge2 reads and merges two BAM files, and it expects those two files to have these properties, okay? like it's not gonna be chill if they don't:
- the first file contains only unmapped reads and its header contains no
SQlines - the second file was produced by an aligner based on the content of the first file
- both files are sorted in query name order into a single alignment file
πΈ how the headers get merged
The headers of the two files are merged in the following file:
- the
SQlines contained in the header of the second file are appended to the header of the first file to obtain the header of the output file - all other header information from the second file is discarded π (bye, we don't know her)
π how the output records get built
The output records are constructed in the following way, step by step, no skipping:
- Take a record from the second file
- Copy all aux fields from the corresponding record in the first file which are not already present.
- Reinsert clipped adapter bases/quality values stored in the
qs/qqby aux fields byfastqtobam2and remove theqs/qqaux fields while inserting appropriate soft clipping CIGAR operations. - Fix mate information like
bamfixmateinformation. - Insert the mate CIGAR information fields
MCandMSif the mate is aligned. - Insert the
MQ(mate quality) aux field.
π OPTIONS π
The following key=value pairs can be given:
zz=<0|1>β replace read name by content ofnnaux field. Valid values are:1: replace read name0: do not replace read name
calmdnm=<0|1>β recomputeMDandNMaux fields. Valid values are:1: recomputeMDandNMaux fields. This requires thecalmdnmreferencekey to be set to the name of an appropriate FastA file.0: do not recomputeMDandNMaux fields
calmdnmreference=<>β reference FastA file.replacecigar=<0|1>β replaceMcigar operations by the appropriate=andXoperations. Valid values are:1: replace cigar operations. This requires thecalmdnmreferencekey to be set on invocation.0: do not replace cigar operations
hash=<crc32prod>β hash used for computing sequence checksums. Seebamseqchksumfor further information.filehash=<md5>β hash used for computing output file checksums.chksumfn=<>β file name used for storing sequence checksum information. By default this information is not saved.filehashfn=<>β file name used for storing file checksum information. By default this information is not saved.level=<-1|0|1|9>β set compression level of the output BAM file. Valid values are:-1: zlib/gzip default compression level0: uncompressed1: zlib/gzip level 1 (fast) compression9: zlib/gzip level 9 (best) compression
verbose=<1>β Valid values are:1: print progress report on standard error0: do not print progress report
tmpfile=<filename>β prefix for temporary files. By default the temporary files are created in the current directory.md5=<0|1>β md5 checksum creation for output file. Valid values are:0: do not compute checksum. This is the default.1: compute checksum. If themd5filenamekey is set, then the checksum is written to the given file. Ifmd5filenameis unset, then no checksum will be computed.
md5filenameβ file name for md5 checksum ifmd5=1.threads=<[1]>β number of threads used for processing. By default1thread is used. Set to0for using as many threads as CPU cores detected.
ok real talk bestie, watch out for the gotcha:calmdnm=1andreplacecigar=1both needcalmdnmreferenceset, andmd5=1does literally nothing unlessmd5filenameis set too. the more you know πβ¨
π AUTHOR π
Written by German Tischler. π«Ά
π REPORTING BUGS π
Report bugs to <germant@miltenyibiotec.de>
π COPYRIGHT π
Copyright Β© 2009-2019 German Tischler, Β© 2011-2013 Genome Research Limited. License GPLv3+: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
no warranty bestie, it's giving "use at your own risk" but make it legal π
and that's the whole page!! from the BIOBAMBAM girlies, dated July 2019 β go merge those BAMs, you absolute main character πβ¨π¦
π¦ where this page comes from
- debian bookworm: biobambam2 2.0.185+ds-1 Β· GPL-3.0-or-later
- debian trixie: biobambam2 2.0.185+ds-2 Β· GPL-3.0-or-later
- ubuntu jammy: biobambam2 2.0.183+ds-1 Β· GPL-3.0-or-later
- ubuntu noble: biobambam2 2.0.185+ds-1 Β· GPL-3.0-or-later
- ubuntu questing: biobambam2 2.0.185+ds-2
- ubuntu resolute: biobambam2 2.0.185+ds-2build1 Β· GPL-3.0-or-later
- ubuntu stonking: biobambam2 2.0.185+ds-2build1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms