Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_GenomeDiagram.SigilsTest Class Reference

List of all members.

Public Member Functions

def setUp
def add_track_with_sigils
def finish
def test_labels
def test_arrow_shafts
def test_arrow_heads
def test_small_arrow_heads
def test_long_arrow_heads

Public Attributes

 gdd
 gdt_features
 gds_features

Detailed Description

Check the different feature sigils.

These figures are intended to be used in the Tutorial...

Definition at line 317 of file test_GenomeDiagram.py.


Member Function Documentation

Definition at line 326 of file test_GenomeDiagram.py.

00326 
00327     def add_track_with_sigils(self, **kwargs):
00328         #Add a track of features,
00329         self.gdt_features = self.gdd.new_track(1, greytrack=False)
00330         #We'll just use one feature set for these features,
00331         self.gds_features = self.gdt_features.new_set()
00332         #Add three features to show the strand options,
00333         feature = SeqFeature(FeatureLocation(25, 125), strand=+1)
00334         self.gds_features.add_feature(feature, name="Forward", **kwargs)
00335         feature = SeqFeature(FeatureLocation(150, 250), strand=None)
00336         self.gds_features.add_feature(feature, name="Strandless", **kwargs)
00337         feature = SeqFeature(FeatureLocation(275, 375), strand=-1)
00338         self.gds_features.add_feature(feature, name="Reverse", **kwargs)

Here is the caller graph for this function:

def test_GenomeDiagram.SigilsTest.finish (   self,
  name,
  circular = True 
)

Definition at line 339 of file test_GenomeDiagram.py.

00339 
00340     def finish(self, name, circular=True):
00341         #And draw it...
00342         tracks = len(self.gdd.tracks)
00343         #Work arround the page orientation code being too clever
00344         #and flipping the h & w round:
00345         if tracks <= 3:
00346             orient = "landscape"
00347         else:
00348             orient = "portrait"
00349         self.gdd.draw(format='linear', orientation=orient,
00350                       tracklines=False,
00351                       pagesize=(15*cm,5*cm*tracks),
00352                       fragments=1,
00353                       start=0, end=400)
00354         self.gdd.write(os.path.join('Graphics', name+".pdf"), "pdf")
00355         #For the tutorial this might be useful:
00356         #self.gdd.write(os.path.join('Graphics', name+".png"), "png")
00357         if circular:
00358             #Circular diagram
00359             self.gdd.draw(tracklines=False,
00360                           pagesize=(15*cm,15*cm),
00361                           fragments=1,
00362                           circle_core=0.5,
00363                           start=0, end=400)
00364             self.gdd.write(os.path.join('Graphics', name+"_c.pdf"), "pdf")

Here is the caller graph for this function:

Definition at line 321 of file test_GenomeDiagram.py.

00321 
00322     def setUp(self):
00323         self.gdd = Diagram('Test Diagram', circular=False,
00324                            y=0.01, yt=0.01, yb=0.01,
00325                            x=0.01, xl=0.01, xr=0.01)

Feature arrow sigils, varying heads.

Definition at line 391 of file test_GenomeDiagram.py.

00391 
00392     def test_arrow_heads(self):
00393         """Feature arrow sigils, varying heads."""
00394         self.add_track_with_sigils(sigil="ARROW")
00395         self.add_track_with_sigils(sigil="ARROW", color="blue",
00396                                    arrowhead_length=0.25)
00397         self.add_track_with_sigils(sigil="ARROW", color="orange",
00398                                    arrowhead_length=1)
00399         self.add_track_with_sigils(sigil="ARROW", color="red",
00400                                    arrowhead_length=10000) #Triangles
00401         self.assertEqual(len(self.gdd.tracks), 4)
00402         self.finish("GD_sigil_arrows")

Here is the call graph for this function:

Feature arrow sigils, varying shafts.

Definition at line 379 of file test_GenomeDiagram.py.

00379 
00380     def test_arrow_shafts(self):
00381         """Feature arrow sigils, varying shafts."""
00382         self.add_track_with_sigils(sigil="ARROW")
00383         self.add_track_with_sigils(sigil="ARROW", color="brown",
00384                                    arrowshaft_height=1.0)
00385         self.add_track_with_sigils(sigil="ARROW", color="teal",
00386                                    arrowshaft_height=0.2)
00387         self.add_track_with_sigils(sigil="ARROW", color="darkgreen",
00388                                    arrowshaft_height=0.1)
00389         self.assertEqual(len(self.gdd.tracks), 4)
00390         self.finish("GD_sigil_arrow_shafts")        

Here is the call graph for this function:

Feature labels.

Definition at line 365 of file test_GenomeDiagram.py.

00365 
00366     def test_labels(self):
00367         """Feature labels."""
00368         self.add_track_with_sigils(label=True)
00369         self.add_track_with_sigils(label=True, color="green",
00370                                    label_size=25, label_angle=0)
00371         self.add_track_with_sigils(label=True, color="purple",
00372                                    label_position="end",
00373                                    label_size=4, label_angle=90)
00374         self.add_track_with_sigils(label=True, color="blue",
00375                                    label_position="middle",
00376                                    label_size=6, label_angle=-90)
00377         self.assertEqual(len(self.gdd.tracks), 4)
00378         self.finish("GD_sigil_labels", circular=False)

Here is the call graph for this function:

Feature arrow sigil heads within bounding box.

Definition at line 448 of file test_GenomeDiagram.py.

00448 
00449     def test_long_arrow_heads(self):
00450         """Feature arrow sigil heads within bounding box."""
00451         #Add a track of features, bigger height to emphasise any sigil errors
00452         self.gdt_features = self.gdd.new_track(1, greytrack=True, height=3)
00453         #We'll just use one feature set for these features,
00454         self.gds_features = self.gdt_features.new_set()
00455         feature = SeqFeature(FeatureLocation(25, 375), strand=+1)
00456         self.gds_features.add_feature(feature, color="lightblue")
00457         self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
00458                                       color="blue", arrowhead_length=2.0)
00459         feature = SeqFeature(FeatureLocation(25, 375), strand=-1)
00460         self.gds_features.add_feature(feature, color="pink")
00461         self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
00462                                       color="red", arrowhead_length=2.0)
00463         #Add another track of features, bigger height to emphasise any sigil errors
00464         self.gdt_features = self.gdd.new_track(1, greytrack=True, height=3)
00465         #We'll just use one feature set for these features,
00466         self.gds_features = self.gdt_features.new_set()
00467         feature = SeqFeature(FeatureLocation(25, 375), strand=None)
00468         self.gds_features.add_feature(feature, color="lightgreen")
00469         self.gds_features.add_feature(feature, name="Standless", sigil="ARROW",
00470                                       color="green", arrowhead_length=2.0)
00471         self.finish("GD_sigil_arrows_long")

Here is the call graph for this function:

Feature arrow sigil heads within bounding box.

Definition at line 403 of file test_GenomeDiagram.py.

00403 
00404     def test_small_arrow_heads(self):
00405         """Feature arrow sigil heads within bounding box."""
00406         #Add a track of features, bigger height to emphasise any sigil errors
00407         self.gdt_features = self.gdd.new_track(1, greytrack=True, height=3)
00408         #We'll just use one feature set for these features,
00409         self.gds_features = self.gdt_features.new_set()
00410         #Green arrows just have small heads (meaning if there is a mitre
00411         #it will escape the bounding box).  Red arrows are small triangles.
00412         feature = SeqFeature(FeatureLocation(15, 30), strand=+1)
00413         self.gds_features.add_feature(feature, color="grey")
00414         self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
00415                                       arrowhead_length=0.05)
00416         feature = SeqFeature(FeatureLocation(55, 60), strand=+1)
00417         self.gds_features.add_feature(feature, color="grey")
00418         self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
00419                                       arrowhead_length=1000, color="red")
00420         feature = SeqFeature(FeatureLocation(75, 125), strand=+1)
00421         self.gds_features.add_feature(feature, color="grey")
00422         self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
00423                                       arrowhead_length=0.05)
00424         feature = SeqFeature(FeatureLocation(140, 155), strand=None)
00425         self.gds_features.add_feature(feature, color="grey")
00426         self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
00427                                       arrowhead_length=0.05)
00428         feature = SeqFeature(FeatureLocation(180, 185), strand=None)
00429         self.gds_features.add_feature(feature, color="grey")
00430         self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
00431                                       arrowhead_length=1000, color="red")
00432         feature = SeqFeature(FeatureLocation(200, 250), strand=None)
00433         self.gds_features.add_feature(feature, color="grey")
00434         self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
00435                                       arrowhead_length=0.05)
00436         feature = SeqFeature(FeatureLocation(265, 280), strand=-1)
00437         self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
00438                                       arrowhead_length=0.05)
00439         feature = SeqFeature(FeatureLocation(305, 310), strand=-1)
00440         self.gds_features.add_feature(feature, color="grey")
00441         self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
00442                                       arrowhead_length=1000, color="red")
00443         feature = SeqFeature(FeatureLocation(325, 375), strand=-1)
00444         self.gds_features.add_feature(feature, color="grey")
00445         self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
00446                                       arrowhead_length=0.05)
00447         self.finish("GD_sigil_arrows_small")

Here is the call graph for this function:


Member Data Documentation

Definition at line 322 of file test_GenomeDiagram.py.

Definition at line 330 of file test_GenomeDiagram.py.

Definition at line 328 of file test_GenomeDiagram.py.


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