Skip to main content

Library of Python utilities that I needed so many times

Project description

ddgen

Library of Python utilities that I needed so many times in the past

Select RefSeq transcript with the highest priority

RefSeq transcripts have following categories:

  • NM_, XM_, NR_, XR_

If we have transcripts from multiple sources, we want to select the one coming from the source with highest priority.

E.g. NM_ has higher priority than XM_.

If we have multiple transcripts from a single source, we want to select the one with smaller integer.

E.g. NM_123.4 has higher priority than NM_124.4.

from ddgen.utils import txs

# tx will be `NM_123.4`
tx = txs.prioritize_refseq_transcripts(['NM_123.4', 'NM_124.4', 'XM_100.1'])

Connect to H2 database

The H2 database is a pure Java SQL database, hence it is primarily meant to be used with Java. We can connect to the database from Python, if:

  • Java is installed on the local machine
  • the local machine runs UNIX-like OS (sorry, Windows users)

In that case:

from ddgen.db import H2DbManager

with H2DbManager("path/to/sv_database.mv.db", 
                 user="sa", 
                 password="sa") as h2:
    with h2.get_connection() as conn:
        with conn.cursor() as cur:
            # do whatever you want
            cur.execute('SELECT * FROM PBGA.CLINGEN_TRIPLOSENSITIVITY;')
            for i, x in zip(range(5), cur.fetchall()):
                # print first 5 lines 
                print(x)

Setup logging

Quick setup of Python built-in logging library:

from ddgen.utils import setup_logging
setup_logging()

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

ddgen-0.0.4.tar.gz (2.1 MB view details)

Uploaded Source

Built Distributions

ddgen-0.0.4-py3.6.egg (2.1 MB view details)

Uploaded Source

ddgen-0.0.4-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file ddgen-0.0.4.tar.gz.

File metadata

  • Download URL: ddgen-0.0.4.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for ddgen-0.0.4.tar.gz
Algorithm Hash digest
SHA256 42945740963bb64498b5f5727bb659ff28ca05c0bc1897b637dbee45fab58455
MD5 8c1212cad56ba6cc8e2d9c60e0d129ec
BLAKE2b-256 4a7e2d4ebc89e3cd29d9ef1222d3b89c880bec88f281e135d11381600b7ce1e2

See more details on using hashes here.

File details

Details for the file ddgen-0.0.4-py3.6.egg.

File metadata

  • Download URL: ddgen-0.0.4-py3.6.egg
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for ddgen-0.0.4-py3.6.egg
Algorithm Hash digest
SHA256 9be90ca9e41664b0700de13cbb1a6e4ec1d555f7ecb3c30b05911ee7ddb981db
MD5 4d31f249d9b52387a95f68edfbd22eb8
BLAKE2b-256 de1b6efb13d2ad4451a42b2f9338757e87bdff1c60da49fee399e68acd2d436b

See more details on using hashes here.

File details

Details for the file ddgen-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: ddgen-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for ddgen-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9c83f8f3b16eaa802d1d999ecdbdf2405df772a5ef027853957ff74e8be40f11
MD5 ca36b55e599a09aefca9ecccbe3ac2f2
BLAKE2b-256 5ad857895a6e78e631736e99c67a0c2348d72003210a7706b1b06cde01f5d391

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