Skip to main content

Determine if a series of lines is partitioned (all identical lines sequential).

Project description

The partitioned package is a simple Python script to check if a sequence of lines is partitioned (all duplicate lines are sequential).

Example of partitioned lines (where partitioned exits 0): WORLD WORLD HELLO HELLO

Note the above are not sorted, only partitioned! The partitioned tool does not detect if its input is sorted.

Example of unpartitioned lines (where partitioned exits 1): HELLO WORLD HELLO WORLD

The original motive for partitioned was for bioinformatics, specifically to determine if a .sam/.bam file was partitioned by readID, permitting a time-consuming sort by name that is usually unnecessary. An example of how it can be used for this is:

samtools view demo.bam | awk -F'\\t' '{ print \$1 }' | partitioned && echo "demo.bam is partitioned by readID" || echo "demo.bam is not partitioned by readID"

Details:

  • partitioned exits 0 (success) if the file is partitioned, 1 otherwise.
  • It uses a temporary SQLite3 database cache previously seen lines. This starts primarily in memory and spills to disk if necessary and is cleaned up automatically when the command terminates.
  • It can also read from a file with -i (streams from stdin if unspecified).
  • Pragmas can be set with --pragmas as a space-separated list.
  • The number of lines read in at once is configurable with --chunk-size (default is 1 million lines).

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

partitioned-0.1.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

partitioned-0.1.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file partitioned-0.1.4.tar.gz.

File metadata

  • Download URL: partitioned-0.1.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for partitioned-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ca7d1afcff9168b0fdc9a77d8cbd5c6ecce997c6d722771fe5debf61e73fec97
MD5 6d9fb12a9f47243c92231d87ac07e2f3
BLAKE2b-256 dc0c7e2b383cc4d0e0aa731bc86272e4b2ace7c3d61c0b87bf4874baed70e92c

See more details on using hashes here.

File details

Details for the file partitioned-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: partitioned-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for partitioned-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 77dccaf3f06c9b17d378408aea17d523dd2dd1a5a0417155a5377c918a54cb9a
MD5 b59d674344a2a0aedcbc6ba9fc7668dd
BLAKE2b-256 b7bf6dd8f4a4b609b469da9f6fe7b7ea915b8d99ba5ab2ed3fbee2e765b95b78

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