Skip to main content

Snakemake utils

Project description

A set of utility function for use in snakemake. Currently, for line-based transformations.

Functions:

  • map_chars(cmap) - will translate characters using the given dictionary cmap.

  • del_char_idx(idx) - will delete the char at the given index.

  • del_char(char) - will delete all characters matching char param.

  • del_line(regex) - will delete line if it matches the given regex.

  • apply(trans, encoding, in_files, out_files) - will apply all transformations given in trans list to all lines in the in_files list producing output files from the out_files list.

Example

rule fixchars:
    input:
        "{natfile}.nat"
    output:
        "{natfile}-ch.nat"
    message:
        "Fixing/deleting chars/lines..."

    run:
        from snakemakeutils import del_char_val, del_char_idx, apply
        trans = [del_char_val('\x00'), del_char_idx(0)]
        apply(trans, "latin1", input, output)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakemakeutils-0.1.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file snakemakeutils-0.1.2.tar.gz.

File metadata

File hashes

Hashes for snakemakeutils-0.1.2.tar.gz
Algorithm Hash digest
SHA256 254650a4b32629b4b5957e37e72b879453d4b5b09a66fb45ee0395cfaa6c00b4
MD5 ddc21e4d3de95d0be02356b336381153
BLAKE2b-256 3d922332045acc02f37f913b7db27ae9c7fbcf0b01a8969ebc515aa9022995d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page