Code Monkey home page Code Monkey logo

capalyzer's Introduction

Capalyzer

CircleCI Documentation Status

CAPalyzer provides two utilities connected to the MetaSUB Core Analysis Pipeline. It condenses the results of the CAP into summary data tables and it provides utilities to parse those tables.

Read The Docs

Installation

From PyPi

pip install capalyzer

From source

git clone [email protected]:dcdanko/capalyzer.git
cd capalyzer
python setup.py install

Building a data packet

From the command line

capalyzer make-tables <cap result dir> <data packet dir>

In Code

#! /bin/env python3

from capalyzer.packet_builder import make_all_tables


filenames = make_all_tables(<cap result dir>, <data packet dir>)
for filename in filenames:
    print(filename)

Parsing a data packet

#! /bin/env python3

from capalyzer.packet_parser import DataTableFactory

table_factory = DataTableFactory(<data packet dir>)
taxa_tbl = table_factory.taxonomy()
amr_tbl = table_factory.amrs()
hmp-tbl = table_factory.hmp()

Getting diversity scores

You can generate alpha diversity metrics using this package.

Available metrics

  • shannon entropy
  • richness
  • chao1 richness

All metrics can be rarefied to a certain number of reads with the rarefy parameter.

from capalyzer.packet_parser import DataTableFactory

table_factory = DataTableFactory(<data packet dir>)

krakenhll_richness = table_factory.taxa_alpha_diversity(metric='richness', rarefy=1000000)  # krakenhll is the default tool
metaphlan2_entropy = table_factory.taxa_alpha_diversity(tool='metaphlan2')  # entropy is the default metric

Generally krakenhll is prefereable to metaphlan2 as it captures more diversity.

beta diversity scores are also supported

from capalyzer.packet_parser import DataTableFactory

table_factory = DataTableFactory(<data packet dir>)

jensen_shannon = table_factory.taxa_beta_diversity(metric='jsd')
rho_proportionality = table_factory.taxa_beta_diversity(metric='rho')

Diversity metrics may also be generated using the CLI.

capalyzer diversity alpha --help
capalyzer diversity beta --help

Credits

This package is written and maintained by David C. Danko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.