Skip to main content

Generate cov3 files used in DEMIC

Project description

pycov3

CI codecov Super-Linter Codacy Badge

A package for generating cov3 files which are generated from sam files giving coverage information and a fasta file giving binned contigs. Cov3 files are used as input for the DEMIC R package which calculates PTR, an estimate for bacterial growth rates.

Install it from PyPI

pip install pycov3

Usage

Create a SAM directory and FASTA directory, set any non-default window or coverage parameters, then create a COV3 directory and use it to generate a COV3 file for each contig set in the FASTA directory.

    from pycov3.Directory import Cov3Dir, FastaDir, SamDir

    sam_d = SamDir(Path("/path/to/sams/"), False)

    window_params = {
        "window_size": None,
        "window_step": None,
        "edge_length": sam_d.calculate_edge_length(),
    }
    coverage_params = {
        "mapq_cutoff": None,
        "mapl_cutoff": None,
        "max_mismatch_ratio": None,
    }
    window_params = {k: v for k, v in window_params.items() if v is not None}
    coverage_params = {k: v for k, v in coverage_params.items() if v is not None}

    fasta_d = FastaDir(Path("/path/to/fastas/"), False)

    cov3_d = Cov3Dir(
        Path(args.out_dir),
        False,
        fasta_d.get_filenames(),
        window_params,
        coverage_params,
    )

    cov3_d.generate(sam_d, fasta_d)

Alternatively, to use the bare application logic and do all the file handling yourself, you can use the Cov3Generator class which takes a list of generators as SAM inputs and a generator as a FASTA input.

    from pycov3.Cov3Generator import Cov3Generator

    cov3_generator = Cov3Generator(
        sam_generators,
        fasta_generator,
        sample,
        bin_name,
        window_params,
        **coverage_params,
    )

    cov3_dict = cov3_generator.generate()
$ python -m pycov3 -h
#or
$ pycov3 -h

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

pycov3-1.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

pycov3-1.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file pycov3-1.1.0.tar.gz.

File metadata

  • Download URL: pycov3-1.1.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycov3-1.1.0.tar.gz
Algorithm Hash digest
SHA256 33f3adcef579461d568d89f96d804d89873934a70dc63325218293b6a76c5780
MD5 375ee55d4f6976fdbc513301f6df1116
BLAKE2b-256 f9c9c41435d7cb4725728a9e3de4a891f10aa129bdc56eecd434e99fbb305be6

See more details on using hashes here.

File details

Details for the file pycov3-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycov3-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycov3-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bf38a98632d5b504c868f0544f10b4cc8419039badda26c4e7a8810f9e7ef57
MD5 85d722aa68a78bedad0cae9a7cc903a3
BLAKE2b-256 8a3edca886c812af7bc7c687188f4b6685f7ea37ffa61fe5c92e796b52ea822e

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