File: test_Location.py

package info (click to toggle)
python-biopython 1.54-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 25,400 kB
  • ctags: 10,975
  • sloc: python: 116,757; xml: 33,167; ansic: 8,622; sql: 1,488; makefile: 147
file content (41 lines) | stat: -rw-r--r-- 1,306 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
"""Test the Location code located in SeqFeature.py

This checks to be sure fuzzy and non-fuzzy representations of locations
are working properly.
"""
from Bio import SeqFeature

# --- test fuzzy representations
print "Testing fuzzy representations..."

# check the positions alone
exact_pos = SeqFeature.ExactPosition(5)
within_pos = SeqFeature.WithinPosition(10, 3)
between_pos = SeqFeature.BetweenPosition(20, 4)
before_pos = SeqFeature.BeforePosition(15)
after_pos = SeqFeature.AfterPosition(40)

print "Exact:", exact_pos
print "Within:", within_pos
print "Between:", between_pos
print "Before:", before_pos
print "After:", after_pos

# put these into Locations
location1 = SeqFeature.FeatureLocation(exact_pos, within_pos)
location2 = SeqFeature.FeatureLocation(before_pos, between_pos)
location3 = SeqFeature.FeatureLocation(within_pos, after_pos)

for location in [location1, location2, location3]:
    print "Location:", location
    print "   Start:", location.start
    print "   End  :", location.end

# --- test non-fuzzy represenations
print "Testing non-fuzzy representations..."
for location in [location1, location2, location3]:
    print "Location:", location
    print "  Non-Fuzzy Start:", location.nofuzzy_start
    print "  Non-Fuzzy End:", location.nofuzzy_end