Bio :: GFF :: easy :: Location :: Class Location
[hide private]
[frames] | no frames]

Class Location

source code

          object --+        
                   |        
                list --+    
                       |    
GenericTools.VerboseList --+
                           |
                          Location

this is really best interfaced through LocationFromString fuzzy: < or > join: {0 = no join, 1 = join, 2 = order}

>>> location = Location([Location([339]), Location([564])]) # zero-based
>>> location
Location(Location(339), Location(564))
>>> print location # one-based
340..565
>>> print location.five_prime()
340
>>> location_rev = Location([Location([339]), Location([564])], 1)
>>> print location_rev
complement(340..565)
>>> print location_rev.five_prime()
565
Instance Methods [hide private]
new empty list
__init__(self, the_list, complement=0, seqname=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_joinstr(self) source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code
 
direction_and_index(self, direction)
1: 5' -1: 3'
source code
 
findside(self, direction) source code
 
findseqname_3prime(self) source code
 
findseqname(self, direction=1) source code
 
five_prime(self) source code
 
three_prime(self) source code
 
length(self)
WARNING: doesn't deal with joins!!!!
source code
 
intersection(self, other)
WARNING: doesn't deal with joins!!!!
source code
 
start(self) source code
 
end(self) source code
 
three_prime_range(self, window) source code
 
sublocation(self, sub_location) source code
 
__add__(self, addend)
x+y
source code
 
add(self, addend, complement=0) source code
 
__sub__(self, subtrahend) source code
 
reverse(self)
reverse *IN PLACE*
source code
 
reorient(self) source code
 
bounding(self)
works for single level non-complex joins
source code

Inherited from list: __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, append, count, extend, index, insert, pop, remove, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]
  direction2index = {1: 0,-1:-1}

Inherited from list: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, the_list, complement=0, seqname=None)
(Constructor)

source code 

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

Returns: new empty list
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

direction_and_index(self, direction)

source code 

1: 5' -1: 3'

>>> loc1 = LocationFromString("join(1..3,complement(5..6))")
>>> loc1.direction_and_index(1)
(1, 0)
>>> loc1.direction_and_index(-1)
(-1, -1)
>>> loc1.reverse()
>>> print loc1
complement(join(1..3,complement(5..6)))
>>> loc1.direction_and_index(1)
(-1, -1)

intersection(self, other)

source code 

WARNING: doesn't deal with joins!!!!

>>> location1 = LocationFromString("1..50")
>>> location2 = LocationFromString("25..200")
>>> print location1.intersection(location2)
25..50
>>> print location1.intersection(location2)
25..50

__add__(self, addend)
(Addition operator)

source code 

x+y

Overrides: list.__add__
(inherited documentation)

reverse(self)

source code 

reverse *IN PLACE*

Overrides: list.reverse
(inherited documentation)

bounding(self)

source code 

works for single level non-complex joins

>>> LOC = LocationFromString
>>> l1 = LOC("join(alpha:1..30,alpha:50..70)")
>>> print l1.bounding()
join(alpha:1..70)
>>> l2 = LOC("join(alpha:1..30,alpha:complement(50..70))")
>>> print l2.bounding()
join(alpha:1..30,alpha:complement(50..70))
>>> l3 = LOC("join(alpha:1..30,alpha:complement(50..70),beta:6..20,alpha:25..45)")
>>> print l3.bounding()
join(alpha:1..45,alpha:complement(50..70),beta:6..20)