--- /dev/null
+"""How many times does a large mussa analysis redraw the same line.
+"""
+import mussa
+m = mussa.Mussa()
+#m.load_mupa("examples/mck3test.mupa")
+#m.analyze(0, 0, mussa.analysis_modes.TransitiveNway, 0)
+m.load("../mussa_analyses/land/myogenin_w30_t21")
+path = m.paths()
+
+count = 0
+tracks = {}
+for rp in path.refinedPathz:
+ t0_id = rp.track_indexes[0]
+ t1_id = rp.track_indexes[1]
+ tid = (t0_id, t1_id)
+ tracks[tid] = tracks.setdefault(tid, 0) + 1
+ count += 1
+
+print "count", count
+print "tracks", len(tracks.keys())
--- /dev/null
+"""Can we show a mussa gl object?
+"""
+from OpenGL.GLUT import *
+from OpenGL.GL import *
+import mussa
+
+def main():
+ seq = mussa.Sequence()
+ s = "AAGGCCTTAAGGCCTT"
+ seq = mussa.Sequence(s)
+ assert s == seq.size() == len(seq)
+ glseq = mussa.GlSequence(seq)
+
+ glutInit(sys.argv)
+
+
+if __name__ == "__main__":
+ main()
--- /dev/null
+#include <boost/python.hpp>
+using namespace boost::python;
+
+#include "alg/glsequence.h"
+#include "alg/sequence.hh"
+
+void export_glsequence()
+{
+ class_<GlSequence>("GlSequence", init<Sequence &>())
+ .def(init<GlSequence &>())
+ .def("draw", &GlSequence::draw)
+ .def("sequence", &GlSequence::sequence,
+ return_internal_reference<>())
+ .add_property("x", &GlSequence::x, &GlSequence::setX)
+ .add_property("y", &GlSequence::y, &GlSequence::setY)
+ .add_property("width", &GlSequence::width, &GlSequence::setWidth)
+ ;
+}
#include <boost/python.hpp>
using namespace boost::python;
+void export_conserved_path();
+void export_glsequence();
void export_mussa();
void export_nway_paths();
-void export_conserved_path();
+void export_sequence();
BOOST_PYTHON_MODULE(mussa)
{
+ export_conserved_path();
+ export_glsequence();
export_mussa();
export_nway_paths();
- export_conserved_path();
+ export_sequence();
}
SOURCES.cxx := module.cxx \
conserved_path.cxx \
+ glsequence.cxx \
mussa.cxx \
- nway_paths.cxx
-
+ nway_paths.cxx \
+ sequence.cxx
MUSSA_PY_SRC := $(addprefix $(CURDIR), $(SOURCES.cxx))
MUSSA_PY_OBJ := $(MUSSA_PY_SRC:.cxx=$(OBJEXT))
MUSSAPY := $(BASEDIR)/mussa.so
TARGETBINS += $(MUSSAPY)
-$(MUSSAPY): $(MUSSA_PY_OBJ) $(MUSSA_ALG_OBJ)
- g++ -shared $(CXXFLAGS) -lpython2.3 -lboost_python -o $@ $^
+$(MUSSAPY): $(MUSSA_PY_OBJ) $(MUSSA_ALG_OBJ) $(MUSSA_ALG_GL_OBJ)
+ g++ -shared $(CXXFLAGS) -lGL -lpython2.3 -lboost_python -o $@ $^
--- /dev/null
+#include <boost/python.hpp>
+using namespace boost::python;
+
+#include <string>
+#include "alg/glsequence.h"
+
+void export_sequence()
+{
+ class_<Sequence>("Sequence")
+ .def(init<std::string>())
+ //.add_property("seq", &Sequence::get_seq, &Sequence::set_seq)
+ .def("size", &Sequence::size)
+ .def("__len__", &Sequence::size)
+ //.add_property("header", &Sequence::get_header)
+ ;
+}
#include <QRect>
#include <QString>
#include <iostream>
+#include <set>
#include <GL/gl.h>
#include <math.h>
zoom(0),
maxOrtho2d(-50.0, -50, 3000000.0, 300.0),
curOrtho2d(maxOrtho2d),
- highlightMode(false),
+ selectedMode(false),
rubberBand(0),
drawingBand(false)
{
mussaesque();
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
- if (highlightMode && !drawingBand) {
+ if (selectedMode && !drawingBand) {
glColor4f(0.4, 0.4, 0.4, 0.9);
glRectf(previousBand.x(), previousBand.y(),
previousBand.right(), previousBand.bottom());
+ cout << "x: " << previousBand.x() << " r:" << previousBand.right() << endl;
}
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
GLuint objtype;
GLuint objid;
- highlightPaths.clear();
- highlightPaths.reserve(pathz_count);
- highlightPaths.insert(highlightPaths.begin(), pathz_count, false);
+ selectedPaths.clear();
+ selectedPaths.reserve(pathz_count);
+ selectedPaths.insert(selectedPaths.begin(), pathz_count, false);
+ selectedTrack = 0x7fffffff;
std::cout << "hits = " << hits << " " << pathz_count << std::endl;
ptr = (GLuint *) buffer;
+ if (hits > 0)
+ selectedMode = true;
for (GLuint i=0; i < hits; ++i)
{
if ((i + 5) > bufsize) {
z2 = ((float)*ptr++)/0x7fffffff;
objtype = *ptr++;
objid = *ptr++;
- //std::cout << " z1 is " << z1 << std::endl
- // << " z2 is " << z2 << std::endl;
if (names != 2) {
std::clog << "wrong number of glNames, selection is having trouble ";
std::clog << " got " << names << std::endl;
std::clog << endl;
return;
}
- if (objtype == MussaPaths) {
- highlightPaths[objid] = true;
- // not sure i like this, but it means we'll only highlight if a
- // selection was made
- highlightMode = true;
+ switch (objtype) {
+ case MussaPaths:
+ selectedPaths[objid] = true;
+ break;
+ case MussaTracks:
+ if (objid < selectedTrack) {
+ selectedTrack = objid;
+ }
+ break;
}
-
- //std::clog << ((objtype == MussaTracks) ? " track: " : " path: ")
- // << objid
- // << std::endl;
}
}
}
drawingBand = true;
std::cout << "x=" << e->x() << " y=" << e->y() << std::endl;
- highlightMode = false;
+ selectedMode = false;
bandOrigin = e->pos();
if (!rubberBand)
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
// the following boolean implements logical xor
if ( (reversed || prevReversed) && (!reversed || !prevReversed)) {
// we have a different orientation
- if (not highlightMode or highlightPaths[objid] == true) {
+ if (not selectedMode or selectedPaths[objid] == true) {
// if we have nothing selected, or we're the highlight, be bright
glColor3f(0.0, 0.0, 1.0);
} else {
}
} else {
// both current and previous path have the same orientation
- if (not highlightMode or highlightPaths[objid] == true) {
+ if (not selectedMode or selectedPaths[objid] == true) {
glColor3f(1.0, 0.0, 0.2);
} else {
glColor3f(1.0, 0.5, 0.5);
int zoom;
QRectF maxOrtho2d;
QRectF curOrtho2d;
- bool highlightMode;
- std::vector<bool> highlightPaths;
+ // true if we have a selection
+ bool selectedMode;
+ // indicate which paths are selected
+ std::vector<bool> selectedPaths;
+ // which track is selected (it only makes sense to have one track selected).
+ unsigned int selectedTrack;
void initializeGL();
void resizeGL(int width, int height);