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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca7d1afcff9168b0fdc9a77d8cbd5c6ecce997c6d722771fe5debf61e73fec97 |
|
MD5 | 6d9fb12a9f47243c92231d87ac07e2f3 |
|
BLAKE2b-256 | dc0c7e2b383cc4d0e0aa731bc86272e4b2ace7c3d61c0b87bf4874baed70e92c |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77dccaf3f06c9b17d378408aea17d523dd2dd1a5a0417155a5377c918a54cb9a |
|
MD5 | b59d674344a2a0aedcbc6ba9fc7668dd |
|
BLAKE2b-256 | b7bf6dd8f4a4b609b469da9f6fe7b7ea915b8d99ba5ab2ed3fbee2e765b95b78 |