Result#
ScoreResult#
EndResult#
FullResult#
- class pyopal.FullResult(EndResult)#
The results of a search in
fullmode.- __init__(target_index, score, query_end, target_end, query_start, target_start, query_length, target_length, alignment)#
Create a new full result.
- cigar()#
Create a CIGAR string representing the alignment.
- Returns:
str– A CIGAR string in SAM format describing the alignment.
Example
>>> aligner = Aligner() >>> db = Database(["AACCGCTG"]) >>> hit = aligner.align("ACCTCG", db, mode="full", algorithm="nw")[0] >>> hit.cigar() '1D5M1D1M'
- coverage(reference='query')#
Compute the coverage of the alignment.
- Parameters:
reference (
str) – The reference sequence to take to compute the coverage: eitherqueryortarget.- Returns:
float– The coverage of the alignment against the reference, as a fraction (between 0 and 1).
Example
If we align the test sequences from the Opal dataset with Needleman-Wunsch, we get the following alignment:
T: AACCGCTG (0 - 7) Q: -ACCTC-G (0 - 5)
The query coverage will be 100%, but the target coverage will only be 87.5%, since the first letter of the target is not covered by the alignment:
>>> aligner = Aligner() >>> db = Database(["AACCGCTG"]) >>> hit = aligner.align("ACCTCG", db, mode="full", algorithm="nw")[0] >>> hit.coverage("query") 1.0 >>> hit.coverage("target") 0.875
Added in version 0.2.0.