pyani.pyani_tools module¶
Code to support pyani.
-
class
pyani.pyani_tools.
ANIResults
(labels: List[str], mode: str)[source]¶ Bases:
object
Holds ANI dataframe results.
-
add_coverage
(qname: str, sname: str, qcover: float, scover: Optional[float] = None) → None[source]¶ Add percentage coverage values to self.alignment_coverage.
Parameters: - qname –
- sname –
- value –
- sym –
-
add_pid
(qname: str, sname: str, value: float, sym: bool = True) → None[source]¶ Add a percentage identity value to self.percentage_identity.
Parameters: - qname –
- sname –
- value –
- sym –
-
add_sim_errors
(qname: str, sname: str, value: float, sym: bool = True) → None[source]¶ Add a similarity error value to self.similarity_errors.
Parameters: - qname –
- sname –
- value –
- sym –
-
add_tot_length
(qname: str, sname: str, value: float, sym: bool = True) → None[source]¶ Add a total length value to self.alignment_lengths.
Parameters: - qname –
- sname –
- value –
- sym –
-
data
¶ Return list of (dataframe, filestem) tuples.
-
hadamard
¶ Return Hadamard matrix (identity * coverage).
-
-
class
pyani.pyani_tools.
BLASTcmds
(funcs: pyani.pyani_tools.BLASTfunctions, exes: pyani.pyani_tools.BLASTexes, prefix: str, outdir: pathlib.Path)[source]¶ Bases:
object
Class for construction of BLASTN and database formatting commands.
-
build_blast_cmd
(fname: pathlib.Path, dbname: pathlib.Path)[source]¶ Return BLASTN command.
Parameters: - fname – Path to query file
- dbname – Path to database
-
-
class
pyani.pyani_tools.
BLASTexes
[source]¶ Bases:
tuple
Convenience structure to hold BLAST executables.
-
blast_exe
¶ Alias for field number 1
-
format_exe
¶ Alias for field number 0
-
-
class
pyani.pyani_tools.
BLASTfunctions
[source]¶ Bases:
tuple
Convenience structure to hold BLAST functions.
-
blastn_func
¶ Alias for field number 1
-
db_func
¶ Alias for field number 0
-
-
class
pyani.pyani_tools.
Dependencies
[source]¶ Bases:
tuple
Convenience struct for third-party dependency presence.
-
blast
¶ Alias for field number 0
-
legacy_blast
¶ Alias for field number 1
-
mummer
¶ Alias for field number 2
-
-
class
pyani.pyani_tools.
MatrixData
[source]¶ Bases:
tuple
Convenience struct for matrix data returned by ORM.
-
data
¶ Alias for field number 1
-
graphic_args
¶ Alias for field number 2
-
name
¶ Alias for field number 0
-
-
pyani.pyani_tools.
get_genome_length
(filename: pathlib.Path) → int[source]¶ Return total length of all sequences in a FASTA file.
Parameters: filename – path to FASTA file
-
pyani.pyani_tools.
get_labels
(filename: pathlib.Path, logger: Optional[logging.Logger] = None) → Dict[KT, VT][source]¶ Return dictionary of alternative sequence labels, or None.
Parameters: - filename – path to file containing tab-separated table of labels
- logger – logging object
Input files should be formatted as <hash>t<key>t<label>, one pair per line.
-
pyani.pyani_tools.
has_dependencies
() → pyani.pyani_tools.Dependencies[source]¶ Return NamedTuple indicating if 3rd dependencies are available.
-
pyani.pyani_tools.
label_results_matrix
(matrix: pandas.core.frame.DataFrame, labels: Dict[KT, VT]) → pandas.core.frame.DataFrame[source]¶ Return results matrix dataframe with labels.
Parameters: - matrix – results dataframe deriving from Run object
- labels – dictionary of genome labels labels must be keyed by index/col values from matrix
Applies the labels from the dictionary to the dataframe in matrix, and returns the result.