Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_SeqIO_features.FeatureWriting Class Reference

List of all members.

Public Member Functions

def setUp
def write_read_check
def write_read_checks
def test_exact
def test_between
def test_join
def test_fuzzy_join
def test_before
def test_after
def test_oneof
def test_within

Public Attributes

 record

Detailed Description

Definition at line 456 of file test_SeqIO_features.py.


Member Function Documentation

Definition at line 457 of file test_SeqIO_features.py.

00457 
00458     def setUp(self):
00459         self.record = SeqRecord(Seq("ACGT"*100, generic_dna),
                                id="Test", name="Test", description="Test")
Features: write/read simple after locations.

Definition at line 734 of file test_SeqIO_features.py.

00734 
00735     def test_after(self):
00736         """Features: write/read simple after locations."""
00737         s = "N" * 200
00738         f = SeqFeature(FeatureLocation(AfterPosition(5),10), \
00739                        strand=+1, type="CDS")
00740         self.assertEqual(_insdc_feature_location_string(f,100),
00741                          ">6..10")
00742         self.assertEqual(len(f), len(f.extract(s)))
00743         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00744                          "complement(91..<95)")
00745         self.assertEqual(f.strand, +1)
00746         self.assertEqual(f._flip(100).strand, -1)
00747         self.record.features.append(f)
00748 
00749         f = SeqFeature(FeatureLocation(AfterPosition(15),AfterPosition(20)), \
00750                        strand=+1, type="CDS")
00751         self.assertEqual(_insdc_feature_location_string(f,100),
00752                          ">16..>20")
00753         self.assertEqual(len(f), len(f.extract(s)))
00754         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00755                          "complement(<1..<5)")
00756         self.assertEqual(f.strand, +1)
00757         self.assertEqual(f._flip(100).strand, -1)
00758         self.record.features.append(f)
00759 
00760         f = SeqFeature(FeatureLocation(25,AfterPosition(30)), \
00761                        strand=+1, type="CDS")
00762         self.assertEqual(_insdc_feature_location_string(f,100),
00763                          "26..>30")
00764         self.assertEqual(len(f), len(f.extract(s)))
00765         self.assertEqual(_insdc_feature_location_string(f._flip(30),30),
00766                          "complement(<1..5)")
00767         self.assertEqual(f.strand, +1)
00768         self.assertEqual(f._flip(100).strand, -1)
00769         self.record.features.append(f)
00770 
00771         f = SeqFeature(FeatureLocation(AfterPosition(35),40), \
00772                        strand=-1, type="CDS")
00773         self.assertEqual(_insdc_feature_location_string(f,100),
00774                          "complement(>36..40)")
00775         self.assertEqual(len(f), len(f.extract(s)))
00776         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00777                          "61..<65")
00778         self.assertEqual(f.strand, -1)
00779         self.assertEqual(f._flip(100).strand, +1)
00780         self.record.features.append(f)
00781 
00782         f = SeqFeature(FeatureLocation(AfterPosition(45),AfterPosition(50)), \
00783                        strand=-1, type="CDS")
00784         self.assertEqual(_insdc_feature_location_string(f,100),
00785                          "complement(>46..>50)")
00786         self.assertEqual(len(f), len(f.extract(s)))
00787         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00788                          "<51..<55")
00789         self.assertEqual(f.strand, -1)
00790         self.assertEqual(f._flip(100).strand, +1)
00791         self.record.features.append(f)
00792 
00793         f = SeqFeature(FeatureLocation(55,AfterPosition(60)), \
00794                        strand=-1, type="CDS")
00795         self.assertEqual(_insdc_feature_location_string(f,100),
00796                          "complement(56..>60)")
00797         self.assertEqual(len(f), len(f.extract(s)))
00798         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00799                          "<41..45")
00800         self.assertEqual(f.strand, -1)
00801         self.assertEqual(f._flip(100).strand, +1)
00802         self.record.features.append(f)
00803 
00804         self.write_read_checks()

Here is the call graph for this function:

Features: write/read simple before locations.

Definition at line 663 of file test_SeqIO_features.py.

00663 
00664     def test_before(self):
00665         """Features: write/read simple before locations."""
00666         s = "N"*200
00667         f = SeqFeature(FeatureLocation(BeforePosition(5),10), \
00668                        strand=+1, type="CDS")
00669         self.assertEqual(_insdc_feature_location_string(f,100),
00670                          "<6..10")
00671         self.assertEqual(len(f), len(f.extract(s)))
00672         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00673                          "complement(11..>15)")
00674         self.assertEqual(f.strand, +1)
00675         self.assertEqual(f._flip(100).strand, -1)
00676         self.record.features.append(f)
00677         
00678         f = SeqFeature(FeatureLocation(BeforePosition(15),BeforePosition(20)), \
00679                        strand=+1, type="CDS")
00680         self.assertEqual(_insdc_feature_location_string(f,100),
00681                          "<16..<20")
00682         self.assertEqual(len(f), len(f.extract(s)))
00683         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00684                          "complement(>1..>5)")
00685         self.assertEqual(f.strand, +1)
00686         self.assertEqual(f._flip(100).strand, -1)
00687         self.record.features.append(f)
00688         
00689         f = SeqFeature(FeatureLocation(25,BeforePosition(30)), \
00690                        strand=+1, type="CDS")
00691         self.assertEqual(_insdc_feature_location_string(f,100),
00692                          "26..<30")
00693         self.assertEqual(len(f), len(f.extract(s)))
00694         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00695                          "complement(>11..15)")
00696         self.assertEqual(f.strand, +1)
00697         self.assertEqual(f._flip(100).strand, -1)
00698         self.record.features.append(f)
00699         
00700         f = SeqFeature(FeatureLocation(BeforePosition(35),40), \
00701                        strand=-1, type="CDS")
00702         self.assertEqual(_insdc_feature_location_string(f,100),
00703                          "complement(<36..40)")
00704         self.assertEqual(len(f), len(f.extract(s)))
00705         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00706                          "1..>5")
00707         self.assertEqual(f.strand, -1)
00708         self.assertEqual(f._flip(100).strand, +1)
00709         self.record.features.append(f)
00710         
00711         f = SeqFeature(FeatureLocation(BeforePosition(45),BeforePosition(50)), \
00712                        strand=-1, type="CDS")
00713         self.assertEqual(_insdc_feature_location_string(f,100),
00714                          "complement(<46..<50)")
00715         self.assertEqual(len(f), len(f.extract(s)))
00716         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00717                          ">51..>55")
00718         self.assertEqual(f.strand, -1)
00719         self.assertEqual(f._flip(100).strand, +1)
00720         self.record.features.append(f)
00721         
00722         f = SeqFeature(FeatureLocation(55,BeforePosition(60)), \
00723                        strand=-1, type="CDS")
00724         self.assertEqual(_insdc_feature_location_string(f,100),
00725                          "complement(56..<60)")
00726         self.assertEqual(len(f), len(f.extract(s)))
00727         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00728                          ">41..45")
00729         self.assertEqual(f.strand, -1)
00730         self.assertEqual(f._flip(100).strand, +1)
00731         self.record.features.append(f)
00732         
00733         self.write_read_checks()
        

Here is the call graph for this function:

GenBank/EMBL write/read simple between locations.

Definition at line 520 of file test_SeqIO_features.py.

00520 
00521     def test_between(self):
00522         """GenBank/EMBL write/read simple between locations."""
00523         #Note we don't use the BetweenPosition any more!
00524         f = SeqFeature(FeatureLocation(10,10), strand=+1, type="variation")
00525         self.assertEqual(_insdc_feature_location_string(f,100),
00526                          "10^11")
00527         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00528                          "complement(10^11)")
00529         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00530                          "complement(90^91)")
00531         self.assertEqual(f._flip(100).strand, -1)
00532         self.record.features.append(f)
00533         f = SeqFeature(FeatureLocation(20,20), strand=-1, type="variation")
00534         self.assertEqual(_insdc_feature_location_string(f,100),
00535                          "complement(20^21)")
00536         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00537                          "20^21")
00538         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00539                          "80^81")
00540         self.assertEqual(f._flip(100).strand, +1)
00541         self.record.features.append(f)
00542         self.write_read_checks()

Here is the call graph for this function:

GenBank/EMBL write/read simple exact locations.

Definition at line 471 of file test_SeqIO_features.py.

00471 
00472     def test_exact(self):
00473         """GenBank/EMBL write/read simple exact locations."""
00474         #Note we don't have to explicitly give an ExactPosition object,
00475         #an integer will also work:
00476         f = SeqFeature(FeatureLocation(10,20), strand=+1, type="CDS")
00477         self.assertEqual(_insdc_feature_location_string(f,100),
00478                          "11..20")
00479         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00480                          "complement(1..10)")
00481         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00482                          "complement(81..90)")
00483         self.assertEqual(f._flip(100).strand, -1)
00484         self.record.features.append(f)
00485         
00486         f = SeqFeature(FeatureLocation(30,40), strand=-1, type="CDS")
00487         self.assertEqual(_insdc_feature_location_string(f,100),
00488                          "complement(31..40)")
00489         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00490                          "1..10")
00491         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00492                          "61..70")
00493         self.assertEqual(f._flip(100).strand, +1)
00494         self.record.features.append(f)
00495 
00496         f = SeqFeature(FeatureLocation(ExactPosition(50),ExactPosition(60)), \
00497                        strand=+1, type="CDS")
00498         self.assertEqual(_insdc_feature_location_string(f,100),
00499                          "51..60")
00500         self.assertEqual(_insdc_feature_location_string(f._flip(60),60),
00501                          "complement(1..10)")
00502         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00503                          "complement(41..50)")
00504         self.assertEqual(f._flip(100).strand, -1)
00505         self.record.features.append(f)
00506 
00507         self.write_read_checks()
00508         #The write/check won't work on strandless features due to the
00509         #limitations of the GenBank (and EMBL) feature location scheme
00510         for s in [0, None] :
00511             #Check flipping of a simple strand 0 feature:
00512             f = SeqFeature(FeatureLocation(0,100), strand=s, type="source")
00513             self.assertEqual(_insdc_feature_location_string(f,100),
00514                              "1..100")
00515             self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00516                              "1..100")
00517             self.assertEqual(_insdc_feature_location_string(f._flip(200),200),
00518                              "101..200")
00519             self.assertEqual(f._flip(100).strand, f.strand)

Here is the call graph for this function:

Features: write/read fuzzy join locations.

Definition at line 595 of file test_SeqIO_features.py.

00595 
00596     def test_fuzzy_join(self):
00597         """Features: write/read fuzzy join locations."""
00598         s = "N"*500
00599         f1 = SeqFeature(FeatureLocation(BeforePosition(10),20), strand=+1)
00600         f2 = SeqFeature(FeatureLocation(25,AfterPosition(40)), strand=+1)
00601         f = make_join_feature([f1,f2])
00602         self.record.features.append(f)
00603         self.assertEqual(_insdc_feature_location_string(f,500),
00604                          "join(<11..20,26..>40)")
00605         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00606                          "complement(join(<61..75,81..>90))")
00607         self.assertEqual(f.strand, +1)
00608         for sub_f in f._flip(100).sub_features :
00609             self.assertEqual(sub_f.strand, -1)
00610         self.assertEqual(f._flip(100).strand, -1)
00611         
00612         f1 = SeqFeature(FeatureLocation(OneOfPosition(107, [ExactPosition(107),
00613                                                             ExactPosition(110)]),
00614                                         120),
00615                         strand=+1)
00616         f2 = SeqFeature(FeatureLocation(125,140), strand=+1)
00617         f3 = SeqFeature(FeatureLocation(145,WithinPosition(160, left=150, right=160)), strand=+1)
00618         f = make_join_feature([f1,f2,f3], "CDS")
00619         self.assertEqual(_insdc_feature_location_string(f,500),
00620                          "join(one-of(108,111)..120,126..140,146..(150.160))")
00621         self.assertEqual(len(f), len(f.extract(s)))
00622         self.assertEqual(_insdc_feature_location_string(f._flip(200),200),
00623                          "complement(join((41.51)..55,61..75,81..one-of(90,93)))")
00624         self.assertEqual(f.strand, +1)
00625         for sub_f in f._flip(100).sub_features :
00626             self.assertEqual(sub_f.strand,-1)
00627         self.assertEqual(f._flip(100).strand, -1)
00628         self.record.features.append(f)
00629         
00630         f1 = SeqFeature(FeatureLocation(BeforePosition(210),220), strand=-1)
00631         f2 = SeqFeature(FeatureLocation(225,WithinPosition(244, left=240, right=244)), strand=-1)
00632         f = make_join_feature([f1,f2], "gene")
00633         self.assertEqual(_insdc_feature_location_string(f,500),
00634                          "complement(join(<211..220,226..(240.244)))")
00635         self.assertEqual(len(f), len(f.extract(s)))
00636         self.assertEqual(_insdc_feature_location_string(f._flip(300),300),
00637                          "join((57.61)..75,81..>90)")
00638         self.assertEqual(f.strand, -1)
00639         for sub_f in f._flip(100).sub_features :
00640             self.assertEqual(sub_f.strand, +1)
00641         self.assertEqual(f._flip(100).strand, +1)
00642         self.record.features.append(f)
00643         
00644         f1 = SeqFeature(FeatureLocation(AfterPosition(310),320), strand=-1)
00645         #Note - is one-of(340,337) allowed or should it be one-of(337,340)?
00646         f2 = SeqFeature(FeatureLocation(325,OneOfPosition(340, [ExactPosition(340),
00647                                                                 ExactPosition(337)])),
00648                         strand=-1)
00649         f3 = SeqFeature(FeatureLocation(345,WithinPosition(355, left=350, right=355)), strand=-1)
00650         f = make_join_feature([f1,f2,f3], "CDS")
00651         self.assertEqual(_insdc_feature_location_string(f,500),
00652                          "complement(join(>311..320,326..one-of(340,337),346..(350.355)))")
00653         self.assertEqual(len(f), len(f.extract(s)))
00654         self.assertEqual(_insdc_feature_location_string(f._flip(400),400),
00655                          "join((46.51)..55,one-of(64,61)..75,81..<90)")
00656         self.assertEqual(f.strand, -1)
00657         for sub_f in f._flip(100).sub_features :
00658             self.assertEqual(sub_f.strand, +1)
00659         self.assertEqual(f._flip(100).strand, +1)
00660         self.record.features.append(f)
00661         
00662         self.write_read_checks()

Here is the call graph for this function:

GenBank/EMBL write/read simple join locations.

Definition at line 543 of file test_SeqIO_features.py.

00543 
00544     def test_join(self):
00545         """GenBank/EMBL write/read simple join locations."""
00546         f1 = SeqFeature(FeatureLocation(10,20), strand=+1)
00547         f2 = SeqFeature(FeatureLocation(25,40), strand=+1)
00548         f = make_join_feature([f1,f2])
00549         self.record.features.append(f)
00550         self.assertEqual(_insdc_feature_location_string(f,500),
00551                          "join(11..20,26..40)")
00552         self.assertEqual(_insdc_feature_location_string(f._flip(60),60),
00553                          "complement(join(21..35,41..50))")
00554         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00555                          "complement(join(61..75,81..90))")
00556         for sub_f in f._flip(100).sub_features :
00557             self.assertEqual(sub_f.strand, -1)
00558         self.assertEqual(f._flip(100).strand, -1)
00559         f1 = SeqFeature(FeatureLocation(110,120), strand=+1)
00560         f2 = SeqFeature(FeatureLocation(125,140), strand=+1)
00561         f3 = SeqFeature(FeatureLocation(145,150), strand=+1)
00562         f = make_join_feature([f1,f2,f3], "CDS")
00563         self.assertEqual(_insdc_feature_location_string(f,500),
00564                          "join(111..120,126..140,146..150)")
00565         self.assertEqual(_insdc_feature_location_string(f._flip(150),150),
00566                          "complement(join(1..5,11..25,31..40))")
00567         for sub_f in f._flip(100).sub_features :
00568             self.assertEqual(sub_f.strand,-1)
00569         self.assertEqual(f._flip(100).strand, -1)
00570         self.record.features.append(f)
00571         f1 = SeqFeature(FeatureLocation(210,220), strand=-1)
00572         f2 = SeqFeature(FeatureLocation(225,240), strand=-1)
00573         f = make_join_feature([f1,f2], ftype="gene")
00574         self.assertEqual(_insdc_feature_location_string(f,500),
00575                          "complement(join(211..220,226..240))")
00576         self.assertEqual(_insdc_feature_location_string(f._flip(300),300),
00577                          "join(61..75,81..90)")
00578         for sub_f in f._flip(100).sub_features :
00579             self.assertEqual(sub_f.strand, +1)
00580         self.assertEqual(f._flip(100).strand, +1)
00581         self.record.features.append(f)
00582         f1 = SeqFeature(FeatureLocation(310,320), strand=-1)
00583         f2 = SeqFeature(FeatureLocation(325,340), strand=-1)
00584         f3 = SeqFeature(FeatureLocation(345,350), strand=-1)
00585         f = make_join_feature([f1,f2,f3], "CDS")
00586         self.assertEqual(_insdc_feature_location_string(f,500),
00587                          "complement(join(311..320,326..340,346..350))")
00588         self.assertEqual(_insdc_feature_location_string(f._flip(350),350),
00589                          "join(1..5,11..25,31..40)")
00590         for sub_f in f._flip(100).sub_features :
00591             self.assertEqual(sub_f.strand, +1)
00592         self.assertEqual(f._flip(100).strand, +1)
00593         self.record.features.append(f)
00594         self.write_read_checks()

Here is the call graph for this function:

Features: write/read simple one-of locations.

Definition at line 805 of file test_SeqIO_features.py.

00805 
00806     def test_oneof(self):
00807         """Features: write/read simple one-of locations."""
00808         s = "N" * 100
00809         start = OneOfPosition(0, [ExactPosition(0),ExactPosition(3),ExactPosition(6)])
00810         f = SeqFeature(FeatureLocation(start,21), strand=+1, type="CDS")
00811         self.assertEqual(_insdc_feature_location_string(f,100),
00812                          "one-of(1,4,7)..21")
00813         self.assertEqual(len(f), len(f.extract(s)))
00814         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00815                          "complement(80..one-of(94,97,100))")
00816         self.assertEqual(f.strand, +1)
00817         self.assertEqual(f._flip(100).strand, -1)
00818         self.record.features.append(f)
00819         
00820         start = OneOfPosition(10, [ExactPosition(x) for x in [10,13,16]])
00821         end = OneOfPosition(50, [ExactPosition(x) for x in [41,44,50]])
00822         f = SeqFeature(FeatureLocation(start,end), strand=+1, type="gene")
00823         self.assertEqual(_insdc_feature_location_string(f,100),
00824                          "one-of(11,14,17)..one-of(41,44,50)")
00825         self.assertEqual(len(f), len(f.extract(s)))
00826         self.assertEqual(_insdc_feature_location_string(f._flip(50),50),
00827                          "complement(one-of(1,7,10)..one-of(34,37,40))")
00828         self.assertEqual(f.strand, +1)
00829         self.assertEqual(f._flip(100).strand, -1)
00830         self.record.features.append(f)
00831         
00832         end = OneOfPosition(33, [ExactPosition(x) for x in [30,33]])
00833         f = SeqFeature(FeatureLocation(27,end), strand=+1, type="gene")
00834         self.assertEqual(_insdc_feature_location_string(f,100),
00835                          "28..one-of(30,33)")
00836         self.assertEqual(len(f), len(f.extract(s)))
00837         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00838                          "complement(one-of(8,11)..13)")
00839         self.assertEqual(f.strand, +1)
00840         self.assertEqual(f._flip(100).strand, -1)
00841         self.record.features.append(f)
00842         
00843         start = OneOfPosition(36, [ExactPosition(x) for x in [36,40]])
00844         f = SeqFeature(FeatureLocation(start,46), strand=-1, type="CDS")
00845         self.assertEqual(_insdc_feature_location_string(f,100),
00846                          "complement(one-of(37,41)..46)")
00847         self.assertEqual(len(f), len(f.extract(s)))
00848         self.assertEqual(_insdc_feature_location_string(f._flip(50),50),
00849                          "5..one-of(10,14)")
00850         self.assertEqual(f.strand, -1)
00851         self.assertEqual(f._flip(100).strand, +1)
00852         self.record.features.append(f)
00853         
00854         start = OneOfPosition(45, [ExactPosition(x) for x in [45,60]])
00855         end = OneOfPosition(90, [ExactPosition(x) for x in [70,90]])
00856         f = SeqFeature(FeatureLocation(start,end), strand=-1, type="CDS")
00857         self.assertEqual(_insdc_feature_location_string(f,100),
00858                          "complement(one-of(46,61)..one-of(70,90))")
00859         self.assertEqual(len(f), len(f.extract(s)))
00860         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00861                          "one-of(11,31)..one-of(40,55)")
00862         self.assertEqual(f.strand, -1)
00863         self.assertEqual(f._flip(100).strand, +1)
00864         self.record.features.append(f)
00865         
00866         end = OneOfPosition(63, [ExactPosition(x) for x in [60,63]])
00867         f = SeqFeature(FeatureLocation(55,end), strand=-1, type="tRNA")
00868         self.assertEqual(_insdc_feature_location_string(f,100),
00869                          "complement(56..one-of(60,63))")
00870         self.assertEqual(len(f), len(f.extract(s)))
00871         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00872                          "one-of(38,41)..45")
00873         self.assertEqual(f.strand, -1)
00874         self.assertEqual(f._flip(100).strand, +1)
00875         self.record.features.append(f)
00876         
00877         self.write_read_checks()

Here is the call graph for this function:

Features: write/read simple within locations.

Definition at line 878 of file test_SeqIO_features.py.

00878 
00879     def test_within(self):
00880         """Features: write/read simple within locations."""
00881         s = "N" * 100
00882         f = SeqFeature(FeatureLocation(WithinPosition(2, left=2, right=8),10), \
00883                        strand=+1, type="CDS")
00884         self.assertEqual(_insdc_feature_location_string(f,100),
00885                          "(3.9)..10")
00886         self.assertEqual(len(f), len(f.extract(s)))
00887         self.assertEqual(_insdc_feature_location_string(f._flip(20),20),
00888                          "complement(11..(12.18))")
00889         self.assertEqual(f.strand, +1)
00890         self.assertEqual(f._flip(100).strand, -1)
00891         self.record.features.append(f)
00892         
00893         f = SeqFeature(FeatureLocation(WithinPosition(12, left=12, right=18),
00894                                        WithinPosition(28, left=20, right=28)), \
00895                        strand=+1, type="CDS")
00896         self.assertEqual(_insdc_feature_location_string(f,100),
00897                          "(13.19)..(20.28)")
00898         self.assertEqual(len(f), len(f.extract(s)))
00899         self.assertEqual(_insdc_feature_location_string(f._flip(30),30),
00900                          "complement((3.11)..(12.18))")
00901         self.assertEqual(f.strand, +1)
00902         self.assertEqual(f._flip(100).strand, -1)
00903         self.record.features.append(f)
00904         
00905         f = SeqFeature(FeatureLocation(25,WithinPosition(33, left=30, right=33)), \
00906                        strand=+1, type="misc_feature")
00907         self.assertEqual(_insdc_feature_location_string(f,100),
00908                          "26..(30.33)")
00909         self.assertEqual(len(f), len(f.extract(s)))
00910         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00911                          "complement((8.11)..15)")
00912         self.assertEqual(f.strand, +1)
00913         self.assertEqual(f._flip(100).strand, -1)
00914         self.record.features.append(f)
00915         
00916         f = SeqFeature(FeatureLocation(WithinPosition(35, left=35, right=39),40), \
00917                        strand=-1, type="rRNA")
00918         self.assertEqual(_insdc_feature_location_string(f,100),
00919                          "complement((36.40)..40)")
00920         self.assertEqual(_insdc_feature_location_string(f._flip(40),40),
00921                          "1..(1.5)")
00922         self.assertEqual(f.strand, -1)
00923         self.assertEqual(f._flip(100).strand, +1)
00924         self.record.features.append(f)
00925         
00926         f = SeqFeature(FeatureLocation(WithinPosition(45, left=45, right=47),
00927                                        WithinPosition(53, left=50, right=53)), \
00928                        strand=-1, type="repeat_region")
00929         self.assertEqual(_insdc_feature_location_string(f,100),
00930                          "complement((46.48)..(50.53))")
00931         self.assertEqual(len(f), len(f.extract(s)))
00932         self.assertEqual(_insdc_feature_location_string(f._flip(60),60),
00933                          "(8.11)..(13.15)")
00934         self.assertEqual(f.strand, -1)
00935         self.assertEqual(f._flip(100).strand, +1)
00936         self.record.features.append(f)
00937         
00938         f = SeqFeature(FeatureLocation(55,WithinPosition(65, left=60, right=65)), \
00939                        strand=-1, type="CDS")
00940         self.assertEqual(_insdc_feature_location_string(f,100),
00941                          "complement(56..(60.65))")
00942         self.assertEqual(len(f), len(f.extract(s)))
00943         self.assertEqual(_insdc_feature_location_string(f._flip(100),100),
00944                          "(36.41)..45")
00945         self.assertEqual(f.strand, -1)
00946         self.assertEqual(f._flip(100).strand, +1)
00947         self.record.features.append(f)
00948         
00949         self.write_read_checks()
        

Here is the call graph for this function:

Definition at line 460 of file test_SeqIO_features.py.

00460 
00461     def write_read_check(self, format):
00462         handle = StringIO()
00463         SeqIO.write([self.record], handle, format)
00464         handle.seek(0)
00465         record2 = SeqIO.read(handle, format)
00466         compare_record(self.record, record2)
    

Here is the call graph for this function:

Here is the caller graph for this function:

def test_SeqIO_features.FeatureWriting.write_read_checks (   self,
  formats = ["gb",
  embl,
  imgt 
)

Definition at line 467 of file test_SeqIO_features.py.

00467 
00468     def write_read_checks(self, formats=["gb", "embl", "imgt"]):
00469         for f in formats:
00470             self.write_read_check(f)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 458 of file test_SeqIO_features.py.


The documentation for this class was generated from the following file: