minorg.blast module
- class minorg.blast.BlastHSP(hsp, query, subject)[source]
Bases:
object
Class that binds HSP object with QueryResult and Hit as query and subject respectively.
- expand_btop_str(include_unaligned=False)[source]
- Expands btop to a string of characters of length equal to alignment, where:
‘.’ is a match, ‘m’ is a mismatch, ‘i’ is an insertion in the query, ‘d’ is a deletion in the query.
- Parameters
include_unaligned (bool) – add space character for each unaligned position at 3’ and 5’ ends
- Returns
Expanded btop pattern
- Return type
str
- expand_btop_tuple(rvs_index=False, include_unaligned=False)[source]
Calls str_expand_btop and groups expanded btop to a tuple of characters of length equal to aligned query, where:
‘.’ is a match, ‘m’ is a mismatch, ‘i’ is an insertion in the query, ‘d’ is a deletion in the query (deletion between N and N+1 will be grouped with position N+1 if rvs_index=False else N).
- Parameters
rvs_index (bool) – default=False. A deletion between positions N and N+1 will be grouped with: position N+1 if rvs_index=False; position N, if rvs_index=True.
- Returns
Expanded btop pattern
- Return type
tuple of str
- num_deletion(start=None, end=None, rvs_index=False)[source]
Returns number of deletions relative to subject (that is, one or more bases that is/are present in the query but not in the subject).
- Parameters
start (int) – optional, start position (default=0)
end (int) – optional, end position (non-inclusive) (default=<query length (self.qlen))
rvs_index (bool) – used when fmt=tuple; deletion between N and N+1 will be grouped with position N+1 if rvs_index=False else N
- Returns
Number of deletions within range
- Return type
int
- num_gap(start=None, end=None, rvs_index=False)[source]
Returns number of gaps.
- Parameters
start (int) – optional, start position (default=0)
end (int) – optional, end position (non-inclusive) (default=<query length (self.qlen))
rvs_index (bool) – used when fmt=tuple; deletion between N and N+1 will be grouped with position N+1 if rvs_index=False else N
- Returns
Number of gaps within range
- Return type
int
- num_insertion(start=None, end=None)[source]
Returns number of insertions relative to subject (that is, one or more bases that is/are present in the subject but not in the query).
- Parameters
start (int) – optional, start position (default=0)
end (int) – optional, end position (non-inclusive) (default=<query length (self.qlen))
- Returns
Number of insertions within range
- Return type
int
- num_mismatch(start=None, end=None)[source]
Returns number of mismatches.
- Parameters
start (int) – optional, start position (default=0)
end (int) – optional, end position (non-inclusive) (default=<query length (self.qlen))
- Returns
Number of mismatches within range
- Return type
int
- splice_expanded_btop(start=None, end=None, fmt=<class 'tuple'>, rvs_index=False, include_unaligned=True)[source]
Returns expanded btop spliced to specified range and in specified format
- Parameters
start (int) – optional, start position (default=0)
end (int) – optional, end position (non-inclusive) (default=<query length (self.qlen))
fmt (type) – str or tuple; return expanded btop type
rvs_index (bool) – used when fmt=tuple; deletion between N and N+1 will be grouped with position N+1 if rvs_index=False else N
unaligned (include) – add space character for each unaligned position at 3’ and 5’ ends
- Returns
Expanded btop spliced to specified range
- Return type
str or tuple
- class minorg.blast.BlastNR(query, blastf, header, fout, directory=None, keep_tmp=False, **kwargs)[source]
Bases:
object
- class minorg.blast.BlastResult(filename, fmt, **kwargs)[source]
Bases:
object
Generator that reads blast-tab format and yields BlastHSP, which stores a HSP object with its associated QueryResult and Hit objects as attributes query and subject respectively.
- minorg.blast.blast6multi(blastf, header, fout, subjects, threshold=None, n=None, metric=None, dir=None, **kwargs)[source]