BAMCOLLATE2(1)
π BAMCOLLATE2 π
okay so bestie, gather round, because bamcollate2 from the General Commands Manual is literally about to change your whole pipeline π
and yes she is that girl.
bamcollate2 β collate reads in a SAM, BAM or CRAM file by name π¦
β¨ SYNOPSIS β¨
bamcollate2 [options]
πΈ DESCRIPTION πΈ
so like, bamcollate2 reads a SAM, BAM or CRAM file from standard input, collates the reads/alignments it finds by name, and writes the whole thing back out to standard output in BAM format. no cap. that's the vibe. π«Ά
here are the key=value pairs you can hand her:
collate=<0|1|2|3>β the big one, the main character. valid values are:3β collate read pairs and attach post ranks (that's the line numbers of alignments in the output file) to each read. for pairs, this adds the prefixa_b_to a pair when the first read of the pair shows up in lineaand the second one in linebof the output file β e.g. the nameHS5gets changed to20_21_HS5for both ends if read 1 appears in line 20 and read 2 in line 21. for single end reads it adds the prefixa_to the name, whereais the rank (line number) of the read in the output file. and the pre rank (line number in the input file) is attached to each read by putting it in thezzauxiliary field as an eight byte number array, similar to the functionality ofbamrank. iconic behaviour honestly β¨2β collate read pairs and attach ranks (line numbers of alignments in the source file) to each read. for pairs this adds the prefixa_b_to a pair when the first read of the pair appears in lineaand the second one in linebof the source file, e.g. the nameHS5is changed to25_32_HS5for both ends if read 1 appears in line 25 and read 2 in line 32. for single end reads it adds the prefixa_to the name whereais the rank (line number) of the read in the source file.1β collate read pairs π0β do not collate, keep reads in the original order (chaos, but valid)
filename=<stdin>β input file name. if you don't give this option, data is read from standard input, which is the default. periodt.inputformat=<bam>β input file format. all versions ofbamcollate2come with support for the BAM input format. if the program is in addition linked to theio_libpackage, then these options are valid:bamβ BAM (seehttp://samtools.sourceforge.net/SAM1.pdf)samβ SAM (seehttp://samtools.sourceforge.net/SAM1.pdf)cramβ CRAM (seehttp://www.ebi.ac.uk/ena/about/cram_toolkit)
level=<-1|0|1|9|11>β set the 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
and if libmaus has been compiled with support for igzip (see https://software.intel.com/en-us/articles/igzip-a-high-performance-deflate-compressor-with-optimizations-for-genomic-data), then there's one more valid value:
11β igzip compression π
exclude=<SECONDARY>β do not include reads in the output that have any of the given flags set. the flags are given separated by commas. valid flags are:PAIREDβ read was paired in sequencingPROPER_PAIRβ read has been mapped as part of a proper pairUNMAPβ read was not mappedMUNMAPβ mate of read was not mappedREVERSEβ read was mapped to the reverse strandMREVERSEβ mate of read was mapped to the reverse strandREAD1β read was first read of a pair during sequencingREAD2β read was second read of a pair during sequencingSECONDARYβ alignment is secondary, i.e. an alternative mapping to the primary alignment in the same fileQCFAILβ read was marked as having failed quality controlDUPβ read is marked as a duplicate of another read in the same file (seebammarkduplicates)SUPPLEMENTARYβ read is marked as supplementary alignment
disablevalidation=<0>β valid values are:0β run input file validation on alignments (this is the default)1β do not check the validity of the input file. this may help for some broken input files, but it is a security risk as it can lead to the execution of arbitrary code through a forged input file.
π¨ bestie NO. disablevalidation=1 is giving "I trust this random file with my life". it can literally execute arbitrary code from a forged input file. be so serious rn. π
colhlog=<18>β base two logarithm of the size of the hash table used for collation. the default value is18and it should work reasonably well for most input files. please see the biobambam paper atarxiv.org/abs/1306.0836for details πcolsbs=<128M>β size of the hash table overflow list in bytes. the default is128Mand it should work reasonably well for most input files. please see the biobambam paper atarxiv.org/abs/1306.0836for details β¨T=<bamcollate2_hostname_pid_time>β file name of the temporary file used for collationranges=<>β coordinate ranges selected from input. this option is only available for input files in BAM and CRAM format which have a corresponding index file (.baifor BAM,.craifor CRAM) and if input is via file (i.e. thefilenameargument is set). valid ranges consist of either:- whole reference sequence β a whole reference sequence (e.g.
"chr1") - half open interval on reference sequence β an interval on a reference sequence half open on the right (e.g.
"chr1:50000"which means alignments overlappingchr1from position 50000 to the end ofchr1) - interval on reference sequence β an interval on a reference sequence (e.g.
"chr1:50000-60000"which means alignments overlapping positions 50000 to 60000 onchr1)
- whole reference sequence β a whole reference sequence (e.g.
for BAM input, multiple ranges are separated by space characters (e.g. ranges="chr1:10000-20000 chr1:30000-40000"). CRAM input supports a single range only. π
reference=β file name of the reference for CRAM input files. if this key is unset, then the CRAM file header will be scanned for obtaining a reference file name.md5=<0|1>β md5 checksum creation for the 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 the md5 checksum ifmd5=1.index=<0|1>β compute BAM index for the output file. valid values are:0β do not compute BAM index. this is the default.1β compute BAM index. if theindexfilenamekey is set, then the BAM index is written to the given file. ifindexfilenameis unset, then no BAM index will be computed.
indexfilenameβ file name for the BAM index ifindex=1.readgroupsβ comma separated list of read group identifiers to be kept. if not given, all records will be kept. read group filtering is only available ifcollate=0andcollate=1(i.e. this key is ignored forcollate=2andcollate=3).mapqthresβ mapping quality threshold. this option is only available forcollate=1(i.e. it is ignored forcollate=0andcollate>1). if this key is set, reads are kept if the mapping quality field is at least the given value. for paired end reads it is sufficient for a read or its mate to have a mapping quality above the threshold.resetβ reduce alignments to an unmapped state (seebamreset). this key is only valid forcollate=0,collate=1orcollate=3. the default value is0forcollate=0andcollate=1and1forcollate=3.classesβ types of alignment lines to be kept. this key is only valid forcollate=1. by default all alignments are kept. the value for this key is a comma separated list consisting of a subset of the following options:Fβ keep first mates of complete pairsF2β keep second mates of complete pairsOβ keep first mates of orphaned pairs (i.e. such that the other mate is not in the input file)O2β keep second mates of orphaned pairs (i.e. such that the other mate is not in the input file)Sβ keep single end reads
resetheadertextβ file name for replacement SAM header. by default the header of the input SAM/BAM/CRAM file is used (and filtered in case ofreset=1).resetaux=<0|1>β remove auxiliary fields ifresetaux=1. this key is only available forreset=1. ifreset=1then the default is to remove all aux fields.auxfilter=<>β comma separated list of aux tags to be kept ifreset=1andresetaux=0. if the key is not set then all tags are kept.outputformat=<bam>β output file format. all versions ofbamcollate2come with support for the BAM output format. if the program is in addition linked to theio_libpackage, then these options are valid:bamβ BAM (seehttp://samtools.sourceforge.net/SAM1.pdf)samβ SAM (seehttp://samtools.sourceforge.net/SAM1.pdf)cramβ CRAM (seehttp://www.ebi.ac.uk/ena/about/cram_toolkit). this format is not advisable for data not sorted by coordinate. π
O=<[stdout]>β output filename, standard output if unset.outputthreads=<[1]>β output helper threads, only valid foroutputformat=bam.verbose=<1>β valid values are:1β print progress report on standard error0β do not print progress report
replacereadgroupnames=<>β file name containing a list of read group mappings. each line in the file corresponds to one read group ID replacement and contains two columns separated by the tab symbol (ASCII code 9). the first column contains the source identifier which will be replaced by the value of the second column in the output file. this option is only valid forcollate<2. by default no read group identifier mapping is performed.
π AUTHOR π
written by German Tischler. we stan. π
π REPORTING BUGS π
report bugs to <germant@miltenyibiotec.de> β she wants to hear from you fr fr.
π COPYRIGHT π
copyright Β© 2009-2015 German Tischler, Β© 2011-2015 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. π«Ά
and that's the whole thing bestie β this page came to you from BIOBAMBAM, dated February 2015, and honestly? she ate. go collate something iconic. π β¨π¦
π¦ 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