BAMTOFASTQ(1)
π bamtofastq β straight from the General Commands Manual π
okay so bestie, this is the bamtofastq(1) page and it's genuinely one of the most useful little guys in the whole biobambam lineup. no cap. let's get into it π
β¨ NAME β¨
bamtofastq β convert SAM, BAM or CRAM files to FastQ π¦
β¨ SYNOPSIS β¨
bamtofastq [options]
β¨ DESCRIPTION β¨
okay so here's the vibe: bamtofastq reads a SAM, BAM or CRAM file from standard input and converts it into the FastQ format. and the way that it can split the output into multiple files according to the pair flags of the reads involved? iconic. it can also collate the source reads according to their read names, which basically means it places pairs of reads next to each other in the output, which is so satisfying honestly. π«Ά
by default bamtofastq writes its output to the standard output channel, and all output channels can be compressed using gzip. slay.
β¨ DESCRIPTION, but it's the key=value pairs β¨
here's the whole menu of key=value pairs you can hand it. don't skip any, they're all cute and they all matter:
F=<stdout>β output file for the first mates of pairs if collation is active.F2=<stdout>β output file for the second mates of pairs if collation is active.S=<stdout>β output file for single end reads if collation is active.O=<stdout>β output file for unmatched (orphan) first mates if collation is active.O2=<stdout>β output file for unmatched (orphan) second mates if collation is active.collate=<0|1>β valid values are:1: collate read pairs0: output reads to standard output in the order in which they appear in the BAM file
combs=<0|1>β print some counts after finishing collation based output. lil summary moment β¨filename=<stdin>β input file name (data is read from standard input if this option is not given).inputformat=<bam>β input file format. All versions of bamtofastq come with support for the BAM input format. If the program in addition is linked to theio_libpackage, then the following 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)
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. sneaky but valid π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 as 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
β οΈ bestie listen. disablevalidation=1 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. like, fr fr. be careful with that one.
colhlog=<18>β base two logarithm of the size of the hash table used for collation. the default value is18and should work reasonably well for most input files. please see the biobambam paper atarxiv.org/abs/1306.0836for details πcolsbs=<128M>β size of hash table overflow list in bytes. the default is128MBand should work reasonably well for most input files. please see the biobambam paper atarxiv.org/abs/1306.0836for details.T=<bamtofastq_hostname_pid_time>β file name of temporary file used for collation.ranges=<>β 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 position50000to the end ofchr1) - interval on reference sequence: an interval on a reference sequence (e.g.
"chr1:50000-60000"which means alignments overlapping positions50000to60000onchr1)
- 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.
gz=<[0|1]>β compress output files using gzip. by default output is uncompressed.level=<-1|0|1|9|11>β set compression level of the output FastQ/FastA files ifgz=1. valid values are:-1: zlib/gzip default compression level0: uncompressed1: zlib/gzip level 1 (fast) compression9: zlib/gzip level 9 (best) compression
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 an additional valid value is:
11: igzip compression
fasta=<0|1>β output FastA instead of FastQ iffasta=1. plot twist πoutputperreadgroup=<0|1>β split output by read group ifoutputperreadgroup=1(default is0). If splitting by read group is performed then no output is written on standard output but all data is written to files. the file names will be generated using theoutputdirandoutputperreadgroupsuffixparameters and read group names.outputdir=<>β output directory ifoutputperreadgroup=1. by default the output files are generated in the current directory.outputperreadgrouprgsm=<0|1>β includeSMfield of read group in output filenames ifoutputperreadgroup=1(default is0).outputperreadgroupprefix=β add given prefix ahead of file names ifoutputperreadgroup=1(default is to add no prefix).outputperreadgroupsuffixF=<_1.fq>β output file name suffix for first mates of complete pairs ifoutputperreadgroup=1. default is_1.fqifgz=0and_1.fq.gzforgz=1.outputperreadgroupsuffixF2=<_2.fq>β output file name suffix for second mates of complete pairs ifoutputperreadgroup=1. default is_2.fqifgz=0and_2.fq.gzforgz=1.outputperreadgroupsuffixO=<_o1.fq>β output file name suffix for first mates of incomplete pairs ifoutputperreadgroup=1. default is_o1.fqifgz=0and_o1.fq.gzforgz=1.outputperreadgroupsuffixO2=<_o2.fq>β output file name suffix for second mates of incomplete pairs ifoutputperreadgroup=1. default is_o2.fqifgz=0and_o2.fq.gzforgz=1.outputperreadgroupsuffixS=<_s.fq>β output file name suffix for singled end reads ifoutputperreadgroup=1. default is_s.fqifgz=0and_s.fq.gzforgz=1.tryoq=<0|1>β use content ofOQaux field if present instead of quality field when converting to FastQ. by default the quality field is used. this option is currently mutually exclusive with thetagsoption.tags=<>β provide a comma separated list of aux fields which will be copied from the input alignment records to the comment section of the output FastQ records. by default no aux fields are copied. this option is currently mutually exclusive with thetryoqoption.split=<0>β split named output files into chunks of this number of reads. the output file names will be extended by_NNNNNNifgz=0and by_NNNNNN.gzifgz=1whereNNNNNNdenotes theNNNNNN+1'th output file (i.e. numbers start with000000). the suffixesk,m,g,K,MandGcan be used to denote that the argument is to be multiplied by1024,1024^2,1024^3,1000,1000^2or1000^3respectively. so much math, so cute πcols=<>β if set to an unsigned number then wrap the sequence and quality lines at this number of columns. by default no wrapping is performed.splitprefix=<bamtofastq_split>β file prefix ifsplit>0andcollate=0.casava18=<0>β produce read names as expected by thec18peinput option offastqtobamusing theneaux fields produced byfastqtobam.maxoutput=<>β produce no more than this number of output records. by default there is no limit. this option is only active forcollate=0.
β¨ AUTHOR β¨
Written by German Tischler. π
β¨ REPORTING BUGS β¨
found a bug? report it to <germant@miltenyibiotec.de> π (be nice about it bestie)
β¨ COPYRIGHT β¨
Copyright Β© 2009-2014 German Tischler, Β© 2011-2014 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. (iykyk, no warranty no cap π)
and that's the whole page bestie!! this was BIOBAMBAM, dated March 2014, and it lives at BAMTOFASTQ(1) β go forth and convert some alignments, 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