Package Bio :: Package SearchIO :: Package _model :: Module hsp :: Class HSPFragment
[hide private]
[frames] | no frames]

Class HSPFragment

source code

             object --+        
                      |        
_base._BaseSearchObject --+    
                          |    
             _base._BaseHSP --+
                              |
                             HSPFragment

Class representing a contiguous alignment of hit-query sequence.

HSPFragment forms the core of any parsed search output file. Depending on
the search output file format, it may contain the actual query and/or hit
sequences that produces the search hits. These sequences are stored as
SeqRecord objects (see SeqRecord):

>>> from Bio import SearchIO
>>> qresult = next(SearchIO.parse('Blast/mirna.xml', 'blast-xml'))
>>> fragment = qresult[0][0][0]   # first hit, first hsp, first fragment
>>> print(fragment)
      Query: 33211 mir_1
        Hit: gi|262205317|ref|NR_030195.1| Homo sapiens microRNA 520b (MIR520...
Query range: [0:61] (1)
  Hit range: [0:61] (1)
  Fragments: 1 (61 columns)
     Query - CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAGTGCTTCCTTTTAGAGGG
             |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
       Hit - CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAGTGCTTCCTTTTAGAGGG

# the query sequence is a SeqRecord object
>>> fragment.query.__class__
<class 'Bio.SeqRecord.SeqRecord'>
>>> print(fragment.query)
ID: 33211
Name: aligned query sequence
Description: mir_1
Number of features: 0
Seq('CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAGTGCTTCCTTT...GGG', DNAAlphabet())

# the hit sequence is a SeqRecord object as well
>>> fragment.hit.__class__
<class 'Bio.SeqRecord.SeqRecord'>
>>> print(fragment.hit)
ID: gi|262205317|ref|NR_030195.1|
Name: aligned hit sequence
Description: Homo sapiens microRNA 520b (MIR520B), microRNA
Number of features: 0
Seq('CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAGTGCTTCCTTT...GGG', DNAAlphabet())

# when both query and hit are present, we get a MultipleSeqAlignment object
>>> fragment.aln.__class__
<class 'Bio.Align.MultipleSeqAlignment'>
>>> print(fragment.aln)
DNAAlphabet() alignment with 2 rows and 61 columns
CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAG...GGG 33211
CCCTCTACAGGGAAGCGCTTTCTGTTGTCTGAAAGAAAAGAAAG...GGG gi|262205317|ref|NR_030195.1|

Instance Methods [hide private]
 
__init__(self, hit_id='<unknown id>', query_id='<unknown id>', hit=None, query=None, alphabet=SingleLetterAlphabet())
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__repr__(self)
repr(x)
source code
 
__len__(self) source code
 
__str__(self)
str(x)
source code
 
__getitem__(self, idx) source code
 
_str_aln(self) source code
 
_set_seq(self, seq, seq_type)
Checks the given sequence for attribute setting
source code
 
_hit_get(self) source code
 
_hit_set(self, value) source code
 
_query_get(self) source code
 
_query_set(self, value) source code
 
_aln_get(self) source code
 
_alphabet_get(self) source code
 
_alphabet_set(self, value) source code
 
_aln_span_get(self) source code
 
_aln_span_set(self, value) source code
 
_prep_strand(self, strand) source code
 
_get_strand(self, seq_type) source code
 
_hit_strand_get(self) source code
 
_hit_strand_set(self, value) source code
 
_query_strand_get(self) source code
 
_query_strand_set(self, value) source code
 
_prep_frame(self, frame) source code
 
_hit_frame_get(self) source code
 
_hit_frame_set(self, value) source code
 
_query_frame_get(self) source code
 
_query_frame_set(self, value) source code
 
_prep_coord(self, coord, opp_coord_name, op) source code
 
_hit_start_get(self) source code
 
_hit_start_set(self, value) source code
 
_query_start_get(self) source code
 
_query_start_set(self, value) source code
 
_hit_end_get(self) source code
 
_hit_end_set(self, value) source code
 
_query_end_get(self) source code
 
_query_end_set(self, value) source code
 
_hit_span_get(self) source code
 
_query_span_get(self) source code
 
_hit_range_get(self) source code
 
_query_range_get(self) source code

Inherited from _base._BaseHSP (private): _str_hsp_header

Inherited from _base._BaseSearchObject (private): _transfer_attrs

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from _base._BaseSearchObject (private): _NON_STICKY_ATTRS

Properties [hide private]
  hit
Hit sequence as a SeqRecord object, defaults to None
  query
Query sequence as a SeqRecord object, defaults to None
  aln
Query-hit alignment as a MultipleSeqAlignment object,...
  alphabet
Alphabet object used in the fragment's sequences and alignment,...
  aln_span
The number of alignment columns covered by the fragment
  hit_description
Hit sequence description
  query_description
Query sequence description
  hit_id
Hit sequence ID
  query_id
Query sequence ID
  hit_features
Hit sequence features
  query_features
Query sequence features
  hit_strand
Hit sequence strand, defaults to None
  query_strand
Query sequence strand, defaults to None
  hit_frame
Hit sequence reading frame, defaults to None
  query_frame
Query sequence reading frame, defaults to None
  hit_start
Hit sequence start coordinate, defaults to None
  query_start
Query sequence start coordinate, defaults to None
  hit_end
Hit sequence start coordinate, defaults to None
  query_end
Query sequence end coordinate, defaults to None
  hit_span
The number of residues covered by the hit sequence
  query_span
The number of residues covered by the query sequence
  hit_range
Tuple of hit start and end coordinates
  query_range
Tuple of query start and end coordinates

Inherited from object: __class__

Method Details [hide private]

__init__(self, hit_id='<unknown id>', query_id='<unknown id>', hit=None, query=None, alphabet=SingleLetterAlphabet())
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
str(x)

Overrides: object.__str__
(inherited documentation)

_set_seq(self, seq, seq_type)

source code 
Checks the given sequence for attribute setting

Arguments:
seq -- String or SeqRecord to check
seq_type -- String of sequence type, must be 'hit' or 'query'


Property Details [hide private]

hit

Hit sequence as a SeqRecord object, defaults to None

Get Method:
_hit_get(self)
Set Method:
_hit_set(self, value)

query

Query sequence as a SeqRecord object, defaults to None

Get Method:
_query_get(self)
Set Method:
_query_set(self, value)

aln

Query-hit alignment as a MultipleSeqAlignment object,
defaults to None

Get Method:
_aln_get(self)

alphabet

Alphabet object used in the fragment's sequences and alignment,
defaults to single_letter_alphabet

Get Method:
_alphabet_get(self)
Set Method:
_alphabet_set(self, value)

aln_span

The number of alignment columns covered by the fragment

Get Method:
_aln_span_get(self)
Set Method:
_aln_span_set(self, value)

hit_description

Hit sequence description

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

query_description

Query sequence description

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

hit_id

Hit sequence ID

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

query_id

Query sequence ID

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

hit_features

Hit sequence features

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

query_features

Query sequence features

Get Method:
unreachable.getter(self)
Set Method:
unreachable.setter(self, value)

hit_strand

Hit sequence strand, defaults to None

Get Method:
_hit_strand_get(self)
Set Method:
_hit_strand_set(self, value)

query_strand

Query sequence strand, defaults to None

Get Method:
_query_strand_get(self)
Set Method:
_query_strand_set(self, value)

hit_frame

Hit sequence reading frame, defaults to None

Get Method:
_hit_frame_get(self)
Set Method:
_hit_frame_set(self, value)

query_frame

Query sequence reading frame, defaults to None

Get Method:
_query_frame_get(self)
Set Method:
_query_frame_set(self, value)

hit_start

Hit sequence start coordinate, defaults to None

Get Method:
_hit_start_get(self)
Set Method:
_hit_start_set(self, value)

query_start

Query sequence start coordinate, defaults to None

Get Method:
_query_start_get(self)
Set Method:
_query_start_set(self, value)

hit_end

Hit sequence start coordinate, defaults to None

Get Method:
_hit_end_get(self)
Set Method:
_hit_end_set(self, value)

query_end

Query sequence end coordinate, defaults to None

Get Method:
_query_end_get(self)
Set Method:
_query_end_set(self, value)

hit_span

The number of residues covered by the hit sequence

Get Method:
_hit_span_get(self)

query_span

The number of residues covered by the query sequence

Get Method:
_query_span_get(self)

hit_range

Tuple of hit start and end coordinates

Get Method:
_hit_range_get(self)

query_range

Tuple of query start and end coordinates

Get Method:
_query_range_get(self)