thapbi_pict.edit_graph module

Generate edit-distance network graph from FASTA files.

This implements the thapbi_pict edit-graph ... command.

thapbi_pict.edit_graph.main(graph_output: str, graph_format: str, db_url: str, input_file: str, min_abundance: int = 100, show_db_marker: str | None = None, total_min_abundance: int = 0, min_samples: int = 0, max_edit_dist: int = 3, ignore_prefixes: tuple[str, ...] | None = None, debug: bool = False) int

Run the edit-graph command with arguments from the command line.

This shows sequences from a database (possibly filtered with species/genus limits) and/or selected sample-tally TSV file (optionally with classifier output, and possibly with a minimum abundance limit set here).

Computes a Levenshtein edit-distance matrix from the selected sequences, which can be exported as a matrix, but is usually converted into a graph of unique sequences as nodes, with short edit distances as edges.

Graph node size is scaled by sample count (number of FASTA files that it appears in), and colored by assigned species (from a classifier TSV file).

thapbi_pict.edit_graph.write_pdf(G, handle) None

Render NetworkX graph to PDF using GraphViz fdp.

thapbi_pict.edit_graph.write_xgmml(G, handle, name: str = 'THAPBI PICT edit-graph') None

Save graph in XGMML format suitable for Cytoscape import.