bio-graphics 1.2 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/classes/Bio.html +4 -26
- data/doc/classes/Bio/Feature.html +350 -0
- data/doc/classes/Bio/Feature.src/M000010.html +21 -0
- data/doc/classes/Bio/Feature.src/M000011.html +20 -0
- data/doc/classes/Bio/Feature.src/M000012.html +19 -0
- data/doc/classes/Bio/Feature.src/M000014.html +21 -0
- data/doc/classes/Bio/Feature.src/M000016.html +21 -0
- data/doc/classes/Bio/Feature.src/M000034.html +21 -0
- data/doc/classes/Bio/Feature.src/M000035.html +20 -0
- data/doc/classes/Bio/Feature.src/M000036.html +19 -0
- data/doc/classes/Bio/Feature.src/M000038.html +21 -0
- data/doc/classes/Bio/Feature.src/M000040.html +21 -0
- data/doc/classes/Bio/Feature.src/M000042.html +21 -0
- data/doc/classes/Bio/Feature.src/M000043.html +20 -0
- data/doc/classes/Bio/Feature.src/M000044.html +21 -0
- data/doc/classes/Bio/Feature.src/M000045.html +20 -0
- data/doc/classes/Bio/Feature.src/M000046.html +19 -0
- data/doc/classes/Bio/Feature.src/M000048.html +21 -0
- data/doc/classes/Bio/Feature.src/M000050.html +21 -0
- data/doc/classes/Bio/Feature.src/M000074.html +21 -0
- data/doc/classes/Bio/Feature.src/M000075.html +20 -0
- data/doc/classes/Bio/Feature.src/M000076.html +19 -0
- data/doc/classes/Bio/Feature.src/M000078.html +21 -0
- data/doc/classes/Bio/Feature.src/M000080.html +21 -0
- data/doc/classes/Bio/Feature/Qualifier.html +189 -0
- data/doc/classes/Bio/Feature/Qualifier.src/M000017.html +18 -0
- data/doc/classes/Bio/Feature/Qualifier.src/M000041.html +18 -0
- data/doc/classes/Bio/Feature/Qualifier.src/M000049.html +18 -0
- data/doc/classes/Bio/Feature/Qualifier.src/M000051.html +18 -0
- data/doc/classes/Bio/Feature/Qualifier.src/M000081.html +18 -0
- data/doc/classes/Bio/Features.html +329 -0
- data/doc/classes/Bio/Features.src/M000004.html +18 -0
- data/doc/classes/Bio/Features.src/M000005.html +19 -0
- data/doc/classes/Bio/Features.src/M000006.html +21 -0
- data/doc/classes/Bio/Features.src/M000007.html +18 -0
- data/doc/classes/Bio/Features.src/M000008.html +18 -0
- data/doc/classes/Bio/Features.src/M000009.html +18 -0
- data/doc/classes/Bio/Features.src/M000028.html +18 -0
- data/doc/classes/Bio/Features.src/M000029.html +19 -0
- data/doc/classes/Bio/Features.src/M000030.html +21 -0
- data/doc/classes/Bio/Features.src/M000031.html +18 -0
- data/doc/classes/Bio/Features.src/M000032.html +18 -0
- data/doc/classes/Bio/Features.src/M000033.html +18 -0
- data/doc/classes/Bio/Features.src/M000036.html +18 -0
- data/doc/classes/Bio/Features.src/M000037.html +19 -0
- data/doc/classes/Bio/Features.src/M000038.html +18 -0
- data/doc/classes/Bio/Features.src/M000039.html +19 -0
- data/doc/classes/Bio/Features.src/M000040.html +21 -0
- data/doc/classes/Bio/Features.src/M000041.html +18 -0
- data/doc/classes/Bio/Features.src/M000042.html +18 -0
- data/doc/classes/Bio/Features.src/M000043.html +18 -0
- data/doc/classes/Bio/Features.src/M000068.html +18 -0
- data/doc/classes/Bio/Features.src/M000069.html +19 -0
- data/doc/classes/Bio/Features.src/M000070.html +21 -0
- data/doc/classes/Bio/Features.src/M000071.html +18 -0
- data/doc/classes/Bio/Features.src/M000072.html +18 -0
- data/doc/classes/Bio/Features.src/M000073.html +18 -0
- data/doc/classes/Bio/Graphics.html +28 -42
- data/doc/classes/Bio/Graphics/{Panel/Track/Feature.html → Feature.html} +98 -125
- data/doc/classes/Bio/Graphics/Feature.src/M000020.html +51 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000021.html +65 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000022.html +55 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000023.html +66 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000024.html +51 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000025.html +65 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000026.html +55 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000054.html +51 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000055.html +65 -0
- data/doc/classes/Bio/Graphics/Feature.src/M000056.html +55 -0
- data/doc/classes/Bio/Graphics/Feature/SubFeature.html +348 -0
- data/doc/classes/Bio/Graphics/Feature/SubFeature.src/M000025.html +68 -0
- data/doc/classes/Bio/Graphics/Feature/SubFeature.src/M000026.html +67 -0
- data/doc/classes/Bio/Graphics/Glyph.html +178 -0
- data/doc/classes/Bio/Graphics/Glyph/Box.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/Box.src/M000004.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/Box.src/M000032.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.html +187 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000004.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000005.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000006.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000007.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000033.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000034.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/Common.src/M000035.html +24 -0
- data/doc/classes/Bio/Graphics/Glyph/CustomTestGlyph.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/CustomTestGlyph.src/M000037.html +22 -0
- data/doc/classes/Bio/Graphics/Glyph/CustomTestGlyphInFile.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/CustomTestGlyphInFile.src/M000038.html +22 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedBox.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedBox.src/M000009.html +31 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedBox.src/M000039.html +31 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedGeneric.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedGeneric.src/M000011.html +26 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedGeneric.src/M000013.html +26 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedGeneric.src/M000043.html +26 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedSpliced.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedSpliced.src/M000008.html +40 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedSpliced.src/M000010.html +40 -0
- data/doc/classes/Bio/Graphics/Glyph/DirectedSpliced.src/M000040.html +40 -0
- data/doc/classes/Bio/Graphics/{Panel/Track/Feature/PixelRange.html → Glyph/Dot.html} +16 -19
- data/doc/classes/Bio/Graphics/Glyph/Dot.src/M000013.html +22 -0
- data/doc/classes/Bio/Graphics/Glyph/Dot.src/M000015.html +22 -0
- data/doc/classes/Bio/Graphics/Glyph/Dot.src/M000045.html +22 -0
- data/doc/classes/Bio/Graphics/Glyph/Generic.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/Generic.src/M000009.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Generic.src/M000011.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Generic.src/M000041.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph/Line.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/Line.src/M000012.html +20 -0
- data/doc/classes/Bio/Graphics/Glyph/Line.src/M000014.html +20 -0
- data/doc/classes/Bio/Graphics/Glyph/Line.src/M000044.html +20 -0
- data/doc/classes/Bio/Graphics/Glyph/LineWithHandles.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/LineWithHandles.src/M000014.html +28 -0
- data/doc/classes/Bio/Graphics/Glyph/LineWithHandles.src/M000016.html +28 -0
- data/doc/classes/Bio/Graphics/Glyph/LineWithHandles.src/M000046.html +28 -0
- data/doc/classes/Bio/Graphics/Glyph/Spliced.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/Spliced.src/M000010.html +19 -0
- data/doc/classes/Bio/Graphics/Glyph/Spliced.src/M000012.html +19 -0
- data/doc/classes/Bio/Graphics/Glyph/Spliced.src/M000042.html +19 -0
- data/doc/classes/Bio/Graphics/Glyph/Transcript.html +113 -0
- data/doc/classes/Bio/Graphics/Glyph/Triangle.html +139 -0
- data/doc/classes/Bio/Graphics/Glyph/Triangle.src/M000007.html +21 -0
- data/doc/classes/Bio/Graphics/Glyph/Triangle.src/M000008.html +21 -0
- data/doc/classes/Bio/Graphics/Glyph/Triangle.src/M000036.html +21 -0
- data/doc/classes/{ImageMap.html → Bio/Graphics/ImageMap.html} +50 -16
- data/doc/classes/{ImageMap.src/M000001.html → Bio/Graphics/ImageMap.src/M000030.html} +3 -3
- data/doc/classes/Bio/Graphics/ImageMap.src/M000031.html +18 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000032.html +18 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000033.html +18 -0
- data/doc/classes/{ImageMap.src/M000002.html → Bio/Graphics/ImageMap.src/M000034.html} +7 -4
- data/doc/classes/Bio/Graphics/ImageMap.src/M000035.html +24 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000062.html +18 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000063.html +18 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000064.html +27 -0
- data/doc/classes/Bio/Graphics/ImageMap.src/M000065.html +24 -0
- data/doc/classes/{ImageMap/ImageMapElement.html → Bio/Graphics/ImageMap/Element.html} +14 -14
- data/doc/classes/{ImageMap/ImageMapElement.src/M000003.html → Bio/Graphics/ImageMap/Element.src/M000034.html} +3 -3
- data/doc/classes/{ImageMap/ImageMapElement.src/M000004.html → Bio/Graphics/ImageMap/Element.src/M000035.html} +6 -4
- data/doc/classes/Bio/Graphics/ImageMap/Element.src/M000036.html +19 -0
- data/doc/classes/Bio/Graphics/ImageMap/Element.src/M000037.html +22 -0
- data/doc/classes/Bio/Graphics/ImageMap/Element.src/M000066.html +19 -0
- data/doc/classes/Bio/Graphics/ImageMap/Element.src/M000067.html +22 -0
- data/doc/classes/Bio/Graphics/Panel.html +70 -69
- data/doc/classes/Bio/Graphics/Panel.src/M000025.html +52 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000026.html +20 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000027.html +98 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000028.html +20 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000029.html +52 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000030.html +20 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000031.html +98 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000059.html +52 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000060.html +20 -0
- data/doc/classes/Bio/Graphics/Panel.src/M000061.html +98 -0
- data/doc/classes/Bio/Graphics/{Panel/Ruler.html → Ruler.html} +50 -21
- data/doc/classes/Bio/Graphics/Ruler.src/M000015.html +30 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000016.html +20 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000017.html +30 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000018.html +20 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000019.html +26 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000020.html +45 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000047.html +30 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000048.html +20 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000049.html +26 -0
- data/doc/classes/Bio/Graphics/Ruler.src/M000050.html +45 -0
- data/doc/classes/Bio/Graphics/SubFeature.html +348 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000001.html +73 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000002.html +69 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000023.html +73 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000024.html +69 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000027.html +73 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000028.html +69 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000057.html +73 -0
- data/doc/classes/Bio/Graphics/SubFeature.src/M000058.html +69 -0
- data/doc/classes/Bio/Graphics/{Panel/Track.html → Track.html} +67 -69
- data/doc/classes/Bio/Graphics/Track.src/M000017.html +39 -0
- data/doc/classes/Bio/Graphics/Track.src/M000018.html +37 -0
- data/doc/classes/Bio/Graphics/Track.src/M000019.html +45 -0
- data/doc/classes/Bio/Graphics/Track.src/M000020.html +41 -0
- data/doc/classes/Bio/Graphics/Track.src/M000021.html +39 -0
- data/doc/classes/Bio/Graphics/Track.src/M000022.html +37 -0
- data/doc/classes/Bio/Graphics/Track.src/M000023.html +45 -0
- data/doc/classes/Bio/Graphics/Track.src/M000051.html +39 -0
- data/doc/classes/Bio/Graphics/Track.src/M000052.html +37 -0
- data/doc/classes/Bio/Graphics/Track.src/M000053.html +45 -0
- data/doc/classes/Range.html +129 -0
- data/doc/classes/String.html +167 -0
- data/doc/classes/String.src/M000001.html +18 -0
- data/doc/classes/String.src/M000002.html +18 -0
- data/doc/classes/String.src/M000003.html +23 -0
- data/doc/classes/String.src/M000029.html +18 -0
- data/doc/classes/String.src/M000030.html +18 -0
- data/doc/classes/String.src/M000031.html +23 -0
- data/doc/classes/TestCustomGlyph.html +137 -0
- data/doc/classes/TestCustomGlyph.src/M000025.html +25 -0
- data/doc/classes/TestCustomGlyphInFile.html +167 -0
- data/doc/classes/TestCustomGlyphInFile.src/M000026.html +19 -0
- data/doc/classes/TestCustomGlyphInFile.src/M000027.html +25 -0
- data/doc/classes/TestCustomGlyphInFile.src/M000028.html +18 -0
- data/doc/classes/TestExtensions.html +152 -0
- data/doc/classes/TestExtensions.src/M000015.html +22 -0
- data/doc/classes/TestExtensions.src/M000016.html +25 -0
- data/doc/classes/TestFeature.html +152 -0
- data/doc/classes/TestFeature.src/M000017.html +19 -0
- data/doc/classes/TestFeature.src/M000018.html +21 -0
- data/doc/classes/TestImageMap.html +182 -0
- data/doc/classes/TestImageMap.src/M000019.html +22 -0
- data/doc/classes/TestImageMap.src/M000020.html +56 -0
- data/doc/classes/TestImageMap.src/M000021.html +56 -0
- data/doc/classes/TestImageMap.src/M000022.html +20 -0
- data/doc/classes/TestPanel.html +276 -0
- data/doc/classes/TestPanel.src/M000001.html +18 -0
- data/doc/classes/TestPanel.src/M000002.html +61 -0
- data/doc/classes/TestPanel.src/M000003.html +35 -0
- data/doc/classes/TestPanel.src/M000004.html +54 -0
- data/doc/classes/TestPanel.src/M000005.html +54 -0
- data/doc/classes/TestPanel.src/M000006.html +41 -0
- data/doc/classes/TestPanel.src/M000007.html +36 -0
- data/doc/classes/TestPanel.src/M000008.html +20 -0
- data/doc/classes/TestPanel.src/M000009.html +26 -0
- data/doc/classes/TestPanel.src/M000010.html +21 -0
- data/doc/classes/TestRuler.html +152 -0
- data/doc/classes/TestRuler.src/M000013.html +22 -0
- data/doc/classes/TestRuler.src/M000014.html +31 -0
- data/doc/classes/TestSubFeature.html +152 -0
- data/doc/classes/TestSubFeature.src/M000023.html +21 -0
- data/doc/classes/TestSubFeature.src/M000024.html +18 -0
- data/doc/classes/TestTrack.html +152 -0
- data/doc/classes/TestTrack.src/M000011.html +19 -0
- data/doc/classes/TestTrack.src/M000012.html +23 -0
- data/doc/created.rid +1 -1
- data/doc/files/README_DEV.html +399 -70
- data/doc/files/TUTORIAL.html +188 -67
- data/doc/files/lib/bio-graphics_rb.html +3 -2
- data/doc/files/lib/bio/graphics/feature_rb.html +12 -6
- data/doc/files/lib/bio/graphics/glyphs/box_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/common_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/directed_box_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/directed_generic_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/directed_spliced_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/dot_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/generic_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/line_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/line_with_handles_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/spliced_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/transcript_rb.html +113 -0
- data/doc/files/lib/bio/graphics/glyphs/triangle_rb.html +113 -0
- data/doc/files/lib/bio/graphics/image_map_rb.html +3 -2
- data/doc/files/lib/bio/graphics/panel_rb.html +10 -2
- data/doc/files/lib/bio/graphics/ruler_rb.html +3 -2
- data/doc/files/lib/bio/graphics/subfeature_rb.html +114 -0
- data/doc/files/lib/bio/graphics/track_rb.html +3 -2
- data/doc/files/lib/feature_rb.html +101 -0
- data/doc/files/samples/arkdb_features_rb.html +101 -0
- data/doc/files/samples/glyph_showcase_rb.html +108 -0
- data/doc/files/samples/protein_domains_rb.html +115 -0
- data/doc/files/samples/subfeatures_rb.html +108 -0
- data/doc/files/scripts/gff2png_rb.html +154 -0
- data/doc/files/test/unit/custom_glyph_in_file_rb.html +101 -0
- data/doc/files/test/unit/test_class_extensions_rb.html +108 -0
- data/doc/files/test/unit/test_creation_rb.html +108 -0
- data/doc/files/test/unit/test_custom_glyph_rb.html +108 -0
- data/doc/files/test/unit/test_draw_rb.html +108 -0
- data/doc/files/test/unit/test_imagemap_rb.html +108 -0
- data/doc/files/test/unit/test_subfeatures_rb.html +108 -0
- data/doc/fr_class_index.html +24 -6
- data/doc/fr_file_index.html +14 -0
- data/doc/fr_method_index.html +51 -19
- data/doc/images/glyph_showcase.png +0 -0
- data/doc/images/terms.svg +146 -132
- data/images/glyph_showcase.png +0 -0
- data/lib/bio-graphics.rb +38 -6
- data/lib/bio/graphics/feature.rb +212 -440
- data/lib/bio/graphics/glyphs/box.rb +21 -0
- data/lib/bio/graphics/glyphs/common.rb +149 -0
- data/lib/bio/graphics/glyphs/directed_box.rb +28 -0
- data/lib/bio/graphics/glyphs/directed_generic.rb +23 -0
- data/lib/bio/graphics/glyphs/directed_spliced.rb +39 -0
- data/lib/bio/graphics/glyphs/dot.rb +21 -0
- data/lib/bio/graphics/glyphs/generic.rb +15 -0
- data/lib/bio/graphics/glyphs/line.rb +17 -0
- data/lib/bio/graphics/glyphs/line_with_handles.rb +25 -0
- data/lib/bio/graphics/glyphs/spliced.rb +16 -0
- data/lib/bio/graphics/glyphs/transcript.rb +12 -0
- data/lib/bio/graphics/glyphs/triangle.rb +18 -0
- data/lib/bio/graphics/image_map.rb +25 -4
- data/lib/bio/graphics/panel.rb +266 -209
- data/lib/bio/graphics/ruler.rb +95 -96
- data/lib/bio/graphics/subfeature.rb +187 -0
- data/lib/bio/graphics/track.rb +155 -156
- data/lib/feature.rb +204 -0
- data/samples/arkdb_features.rb +10 -8
- data/samples/glyph_showcase.rb +58 -22
- data/samples/protein_domains.rb +19 -0
- data/samples/subfeatures.rb +31 -0
- data/test/unit/custom_glyph_in_file.rb +12 -0
- data/test/unit/data.txt +32 -0
- data/test/unit/test_class_extensions.rb +23 -0
- data/test/unit/test_creation.rb +43 -13
- data/test/unit/test_custom_glyph.rb +50 -0
- data/test/unit/test_draw.rb +211 -0
- data/test/unit/test_imagemap.rb +134 -0
- data/test/unit/test_subfeatures.rb +17 -0
- metadata +396 -119
- data/doc/classes/Bio/Graphics/Panel.src/M000005.html +0 -29
- data/doc/classes/Bio/Graphics/Panel.src/M000006.html +0 -19
- data/doc/classes/Bio/Graphics/Panel.src/M000007.html +0 -68
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000008.html +0 -20
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000009.html +0 -28
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000010.html +0 -54
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000013.html +0 -20
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000014.html +0 -20
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000015.html +0 -28
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000016.html +0 -59
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000017.html +0 -20
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000018.html +0 -28
- data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000019.html +0 -59
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000008.html +0 -26
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000009.html +0 -42
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000010.html +0 -52
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000011.html +0 -23
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000012.html +0 -43
- data/doc/classes/Bio/Graphics/Panel/Track.src/M000013.html +0 -259
- data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000011.html +0 -65
- data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000012.html +0 -39
- data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000013.html +0 -27
- data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000014.html +0 -225
- data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000015.html +0 -48
- data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000012.html +0 -18
- data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000013.html +0 -18
- data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000015.html +0 -18
- data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000016.html +0 -18
data/lib/bio/graphics/ruler.rb
CHANGED
@@ -1,96 +1,95 @@
|
|
1
|
-
#
|
2
|
-
# = bio/graphics/ruler - ruler class
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (C) 2007
|
5
|
-
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end #Bio
|
1
|
+
#
|
2
|
+
# = bio/graphics/ruler - ruler class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2007
|
5
|
+
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
6
|
+
# Charles Comstock <dgtized@gmail.com>
|
7
|
+
# License:: The Ruby License
|
8
|
+
#
|
9
|
+
|
10
|
+
# The Bio::Graphics::Ruler class describes the ruler to be drawn on the
|
11
|
+
# graph. This is created automatically when creating the picture by using
|
12
|
+
# Bio::Graphics::Panel.to_svg. See BioExt::Graphics documentation for
|
13
|
+
# explanation of interplay between different classes.
|
14
|
+
#--
|
15
|
+
# TODO: the ruler might be implemented as a special case of a track, so
|
16
|
+
# it would inherit from it (class Ruler < Bio::Graphics::Track).
|
17
|
+
# But I haven't really thought this through yet.
|
18
|
+
#++
|
19
|
+
class Bio::Graphics::Ruler
|
20
|
+
# Creates a new Bio::Graphics::Ruler object.
|
21
|
+
# ---
|
22
|
+
# *Arguments*:
|
23
|
+
# * _panel_ (required) :: Bio::Graphics::Panel object that this ruler
|
24
|
+
# belongs to
|
25
|
+
# * _colour_ :: colour of the ruler. Default = 'black'
|
26
|
+
# *Returns*:: Bio::Graphics::Ruler object
|
27
|
+
def initialize(panel, colour = [0,0,0])
|
28
|
+
@panel = panel
|
29
|
+
@name = 'ruler'
|
30
|
+
@colour = colour
|
31
|
+
|
32
|
+
# Number of pixels between each tick, used to calculate tick spacing
|
33
|
+
@min_pixels_per_tick = 5
|
34
|
+
# The base height of minor ticks in pixels
|
35
|
+
@tick_height = 5
|
36
|
+
# The height of the text in pixels
|
37
|
+
@tick_text_height = 10
|
38
|
+
|
39
|
+
@minor_tick_distance = @min_pixels_per_tick ** self.scaling_factor
|
40
|
+
@major_tick_distance = @minor_tick_distance * 10
|
41
|
+
end
|
42
|
+
attr_accessor(:panel, :name, :colour, :height,
|
43
|
+
:minor_tick_distance, :major_tick_distance,
|
44
|
+
:min_pixels_per_tick, :tick_height, :tick_text_height)
|
45
|
+
|
46
|
+
def scaling_factor(min_pixels_per_tick = @min_pixels_per_tick,
|
47
|
+
rescale_factor = @panel.rescale_factor)
|
48
|
+
(Math.log(min_pixels_per_tick * rescale_factor) /
|
49
|
+
Math.log(min_pixels_per_tick)).ceil
|
50
|
+
end
|
51
|
+
|
52
|
+
def first_tick_position(start = @panel.display_start,
|
53
|
+
minor_tick = @minor_tick_distance)
|
54
|
+
# * Find position of first tick.
|
55
|
+
# Most of the time, we don't want the first tick on the very first
|
56
|
+
# basepair of the view. Suppose that would be position 333 in the
|
57
|
+
# sequence. Then the numbers under the major tickmarks would be:
|
58
|
+
# 343, 353, 363, 373 and so on. Instead, we want 350, 360, 370, 380.
|
59
|
+
# So we want to find the position of the first tick.
|
60
|
+
modulo_from_tick = (start % minor_tick)
|
61
|
+
start + (modulo_from_tick > 0 ? (minor_tick - modulo_from_tick + 1) : 0)
|
62
|
+
end
|
63
|
+
|
64
|
+
def draw(panel_drawing)
|
65
|
+
ruler_drawing = Cairo::Context.new(panel_drawing)
|
66
|
+
|
67
|
+
# Draw line
|
68
|
+
ruler_drawing.move_to(0,10)
|
69
|
+
ruler_drawing.line_to(panel.width, 10)
|
70
|
+
ruler_drawing.stroke
|
71
|
+
|
72
|
+
# Draw ticks
|
73
|
+
# * And start drawing the rest.
|
74
|
+
first_tick_position.step(@panel.display_stop, @minor_tick_distance) do |tick|
|
75
|
+
tick_pixel_position = (tick - panel.display_start) / @panel.rescale_factor
|
76
|
+
ruler_drawing.move_to(tick_pixel_position.floor, @min_pixels_per_tick)
|
77
|
+
if tick.modulo(@major_tick_distance) == 0
|
78
|
+
ruler_drawing.rel_line_to(0, 3*@tick_height)
|
79
|
+
|
80
|
+
# Draw tick number
|
81
|
+
ruler_drawing.select_font_face(*Bio::Graphics::FONT)
|
82
|
+
ruler_drawing.set_font_size(@tick_text_height)
|
83
|
+
ruler_drawing.move_to(tick_pixel_position.floor, 4*@tick_height + @tick_text_height)
|
84
|
+
ruler_drawing.show_text(tick.to_i.to_s)
|
85
|
+
else
|
86
|
+
ruler_drawing.rel_line_to(0, @tick_height)
|
87
|
+
|
88
|
+
end
|
89
|
+
ruler_drawing.stroke
|
90
|
+
end
|
91
|
+
|
92
|
+
@height = 5*@tick_height + @tick_text_height
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
@@ -0,0 +1,187 @@
|
|
1
|
+
#
|
2
|
+
# = bio/graphics/subfeature.rb - subfeature class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2007, 2008
|
5
|
+
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
6
|
+
# Charles Comstock <dgtized@gmail.com>
|
7
|
+
# License:: The Ruby License
|
8
|
+
#
|
9
|
+
|
10
|
+
# TODO: Documentation for SubFeature
|
11
|
+
class Bio::Graphics::SubFeature
|
12
|
+
# !!Not to be used directly.
|
13
|
+
# ---
|
14
|
+
# *Arguments*:
|
15
|
+
# * _feature_ (required) :: Bio::Graphics::Feature
|
16
|
+
# object that this subfeature belongs to
|
17
|
+
# * _feature_ _object_ (required) :: A Bio::Feature object (see bioruby)
|
18
|
+
# * :glyph :: Glyph to use. Default = glyph of the track
|
19
|
+
# * :colour :: Colour. Default = colour of the track
|
20
|
+
# *Returns*:: Bio::Graphics::SubFeature object
|
21
|
+
def initialize(feature, feature_object, opts = {})
|
22
|
+
@feature = feature
|
23
|
+
@feature_object = feature_object
|
24
|
+
opts = {
|
25
|
+
:glyph => @feature.glyph,
|
26
|
+
:colour => @feature.colour
|
27
|
+
}.merge(opts)
|
28
|
+
|
29
|
+
@glyph = opts[:glyph]
|
30
|
+
@colour = opts[:colour]
|
31
|
+
|
32
|
+
@locations = @feature_object.locations
|
33
|
+
|
34
|
+
@start = @locations.collect{|l| l.from}.min.to_i
|
35
|
+
@stop = @locations.collect{|l| l.to}.max.to_i
|
36
|
+
@strand = @locations[0].strand.to_i
|
37
|
+
@pixel_range_collection = Array.new
|
38
|
+
@chopped_at_start = false
|
39
|
+
@chopped_at_stop = false
|
40
|
+
@hidden_subfeatures_at_start = false
|
41
|
+
@hidden_subfeatures_at_stop = false
|
42
|
+
|
43
|
+
# Get all pixel ranges for the subfeatures
|
44
|
+
@locations.each do |l|
|
45
|
+
# xxxxxx [ ]
|
46
|
+
if l.to < @feature.track.panel.display_start
|
47
|
+
@hidden_subfeatures_at_start = true
|
48
|
+
next
|
49
|
+
# [ ] xxxxx
|
50
|
+
elsif l.from > @feature.track.panel.display_stop
|
51
|
+
@hidden_subfeatures_at_stop = true
|
52
|
+
next
|
53
|
+
# xxxx[xxx ]
|
54
|
+
elsif l.from < @feature.track.panel.display_start and l.to > @feature.track.panel.display_start
|
55
|
+
start_pixel = 1
|
56
|
+
stop_pixel = ( l.to - @feature.track.panel.display_start ).to_f / @feature.track.panel.rescale_factor
|
57
|
+
@chopped_at_start = true
|
58
|
+
# [ xxxx]xxxx
|
59
|
+
elsif l.from < @feature.track.panel.display_stop and l.to > @feature.track.panel.display_stop
|
60
|
+
start_pixel = ( l.from - @feature.track.panel.display_start ).to_f / @feature.track.panel.rescale_factor
|
61
|
+
stop_pixel = @feature.track.panel.width
|
62
|
+
@chopped_at_stop = true
|
63
|
+
# xxxx[xxxxxxxxxx]xxxx
|
64
|
+
elsif l.from < @feature.track.panel.display_start and l.to > @feature.track.panel.display_stop
|
65
|
+
start_pixel = 1
|
66
|
+
stop_pixel = @feature.track.panel.width
|
67
|
+
@chopped_at_start = true
|
68
|
+
@chopped_at_stop = true
|
69
|
+
# [ xxxxx ]
|
70
|
+
else
|
71
|
+
start_pixel = ( l.from - @feature.track.panel.display_start ).to_f / @feature.track.panel.rescale_factor
|
72
|
+
stop_pixel = ( l.to - @feature.track.panel.display_start ).to_f / @feature.track.panel.rescale_factor
|
73
|
+
end
|
74
|
+
|
75
|
+
@pixel_range_collection.push(Range.new(start_pixel, stop_pixel))
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# The bioruby Bio::Feature object
|
81
|
+
attr_accessor :feature_object
|
82
|
+
|
83
|
+
# The feature that this subfeature belongs to
|
84
|
+
attr_accessor :feature
|
85
|
+
|
86
|
+
# The label of the feature
|
87
|
+
attr_accessor :label
|
88
|
+
alias :name :label
|
89
|
+
|
90
|
+
# The locations of the feature (which is a Bio::Locations object)
|
91
|
+
attr_accessor :locations
|
92
|
+
alias :location :locations
|
93
|
+
|
94
|
+
# The start position of the feature (in bp)
|
95
|
+
attr_accessor :start
|
96
|
+
|
97
|
+
# The stop position of the feature (in bp)
|
98
|
+
attr_accessor :stop
|
99
|
+
|
100
|
+
# The strand of the feature
|
101
|
+
attr_accessor :strand
|
102
|
+
|
103
|
+
# The glyph to use to draw this (sub)feature
|
104
|
+
attr_accessor :glyph
|
105
|
+
|
106
|
+
# The colour to use to draw this (sub)feature
|
107
|
+
attr_accessor :colour
|
108
|
+
|
109
|
+
# The array keeping the pixel ranges for the sub-features. Unspliced
|
110
|
+
# features will just have one element, while spliced features will
|
111
|
+
# have more than one.
|
112
|
+
attr_accessor :pixel_range_collection
|
113
|
+
|
114
|
+
# Is the first subfeature incomplete?
|
115
|
+
attr_accessor :chopped_at_start
|
116
|
+
|
117
|
+
# Is the last subfeature incomplete?
|
118
|
+
attr_accessor :chopped_at_stop
|
119
|
+
|
120
|
+
# Are there subfeatures out of view at the left side of the picture?
|
121
|
+
attr_accessor :hidden_subfeatures_at_start
|
122
|
+
|
123
|
+
# Are there subfeatures out of view at the right side of the picture?
|
124
|
+
attr_accessor :hidden_subfeatures_at_stop
|
125
|
+
|
126
|
+
# Adds the subfeature to the track cairo context. This method should not
|
127
|
+
# be used directly by the user, but is called by
|
128
|
+
# Bio::Graphics::Feature::SubFeature.draw
|
129
|
+
# ---
|
130
|
+
# *Arguments*:
|
131
|
+
# * _track_drawing_ (required) :: the track cairo object
|
132
|
+
# *Returns*:: FIXME: I don't know
|
133
|
+
def draw(feature_context)
|
134
|
+
# Set the glyph to be used. The glyph can be set as a symbol (e.g. :generic)
|
135
|
+
# or as a hash (e.g. {'utr' => :line, 'cds' => :directed_spliced}).
|
136
|
+
if @feature.glyph.class == Hash
|
137
|
+
@glyph = @feature.glyph[@feature_object.feature]
|
138
|
+
else
|
139
|
+
@glyph = @feature.glyph
|
140
|
+
end
|
141
|
+
|
142
|
+
# We have to check if we want to change the glyph type from directed to
|
143
|
+
# undirected
|
144
|
+
# There are 2 cases where we don't want to draw arrows on
|
145
|
+
# features:
|
146
|
+
# (a) when the picture is really zoomed out, features are
|
147
|
+
# so small that the arrow itself is too big
|
148
|
+
# (b) if a directed feature on the fw strand extends beyond
|
149
|
+
# the end of the picture, the arrow is out of view. This
|
150
|
+
# is the same as considering the feature as undirected.
|
151
|
+
# The same obviously goes for features on the reverse
|
152
|
+
# strand that extend beyond the left side of the image.
|
153
|
+
#
|
154
|
+
# (a) Zoomed out
|
155
|
+
replace_directed_with_undirected = false
|
156
|
+
if (@stop - @start).to_f/@feature.track.panel.rescale_factor.to_f < 2
|
157
|
+
replace_directed_with_undirected = true
|
158
|
+
end
|
159
|
+
# (b) Extending beyond borders picture
|
160
|
+
if ( @chopped_at_stop and @strand = 1 ) or ( @chopped_at_start and @strand = -1 )
|
161
|
+
replace_directed_with_undirected = true
|
162
|
+
end
|
163
|
+
|
164
|
+
local_feature_glyph = nil
|
165
|
+
if @glyph == :directed_generic and replace_directed_with_undirected
|
166
|
+
local_feature_glyph = :generic
|
167
|
+
elsif @glyph == :directed_spliced and replace_directed_with_undirected
|
168
|
+
local_feature_glyph = :spliced
|
169
|
+
elsif @glyph == :directed_box and replace_directed_with_undirected
|
170
|
+
local_feature_glyph = :box
|
171
|
+
else
|
172
|
+
local_feature_glyph = @glyph
|
173
|
+
end
|
174
|
+
|
175
|
+
# And draw the thing.
|
176
|
+
|
177
|
+
feature_context.set_source_rgb(@colour)
|
178
|
+
|
179
|
+
glyph = ("Bio::Graphics::Glyph::" + local_feature_glyph.to_s.camel_case).to_class.new(self, feature_context)
|
180
|
+
glyph.draw
|
181
|
+
|
182
|
+
@feature.left_pixel_of_subfeatures.push(glyph.left_pixel)
|
183
|
+
@feature.right_pixel_of_subfeatures.push(glyph.right_pixel)
|
184
|
+
|
185
|
+
|
186
|
+
end
|
187
|
+
end #SubFeature
|
data/lib/bio/graphics/track.rb
CHANGED
@@ -1,156 +1,155 @@
|
|
1
|
-
#
|
2
|
-
# = bio/graphics/track - track class
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (C) 2007
|
5
|
-
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
#
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
end #Bio
|
1
|
+
#
|
2
|
+
# = bio/graphics/track - track class
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (C) 2007, 2008
|
5
|
+
# Jan Aerts <jan.aerts@bbsrc.ac.uk>
|
6
|
+
# Charles Comstock <dgtized@gmail.com>
|
7
|
+
# License:: The Ruby License
|
8
|
+
#
|
9
|
+
|
10
|
+
# The Bio::Graphics::Track class describes the container for features of
|
11
|
+
# the same type. See Bio::Graphics documentation for explanation of
|
12
|
+
# interplay between different classes.
|
13
|
+
class Bio::Graphics::Track
|
14
|
+
# !!Not to be used directly. Use Bio::Graphics::Panel.add_track instead!!
|
15
|
+
# A track can not exist except within the confines of a
|
16
|
+
# Bio::Graphics::Panel object.
|
17
|
+
#
|
18
|
+
#--
|
19
|
+
# This is necessary because the track needs to know the rescale_factor
|
20
|
+
# and width of the picture, both of which are defined within the panel.
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
# ---
|
24
|
+
# *Arguments*:
|
25
|
+
# * _panel_ (required) :: Bio::Graphics::Panel object that this track
|
26
|
+
# belongs to
|
27
|
+
# * _name_ (required) :: Name of the track to be displayed (e.g. 'genes')
|
28
|
+
# * _:label_ :: Boolean: should the label for each feature be drawn or not
|
29
|
+
# Default = true
|
30
|
+
# * _:glyph_ :: Glyph to use for drawing the features. Options are:
|
31
|
+
# :generic, :directed_generic, :box, directed_box, :spliced,
|
32
|
+
# :directed_spliced, :dot, :triangle, :line and :line_with_handles.
|
33
|
+
# Default = :generic
|
34
|
+
# * _colour_ :: Colour to be used to draw the features within the track (in
|
35
|
+
# RGB) Default = [0,0,1] (i.e. blue)
|
36
|
+
# *Returns*:: Bio::Graphics::Track object
|
37
|
+
def initialize(panel, name, opts = {})
|
38
|
+
@panel = panel
|
39
|
+
@name = name
|
40
|
+
opts = {
|
41
|
+
:label => true,
|
42
|
+
:glyph => :generic,
|
43
|
+
:colour => [0,0,1]
|
44
|
+
}.merge(opts)
|
45
|
+
|
46
|
+
@show_label = opts[:label]
|
47
|
+
@glyph = opts[:glyph]
|
48
|
+
@colour = opts[:colour]
|
49
|
+
|
50
|
+
# As far as I know, I can't do this in the glyph file for transcript, so we
|
51
|
+
# have to do it here instead.
|
52
|
+
if @glyph == :transcript
|
53
|
+
@glyph = { 'utr5' => :box, 'utr3' => :directed_box, 'cds' => :spliced }
|
54
|
+
end
|
55
|
+
|
56
|
+
@features = Array.new
|
57
|
+
@number_of_feature_rows = 0
|
58
|
+
@vertical_offset = 0
|
59
|
+
@grid = Hash.new
|
60
|
+
end
|
61
|
+
attr_accessor :panel, :name, :show_label, :colour, :glyph, :features, :number_of_feature_rows, :height, :vertical_offset, :grid
|
62
|
+
|
63
|
+
# Takes a Bio::Feature and adds it as a Bio::Graphics::Feature to this track.
|
64
|
+
# A track contains features of the same type, e.g. (for sequence annotation:)
|
65
|
+
# genes, polymorphisms, ESTs, etc.
|
66
|
+
#
|
67
|
+
# est_track.add_feature(Bio::Feature.new('EST1','50..60'))
|
68
|
+
# est_track.add_feature(Bio::Feature.new('EST2','52..73'))
|
69
|
+
# est_track.add_feature(Bio::Feature.new('EST3','41..69'))
|
70
|
+
# gene_track.add_feature(Bio::Feature.new('gene2','39..73'))
|
71
|
+
#
|
72
|
+
# For spliced features:
|
73
|
+
# est_track.add_feature('EST4','join(34..53,153..191)')
|
74
|
+
#
|
75
|
+
# Or on the complement strand:
|
76
|
+
# est_track.add_feature('EST5','complement(join(34..53,153..191))')
|
77
|
+
#
|
78
|
+
# See the documentation in Bio::Locations for a full description of
|
79
|
+
# how locations can be defined.
|
80
|
+
#
|
81
|
+
# Features are only added if they are at least partly in the displayed
|
82
|
+
# region. If a feature is completely outside of the region, it's not
|
83
|
+
# added. If it should be only partly visible, it is added completely.
|
84
|
+
#
|
85
|
+
# ---
|
86
|
+
# *Arguments*:
|
87
|
+
# * _feature_ _object_ (required) :: A Bio::Feature object
|
88
|
+
# * _label_ :: Label for the feature. Default = 'anonymous'
|
89
|
+
# * _link_ :: URL to link to for this glyph. Default = nil
|
90
|
+
# * _glyph_ :: Glyph for the feature. Default = glyph of the track
|
91
|
+
# * _colour_ :: Colour for the feature. Default = colour of the track
|
92
|
+
# *Returns*:: Bio::Graphics::Feature object that was created or nil
|
93
|
+
def add_feature(feature_object, opts = {})
|
94
|
+
# Calculate the ultimate start and stop of the feature: the start
|
95
|
+
# of the first subfeature (e.g. exon) and the stop of the last one.
|
96
|
+
# The only reason we want to know these positions, is because we want
|
97
|
+
# to determine if the feature falls within the view of the image or
|
98
|
+
# not (see below).
|
99
|
+
start = feature_object.locations.collect{|l| l.from}.min.to_i
|
100
|
+
stop = feature_object.locations.collect{|l| l.to}.max.to_i
|
101
|
+
|
102
|
+
# If the feature wouldn't show because it's not in the region we're
|
103
|
+
# looking at, don't bother storing the stuff. I think this makes huge
|
104
|
+
# speed and memory differences if you've got a chromosome with
|
105
|
+
# thousands of features.
|
106
|
+
if stop <= self.panel.display_start or start >= self.panel.display_stop
|
107
|
+
return nil
|
108
|
+
else #elsif start >= panel.display_start and stop <= panel.display_stop
|
109
|
+
@features.push(Bio::Graphics::Feature.new(self, feature_object, opts))
|
110
|
+
return @features[-1]
|
111
|
+
end
|
112
|
+
|
113
|
+
return self
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
# Adds the track to a cairo drawing. This method should not be used
|
118
|
+
# directly by the user, but is called by Bio::Graphics::Panel.draw
|
119
|
+
# ---
|
120
|
+
# *Arguments*:
|
121
|
+
# * _panel__drawing_ (required) :: the panel cairo object
|
122
|
+
# *Returns*:: FIXME: I don't know
|
123
|
+
def draw(panel_destination)
|
124
|
+
track_context = Cairo::Context.new(panel_destination)
|
125
|
+
|
126
|
+
# Draw thin line above title
|
127
|
+
track_context.set_source_rgb(0.75,0.75,0.75)
|
128
|
+
track_context.move_to(0, self.vertical_offset)
|
129
|
+
track_context.line_to(self.panel.width, self.vertical_offset)
|
130
|
+
track_context.stroke
|
131
|
+
|
132
|
+
# Draw track title
|
133
|
+
track_context.set_source_rgb(0,0,0)
|
134
|
+
track_context.select_font_face(*(Bio::Graphics::FONT))
|
135
|
+
track_context.set_font_size(Bio::Graphics::TRACK_HEADER_HEIGHT)
|
136
|
+
track_context.move_to(0,Bio::Graphics::TRACK_HEADER_HEIGHT + self.vertical_offset + 10)
|
137
|
+
track_context.show_text(self.name)
|
138
|
+
|
139
|
+
# Draw the features
|
140
|
+
@features.sort_by{|f| f.start}.each do |feature|
|
141
|
+
# Don't even bother if the feature is not in the view
|
142
|
+
if feature.stop <= self.panel.display_start or feature.start >= self.panel.display_stop
|
143
|
+
next
|
144
|
+
else
|
145
|
+
feature.draw(panel_destination)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
@number_of_feature_rows = ( @grid.keys.length == 0 ) ? 1 : @grid.keys.max + 1
|
150
|
+
|
151
|
+
return panel_destination
|
152
|
+
end
|
153
|
+
|
154
|
+
end #Track
|
155
|
+
|