Skip to main content

Utilities for generation of synthetic NGS files

Project description

Utilities for generation of synthetic NGS files.

A simple showcase:

from ngs_test_utils import testcase

class ExampleTestCase(testcase.NgsTestCase):
    """NGS-test-utils showcase."""

    def test_example(self):
        """Make a simple GTf and BAM file."""

        self.gtf = self.make_gtf([
            dict(feature="gene", start=100, end=500, gene_id="G1"),
            dict(feature="exon", start=100, end=200, gene_id="G1"),
            dict(feature="exon", start=400, end=500, gene_id="G1"),
        ])

        self.bam = self.make_bam(
            chroms=[("chr1", 1000)],
            segments=[
                dict(qname="r1", pos=150, cigar=[(0, 75)]),
                dict(qname="r2", pos=250, cigar=[(0, 150)]),
            ],
        )

        # Use these files to run your tests...

In the above example you can see:

  • Test case class subclasses testcase.NgsTestCase instead of unittest.TestCase. This class brings in all the methods for generating synthetic files.

  • Methods for generation of files aim to support “Pythonic” construction of NGS files from scratch. Although the methods try to be user-friendly, one needs to be familiar with the structure of the file format.

  • Method self.make_gtf accepts list of GTF segments. Each of these segments represents a line in a GTF file. Segment is given as a dict of values that represent columns (and attributes) of a line in GTF file.

  • Method self.make_bam accepts a list of chromosomes (this is ingredient for BAM header) and list of segments (for BAM body).

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

ngs_test_utils-0.0.6.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

ngs_test_utils-0.0.6-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file ngs_test_utils-0.0.6.tar.gz.

File metadata

  • Download URL: ngs_test_utils-0.0.6.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for ngs_test_utils-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4db672dd2e1ceab094e123e45316614a4ba2c3f67da33e6ca6c4f4092621f9e4
MD5 6765764f3362cbac72ef782f95142f0c
BLAKE2b-256 97453922dc185eece66ac225b995634fbcbfeb9dbea628ec9829d959f4a0da62

See more details on using hashes here.

File details

Details for the file ngs_test_utils-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for ngs_test_utils-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bf55dcf4e1f085249f213dafd50f456378cc5f7c058ca945c34284af16346140
MD5 b548f8a1deee0706159d1eaf5b1ce53e
BLAKE2b-256 5047bdd91e19f72d4ce104ed67f2838d8f17fc548b18c692db24ce7ba08d7db5

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