capalyzer.packet_parser package

Submodules

capalyzer.packet_parser.cli module

capalyzer.packet_parser.dataframes module

class capalyzer.packet_parser.dataframes.DataTableFactory(packet_dir, metadata_tbl=None)[source]

Bases: object

ags(**kwargs)[source]

Return a Series of Ave Genome Size estimates.

alpha_diversity(tbl, **kwargs)[source]

Return generic alpha diversity table.

amr_alpha_diversity(**kwargs)[source]

Return a Series of diversities.

amr_beta_diversity(**kwargs)[source]

Return a distance matrix between taxa.

amr_rarefaction(**kwargs)[source]

Return a rarefaction analysis of taxa.

amrs(**kwargs)[source]

Return an AMR table.

beta_diversity(tbl, **kwargs)[source]

Return generic beta diversity table.

copy(new_metadata=None)[source]

Return a deep copy, with a new metadata table. if specified

core_taxa(core_thresh=0.9, pan_thresh=0.2, zero_thresh=0, **kwargs)[source]

Return a pandas dataframe grouping taxa into core, pan, and peripheral.

csv_in_dir(fname, **kwargs)[source]
filter_dataframe(tbl, **kwargs)[source]
hmp(**kwargs)[source]

Return a table of HMP distances.

macrobes(**kwargs)[source]

Return a table of macrobe abundances.

pathways(coverage_min=0, **kwargs)[source]

Return a table of pathways.

rarefaction(tbl, **kwargs)[source]
read_props(**kwargs)[source]

Return a table of the proportion of reads assigned to macro categories.

read_stats(**kwargs)[source]

Return a table of the gc content and reads counts.

set_metadata(metadata_tbl)[source]

Set the internal metadata table which will be used to filter samples in tables.

taxa_alpha_diversity(**kwargs)[source]

Return a Series of diversities.

taxa_beta_diversity(**kwargs)[source]

Return a distance matrix between taxa.

taxa_rarefaction(**kwargs)[source]

Return a rarefaction analysis of taxa.

taxonomy(**kwargs)[source]

Return a taxonomy table.

capalyzer.packet_parser.diversity_metrics module

capalyzer.packet_parser.diversity_metrics.chao1(row, rarefy=0)[source]

Return richnes of an iterable

capalyzer.packet_parser.diversity_metrics.clr(X)[source]
capalyzer.packet_parser.diversity_metrics.jensen_shannon_dist(P, Q)[source]
capalyzer.packet_parser.diversity_metrics.random() → x in the interval [0, 1).
capalyzer.packet_parser.diversity_metrics.rarefaction_analysis(tbl, ns=[], nsample=16, include_all=True)[source]

Return a dataframe with two columns.

N, the number of samples and Taxa, the number of nonzero elements.

capalyzer.packet_parser.diversity_metrics.rho_proportionality(P, Q)[source]
capalyzer.packet_parser.diversity_metrics.richness(row, rarefy=0, count=False)[source]

Return the richness of an iterable.

capalyzer.packet_parser.diversity_metrics.shannon_entropy(row, rarefy=0)[source]

Return the shannon entropy of an iterable.

Shannon entropy is robust to rarefaction but we keep the param for consistency.

capalyzer.packet_parser.diversity_metrics.single_rarefaction(tbl, n=0)[source]

Return the number of nonzero columns in tbl.

Select n rows at random if specified.

capalyzer.packet_parser.longform_parser module

capalyzer.packet_parser.longform_parser.parse_longform_taxa(filename, rank='all', strict=512, min_reads=0, min_cov=0, max_read_slope=0, exclude_ranks=['assembly', 'sequence'])[source]

Return a pandas dataframe.

capalyzer.packet_parser.taxa_tree module

class capalyzer.packet_parser.taxa_tree.NCBITaxaTree(parent_map, names_to_nodes, nodes_to_name)[source]

Bases: object

ancestor_rank(rank, taxon, default=None)[source]

Return the ancestor of taxon at the given rank.

ancestors(taxon)[source]

Return a list of all ancestors of the taxon starting with the taxon itself.

genus(taxon, default=None)[source]

Return the genus for the given taxon.

parent(taxon)[source]

Return the name of the parent taxon.

classmethod parse_files(names_filename=None, nodes_filename=None)[source]

Return a tree parsed from the given files.

phyla(taxon, default=None)[source]

Return the phyla for the given taxon.

rank(taxon)[source]

Return the rank of the given taxon.

ranked_ancestors(taxon)[source]

Return a dict of all ancestors of the taxon starting with the taxon itself.

Keys of the dict are taxon ranks

taxa_sort(taxa)[source]

Return a list with all elements of taxa in DFS order.

class capalyzer.packet_parser.taxa_tree.TaxaTree(taxa, ncbi_tree=None)[source]

Bases: object

Represent a taxa tree for a specific set of taxa.

Uses the NCBI taxonomy.

to_newick()[source]

Return a newick string corresponding to this tree.

Module contents