pyhiv.align package
Submodules
pyhiv.align.align_with_reference module
- pyhiv.align.align_with_reference.align_with_references(test_sequence, references_dir=None, n_jobs=None)[source]
Aligns a test sequence with reference sequences in parallel and returns the best match.
- Parameters:
test_sequence (SeqRecord) – A BioPython SeqRecord object representing the test sequence.
references_dir (Path, optional) – Path to the directory containing reference sequences. Defaults to REFERENCE_GENOMES_FASTAS_DIR, containing reference genomes for HIV-1 subtyping.
n_jobs (int, optional) – Number of worker processes to use for parallel processing. Defaults to using all available CPU cores.
- Returns:
A tuple containing the test sequence, reference sequence, and the reference file name with the best alignment.
- Return type:
Tuple[str, str, str]
- pyhiv.align.align_with_reference.calculate_alignment_score(seq1, seq2)[source]
Calculate the alignment score between two sequences.
- Parameters:
seq1 (str) – First sequence to compare.
seq2 (str) – Second sequence to compare.
- Returns:
Number of positions where the sequences are equal.
- Return type:
int
- pyhiv.align.align_with_reference.process_alignment(test_seq, ref_seq)[source]
Aligns test sequence with a reference sequence and calculates the score.
- Parameters:
test_seq (SeqRecord) – A BioPython SeqRecord object representing the test sequence.
ref_seq (SeqRecord) – A BioPython SeqRecord object representing the reference sequence.
- Returns:
A tuple containing the alignment score, the aligned test sequence, the aligned reference sequence, and the reference sequence name.
- Return type:
Tuple[int, str, str, str]
pyhiv.align.famsa module
- pyhiv.align.famsa.pyfamsa_align(test_seq, ref_seq)[source]
Aligns a test sequence to a reference sequence using the pyfamsa library.
- Parameters:
test_seq (SeqRecord) – The test sequence to align. Should be a Biopython SeqRecord object containing the test sequence ID and sequence.
ref_seq (SeqRecord) – The reference sequence to align against. Should be a Biopython SeqRecord object containing the reference sequence ID and sequence.
- Returns:
- test_alignedstr
The aligned test sequence.
- ref_alignedstr
The aligned reference sequence.
- Return type:
tuple