pyhiv package
Subpackages
- pyhiv.align package
- pyhiv.loading package
- Submodules
- pyhiv.loading.read_fastas module
- pyhiv.loading.reference_update module
CrfReferenceDesiredReferenceGenBankRecordPartialGenBankRecordUnavailableLanlAlignmentLanlAlignmentUpdateResultLanlAlignmentUpdateResult.fasta_files_addedLanlAlignmentUpdateResult.fasta_files_reclassifiedLanlAlignmentUpdateResult.fasta_files_removedLanlAlignmentUpdateResult.fasta_files_updatedLanlAlignmentUpdateResult.fasta_recordsLanlAlignmentUpdateResult.pathLanlAlignmentUpdateResult.updatedLanlAlignmentUpdateResult.year
LanlReferenceRecordLocalReferenceSequenceConflictReconciliationErrorUpdateResultUpdateResult.added_rowsUpdateResult.added_sequencesUpdateResult.crfs_with_multiple_referencesUpdateResult.duplicate_rows_removedUpdateResult.failed_accessionsUpdateResult.failed_sequencesUpdateResult.lanl_alignment_updatedUpdateResult.lanl_alignment_yearUpdateResult.lanl_fasta_files_addedUpdateResult.lanl_fasta_files_removedUpdateResult.lanl_fasta_files_updatedUpdateResult.lanl_fasta_recordsUpdateResult.partial_sequences_rejectedUpdateResult.pending_ncbi_accessionsUpdateResult.pending_ncbi_referencesUpdateResult.reclassified_referencesUpdateResult.reference_fastas_dirUpdateResult.sequences_with_locationsUpdateResult.total_referencesUpdateResult.up_to_dateUpdateResult.updated_feature_rowsUpdateResult.updated_rows
accession_is_nonterminal_lanl_name_component()accession_is_parenthesized_reference_strain()accession_ranges_from_text()accessions_from_text()add_crf_references()add_desired_reference()are_same_crf_number_aliases()backup_existing_dir()backup_existing_file()build_desired_reference_map()choose_existing_reference_row()classification_context_references_from_text()classification_reference_contexts()clean_feature_name()commit_staged_reference_dataset()commit_staged_reference_fastas()count_crfs_with_multiple_references()crf_label_number()dedupe_accessions()dedupe_crf_references()default_reference_row()download_lanl_reference_alignment()download_latest_lanl_reference_alignment()duplicate_row_count()expand_accession_range()extract_lanl_alignment_content()extract_reference_strain()feature_bounds()fetch_genbank_sequence_and_features()genome_context_references_from_text()genome_reference_contexts()get_gene_locations()has_subgenomic_sequence_annotation()has_valid_genome_context()index_existing_reference_rows()infer_group()is_hiv2_text()latest_local_lanl_alignment()load_lanl_crf_references()load_lanl_reference_alignment_years()local_reference_sequence()needs_feature_update()non_partial_genome_contexts()normalize_accession()normalize_crf_references()normalize_sequence()parse_lanl_alignment_records()parse_lanl_crf_detail_text()parse_lanl_crf_row()parse_reference_fasta()parse_reference_name()partial_genome_annotation_re()preferred_crf_alias_label()preferred_desired_reference()read_existing_table()rebuild_sequences_with_locations()reconcile_reference_fastas()reference_accessions_in_dir()reference_fasta_content()reference_fasta_matches()reference_fasta_name()reference_fasta_paths_by_accession()reference_key()reference_strain_text()references_from_text()sanitize_filename_part()save_lanl_alignment_file()serialize_cell()serialize_features()strip_html()subgenomic_accessions_from_text()unique_backup_path()update_lanl_reference_alignment()update_reference_dataset()useful_metadata_score()validate_final_reference_dataset()validate_hiv1_complete_or_near_complete()validate_reference_fasta_dir()write_reference_fasta()
- Module contents
- pyhiv.report package
- Submodules
- pyhiv.report.constants module
- pyhiv.report.pdf_generator module
- pyhiv.report.reporter module
- pyhiv.report.utils module
- pyhiv.report.visualization module
- Module contents
GenePanelConfigK03455ConfigMetadataConfigNumericOffsetsPageLayoutPyHIVReporterbuild_alignment_path()build_ref_to_alignment_map()canon_label()first_last_nongap_idx()get_numeric_offsets_non_special()is_special_reference()normalize_features()normalize_present_regions()parse_features()parse_present_regions()plot_gene_axes()project_features_to_alignment()read_alignment_fasta()render_sequence_page()ungap()
- pyhiv.split package
Submodules
pyhiv.cli module
PyHIV Command Line Interface
- pyhiv.cli.count_fasta_files(directory, exclude_dirs=())[source]
Count FASTA files in the input directory and its subdirectories.
- pyhiv.cli.update()
Update packaged PyHIV datasets.
- pyhiv.cli.validate_positive(ctx, param, value)[source]
Validate that an integer option is positive if provided.
- pyhiv.cli.validate_reference_groups(ctx, param, value)[source]
Validate comma-separated HIV-1 reference groups.
pyhiv.config module
- pyhiv.config.get_reference_base_dir()[source]
Return the root directory for reference genomes.
- Return type:
Path
Module contents
- pyhiv.PyHIV(fastas_dir, subtyping=True, splitting=True, output_dir=None, n_jobs=None, reporting=True, alignment_tool='edlib-HW', kmer_size=15, reference_top_k=30, reference_groups=None, show_progress=False)[source]
Main function to run the PyHIV pipeline. It aligns the user sequences with the reference sequences and saves the best alignment in a fasta file. If subtyping is True, it aligns the user sequences with the reference sequences from the HIV-1 subtyping tool. If splitting is enabled, it splits the user sequences into gene regions and saves them in specific folders. splitting accepts booleans for backwards compatibility, or “subtype”, “hxb2”/”reference”, and “none”. If reporting is True, it generates a PDF report with visualizations. alignment_tool selects the alignment backend. Defaults to edlib-HW. kmer_size and reference_top_k control the k-mer candidate reference prefilter used before alignment. reference_groups controls which HIV-1 reference groups are eligible for subtyping. When splitting is enabled, omitted groups default to group M. When splitting is disabled, omitted groups allow all FASTA references. Use (“M”, “N”, “O”, “P”) to include all known groups. show_progress displays a terminal progress bar for processed input sequences.
- Parameters:
fastas_dir (str)
subtyping (bool)
splitting (bool)
output_dir (str | None)
n_jobs (int | None)
reporting (bool)
alignment_tool (str)
kmer_size (int)
reference_top_k (int)
show_progress (bool)
- pyhiv.build_reference_metadata(reference_sequences)[source]
- Parameters:
reference_sequences (pandas.DataFrame)
- Return type:
dict[str, dict[str, str]]
- pyhiv.final_table_columns_for_splitting(should_split)[source]
- Parameters:
should_split (bool)
- Return type:
list[str]
- pyhiv.has_reference_features(reference_sequences, accession)[source]
- Parameters:
reference_sequences (pandas.DataFrame)
accession (str)
- Return type:
bool
- pyhiv.normalize_splitting_mode(splitting, subtyping=True)[source]
- Parameters:
subtyping (bool)
- Return type:
str
- pyhiv.process_fasta_sequence(fasta, rows, paths, subtyping, splitting_mode, should_split, output_dir, n_jobs, alignment_tool, kmer_size, reference_top_k, allowed_reference_accessions, reference_sequences, metadata_by_accession, executor=None)[source]
- Parameters:
rows (list[list])
paths (dict)
subtyping (bool)
splitting_mode (str)
should_split (bool)
output_dir (Path)
n_jobs (int | None)
alignment_tool (str)
kmer_size (int)
reference_top_k (int)
reference_sequences (pandas.DataFrame)
metadata_by_accession (dict)
executor (Executor | None)
- Return type:
None
- pyhiv.ranked_closest_subtype_scores(alignment_scores, metadata_by_accession, top_n=3)[source]
- Parameters:
alignment_scores (list[tuple[int, str]])
metadata_by_accession (dict[str, dict[str, str]])
top_n (int | None)
- Return type:
list[tuple[str, str, int]]
- pyhiv.reference_features(reference_sequences, accession)[source]
- Parameters:
reference_sequences (pandas.DataFrame)
accession (str)
- Return type:
dict
- pyhiv.selected_reference_accessions(reference_sequences, reference_groups, require_features=False)[source]
- Parameters:
reference_sequences (pandas.DataFrame)
reference_groups (tuple[str, ...])
require_features (bool)
- Return type:
set[str] | None
- pyhiv.subtype_score_warning(alignment_scores, metadata_by_accession, threshold=0.01)[source]
- Parameters:
alignment_scores (list[tuple[int, str]])
metadata_by_accession (dict[str, dict[str, str]])
threshold (float)
- Return type:
str