Skip to content

Commit

Permalink
Generalise short-arrow test to other sigils.
Browse files Browse the repository at this point in the history
This fails to reproduce the short BIGARROW issue
which Spencer Bliven reported in #1329, but does
identify a similar corner case with short OCTO
sigils in linear diagrams.
  • Loading branch information
peterjc committed Aug 25, 2017
1 parent 0678656 commit 68c5cda
Showing 1 changed file with 59 additions and 14 deletions.
73 changes: 59 additions & 14 deletions Tests/test_GenomeDiagram.py
Expand Up @@ -466,50 +466,95 @@ def test_arrow_heads(self):
self.assertEqual(len(self.gdd.tracks), 4)
self.finish("GD_sigil_arrows")

def test_small_arrow_heads(self):
"""Feature arrow sigil heads within bounding box."""
def short_sigils(self, glyph):
"""Draw sigils on top of grey box backgrounds."""
# The blue boxes are only relevant for the BIGARROW
# Add a track of features, bigger height to emphasise any sigil errors
self.gdt_features = self.gdd.new_track(1, greytrack=True, height=3)
# We'll just use one feature set for these features,
self.gds_features = self.gdt_features.new_set()
# Green arrows just have small heads (meaning if there is a mitre
# it will escape the bounding box). Red arrows are small triangles.
# For the ARROW and BIGARROW sigils:
# - Green arrows just have small heads (meaning if there is a mitre
# it will escape the bounding box).
# - Red arrows should be small triangles (so short no shaft shown)

# Forward strand:
feature = SeqFeature(FeatureLocation(15, 30), strand=-1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(15, 30), strand=+1)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
self.gds_features.add_feature(feature, name="Forward", sigil=glyph,
arrowhead_length=0.05)

feature = SeqFeature(FeatureLocation(55, 60), strand=-1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(55, 60), strand=+1)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
self.gds_features.add_feature(feature, name="Forward", sigil=glyph,
arrowhead_length=1000, color="red")

feature = SeqFeature(FeatureLocation(75, 125), strand=-1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(75, 125), strand=+1)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Forward", sigil="ARROW",
self.gds_features.add_feature(feature, name="Forward", sigil=glyph,
arrowhead_length=0.05)

# Strandless:
feature = SeqFeature(FeatureLocation(140, 155), strand=None)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
self.gds_features.add_feature(feature, name="Strandless", sigil=glyph,
arrowhead_length=0.05)

feature = SeqFeature(FeatureLocation(180, 185), strand=None)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
self.gds_features.add_feature(feature, name="Strandless", sigil=glyph,
arrowhead_length=1000, color="red")

feature = SeqFeature(FeatureLocation(200, 250), strand=None)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Strandless", sigil="ARROW",
self.gds_features.add_feature(feature, name="Strandless", sigil=glyph,
arrowhead_length=0.05)

# Reverse strand:
feature = SeqFeature(FeatureLocation(265, 280), strand=+1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(265, 280), strand=-1)
self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Reverse", sigil=glyph,
arrowhead_length=0.05)

feature = SeqFeature(FeatureLocation(305, 310), strand=+1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(305, 310), strand=-1)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
self.gds_features.add_feature(feature, name="Reverse", sigil=glyph,
arrowhead_length=1000, color="red")

feature = SeqFeature(FeatureLocation(325, 375), strand=+1)
self.gds_features.add_feature(feature, color="blue")
feature = SeqFeature(FeatureLocation(325, 375), strand=-1)
self.gds_features.add_feature(feature, color="grey")
self.gds_features.add_feature(feature, name="Reverse", sigil="ARROW",
self.gds_features.add_feature(feature, name="Reverse", sigil=glyph,
arrowhead_length=0.05)
self.finish("GD_sigil_arrows_small")

self.finish("GD_sigil_short_%s" % glyph)

def test_short_arrow(self):
"""Feature arrow sigil heads within bounding box."""
self.short_sigils("ARROW")

def test_short_bigarrow(self):
"""Feature big-arrow sigil heads within bounding box."""
self.short_sigils("BIGARROW")

def test_short_jaggy(self):
"""Feature arrow sigil heads within bounding box."""
self.short_sigils("JAGGY")

def test_short_octo(self):
"""Feature big-arrow sigil heads within bounding box."""
self.short_sigils("OCTO")

def long_sigils(self, glyph):
"""Check feature sigils within bounding box."""
Expand Down

0 comments on commit 68c5cda

Please sign in to comment.