Skip to main content

Methods to help track the scripts and datafiles in a project.

Project description

Datatracker

Datatracker is a basic logging Python package that keeps track of files and code within a Project. Each script is logged as an entry and input and output datafiles are recorded in order. Datatracker is able to manage versioning of both files and scripts, and is able to identify the most up-to-date version.

At the moment, this Python package is still in alpha, and I may include changes to both UI and file format that may be breaking.

Installation

To install, run the following command:

pip install git+ssh://git@github.com/TarjinderSingh/datatracker

Usage

New entries

For an entry,

  1. tag is a unique identifier to the script in question and should be clear what the general purpose and output of the script is. (ie Merge is not what we want to see here)
  2. description needs to be one or two sentences equivalent of the Git commit message that thoroughly describes the general purpose and output of the script.
  3. category indicates the general step of analysis the script belongs to.
  4. module is the sub-category for which the script belongs to. Type category_template in interactive Python for an idea of the appropriate categories and modules are.

For a InputFile or OutputFile,

  1. tag is a unique identifier to the File in question and should be clear what the general purpose and output of the script is. (ie Merge is not what we want to see here).
  2. description for a file is a one or two sentences equivalent of the Git commit message that thoroughly describe the general purposes of the File at hand.
from datatracker import *
tr = Tracker()

os.environ['VERSION'] = '0.1.0'

entry = Entry(tag='filter-common-variants',
              description='Filtering common variants in new GWAS data set.',
              category='Processing',
              module='Variant QC')

infile = entry.add(
    InputFile(tag='raw-plink-file',
              path='gs://bucket/raw-plink-file.bed',
              description='Raw PLINK file.'))


outfile = entry.add(
    OutputFile(tag='filt-plink-file',
               path='gs://bucket/raw-plink-file.bed',
               description='Filtered PLINK file.'))

tr.save(entry)

View existing entries

from datatracker import *
tr = Tracker()

tr.table

Use existing entries for pipeline

infile = entry.add(InputFile(entry_tag='filter-common-variants', tag='raw-plink-file', database=tr))

Filter and remove

# filter to entry
tr.filter(tr.entry.tag_version == 'import-array_0.1.6')

# remove entry
tr.remove(tr.entry.tag_version == 'import-array_0.1.6')

Pandas and Excel

df = tr.explode()
df = tr.explode('filt-plink-file')

df = tr.to_pandas()
df = tr.table

df.to_excel('spreadsheet.xlsx')

Data artifacts

infile = entry.add(InputFile(path='gs://checkpoint-cache/tmp/1.bed'))

License

MIT License (see repository)

Maintainer

TJ Singh @ tsingh@broadinstitute.org

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

datatracker-0.2.1.1.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

datatracker-0.2.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file datatracker-0.2.1.1.tar.gz.

File metadata

  • Download URL: datatracker-0.2.1.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.4

File hashes

Hashes for datatracker-0.2.1.1.tar.gz
Algorithm Hash digest
SHA256 412efa011ac6d2a87193bc30158a2eb97e6dfcd2e1f647ed027b70a8d78d11b5
MD5 869aa404657c46fed49f27f5e59335fa
BLAKE2b-256 f9027c6bbfe60cf3789710b25b4fafab988f7a2f094e9658c559fb87f4d773b0

See more details on using hashes here.

File details

Details for the file datatracker-0.2.1.1-py3-none-any.whl.

File metadata

  • Download URL: datatracker-0.2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.4

File hashes

Hashes for datatracker-0.2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70719ff325efe7638a5da56372f6f065ba014b55f3975afbdbcef06717e7bc64
MD5 6462bb3fe4202e0d31efb4c39fd903f2
BLAKE2b-256 8986763e140547cfd5c84b63759ed8f7dcfb9266708f38930c2e20e5e93db591

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