scramble(1)
π¦ NAME π¦
okay so bestie, gather round β this is scramble, from the Staden io_lib manual, section 1 (aka the "run this in your shell" section, iykyk). It converts between the SAM, BAM and CRAM file formats. That's the whole job. That's the girlboss assignment. π
β¨ SYNOPSIS β¨
scramble [options] [input_file [output_file]]
πΈ DESCRIPTION πΈ
scramble converts between various next-gen sequencing alignment file formats, including SAM, BAM and CRAM. It can either act as a pipe reading stdin and writing to stdout, or it can work on named files. Two moods, both iconic. π«Ά
When it's operating as a pipe, the input type defaults to SAM or BAM, so you need the -I cram option to indicate that the input is in CRAM format β otherwise it'll guess and honestly bestie, guessing is not the vibe. The output defaults to BAM, but you can adjust that with the -O format option. And when you give it filenames, the file type is automatically chosen based on the filename suffix. No cap, it just knows. π₯
π OPTIONS π
-Iformat β Selects the input format, where format is one ofsam,bamorcram. Use this when reading via a pipe so you avoid input bytes being consumed when it's trying to detect whether the input is in SAM or BAM format. (Bytes getting eaten mid-detection is not the serve, so just tell it.) π-Oformat β Selects the output format, where format is one ofsam,bamorcram.-1to-9β Sets the compression level from1(low compression, fast) to9(high compression, slow) when writing in BAM or CRAM format. This is only used during writing. Reading does not care, she is unbothered. β¨-0or-uβ Writes uncompressed data. In BAM this still usesBGZFcontainers, but with no internal compression. In CRAM it stores blocks inRAWformat instead. The option has no effect on SAM output.-jβ CRAM encoding only. Adds bzip2 to the list of compression codes potentially used during CRAM creation.-Zβ CRAM encoding only. Adds lzma to the list of compression codes potentially used during CRAM creation. Given the slow compression speed of lzma, this may only be used where it gives a significant advantage over zlib or bzip2 β but with higher compression levels (-7) this weighting is ignored, as LZMA decompression speed is acceptable, albeit still slower than zlib. She's slow to get ready but she arrives cute. π-mβ CRAM decoding only. GeneratesMD:Z:andNM:I:auxiliary fields based on the reference-based compression.-Mβ CRAM encoding only. Forcibly packs sequences from multiple references into the same slice. Normally CRAM will start a new slice when changing from one reference to another, but it will still automatically switch to multi-reference slices if the number of sequences per slice becomes too small.-Rrange β Currently for CRAM input only, but SAM/BAM support is pending. This indicates a reference sequence name and optionally a start and end location within that reference, using the syntaxref_nameorref_name:start-end. For efficient operation the CRAM file needs a.craiformat index (built using thecram_indexprogram). No index, no shortcut, sorry bestie. π-rref.fa β CRAM encoding only. Use this to specify the reference fasta file. Note that if the input SAM or BAM file has afile:or local file system based URI specified in the@SQheaders then this option may not be necessary.-snumber β CRAM encoding only. Specifies the number of sequences per slice. Defaults to10000.-Snumber β CRAM encoding only. Specifies the number of slices per container. Defaults to1.-tβ BAM and CRAM only. Specifies the number of compression or decompression threads, adaptively shared between both encoding and decoding. Defaults to1(no threading).-Vversion_string β CRAM encoding only. Sets the CRAM file format version. Supported values are"2.0","2.1"and"3.0".-eβ CRAM encoding only. Embeds snippets of the reference sequence in every slice. This means the files can be decoded without needing to specify the reference fasta file. Self-sufficient queen. π-Eβ CRAM encoding only. Embeds snippets of the consensus sequence in every slice. This operates as per the-eoption, but the consensus is generated from the aligned data. This does not therefore require a reference to be known during encode (although it is still a mandatory part of the specification that theSQSAM headers have anM5field). It also means the files can be decoded without needing to specify the reference fasta file.-xβ CRAM encoding only. Omits reference based compression and instead stores details of every base verbatim. Just raw honesty.-Bβ Experimental, encoding only. When storing quality values, bins into8discrete values (plus0), as typically used by modern Illumina instruments. (Note that the bins may not be precisely the same ranges.) She's experimental, be gentle. π§-!β CRAMv3.0and above decoding only. Do not check CRCs. This option should only be used when attempting to recover from a data corruption.
bestie, for real, -! is an emergency-room option. Only when you're rescuing corrupted data. Not a casual Tuesday move.
-qβ Do not append@PGheader lines with thescrambleprogram name and arguments. Shy girl behaviour, respect.-Xmode β Encodes CRAM using a set of predefined parameters defined by mode. These are one offast,normal/default,smallorarchive.fast(param:-1 -s 1000) β Lightweight compression for speed and small slice size for quick fine-grained random access. zoom zoom π¦normal(param:none) β Default mode. This is the same as not specifying-X. For version3.1onwards this enables the name tokeniser ("-T").small(param v3.0:-j -s 25000, param v3.1 or v4:-Tf -s 25000) β Optimise for smaller files, with larger slices.archive(param v3.0:-j -s 100000, param v3.1 or v4:-Tfa -s 100000) β Optimised for smallest files, intended for data archival. This uses a large slice size and will have poorer random access. At level7onwards this also enables lzma compression if compiled in ("-Z").
-dtag-list β Discards all auxiliary tags except those listed in tag-list. The list is comma separated and contains the two letter tag codes specified as-is or with simplified regular expressions. Character classes such as"[A-W]"are permitted, but not with the negation code"^". Also"."is a synonym for any legal tag character. Hence"[A-Z][A-Z0-9]"represents all tag types belonging to the official namespace.
The option may be specified more than once, but it cannot be mixed with -D.
-Dtag-list β Discards auxiliary tags listed in tag-list, keeping everything else. The list is comma separated and contains only the two letter tag codes. As with-d, tag-list can be specified using a simplified regular expression. This means-D ..removes all auxiliary tags.
The option may be specified more than once, but it cannot be mixed with -d.
not me repeating it but fr fr:-dand-Dare mutually exclusive. Pick a lane. π
π EXAMPLES π
To convert a BAM file from stdin to CRAM on stdout, using reference MT.fa:
some_command | scramble -I bam -O cram -r MT.fa | some_command
The default CRAM output format is version 3.0. The command below enables the experimental newer compression codecs (NB: do not use this in production) using the "small" profile, while also removing all tag types reserved for local/private use. (Also consider -d [A-Z][A-Z0-9] instead of the -D arguments.)
scramble -V 3.1 -X small -D [a-zXYZ]. -D.[a-z] in.cram out.cram
okay bestie, that second one is experimental and not for production. The original says so, and I'm just the messenger. π
π AUTHOR π
James Bonfield, Wellcome Trust Sanger Institute β the actual icon, the blueprint, the moment. π
and that's the whole page, bestie! This one's from the Staden io_lib manual, dated December 6 2022, and it's page scramble(1). Go convert something and slay. π¦πβ¨
π¦ where this page comes from
- debian bookworm: staden-io-lib-utils 1.14.15-1 Β· GRL OR MRC
- debian trixie: staden-io-lib-utils 1.15.0-1.1+b2 Β· GRL OR MRC
- nixos 26.05: libstaden-read 1-15-1
- nixpkgs unstable: libstaden-read 1-15-1
- ubuntu noble: staden-io-lib-utils 1.15.0-1.1build2 Β· GRL OR MRC
- ubuntu questing: staden-io-lib-utils 1.15.0-1.1build2
- ubuntu resolute: staden-io-lib-utils 1.15.0-1.1build3 Β· GRL OR MRC
- ubuntu stonking: staden-io-lib-utils 1.15.1-1 Β· GRL OR MRC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms