Thursday, July 8, 2010

QActionGroup and exclusive menu actions

Today I was working on exclusive menu action selection in PyQt4 and got stuck. After some struggling, I managed to find it out. Now I want to share it with you.

What is exclusive menu action? It's a menu item, when you select it, its friends are deselected. When one of its friends is selected, it gets deselected. It's like a radio button group in a menu.

We're going to use QMenu, QAction and QActionGroup for this purpose.
# assume we are in a QMainWindow method, constructing the menu.

menu = QMenu('Alignment', self.menuBar())
menuGroup = QActionGroup(menu)
menuGroup.setExclusive(True)

left = QAction('left', menuGroup)
center = QAction('center', menuGroup)
right = QAction('right', menuGroup)

actions = (left, center, right)
map(menu.addAction, actions)
map(lambda action: action.setCheckable(True), actions)

center.setChecked(True)
self.menuBar().addMenu(menu)


In this way, you are able to select either left or center or right for alignment submenu.

Tuesday, June 29, 2010

QGraphicsItem.itemChange event and ItemPositionChange in Qt 4.6

Recently, I had a bug in Robinviz that I could not figure out where it come from. I was drawing a graph and nodes could be moved. Whenever I moved the node, edges connected to it used to come with it to the new position. But after upgrading to Qt 4.6, I saw that edges were not moving.

After some investigation, I realized that QGraphicsItem.itemChange event did not produce QGraphicsItem.ItemPositionChange but only selected, deselected signals. Googling for it, I hardly found that the problem was with the update. Due to performance reasons, Qt developers decided to stop emitting geometrical signals and wanted us to switch it on by supplying a flag for the QGraphicsItem:


try:
# available only in Qt 4.6
self.setFlag( QGraphicsItem.ItemSendsGeometryChanges)
except:
# no need to do this in Qt 4.5
pass

You can do this flag option in your constructor. I used try/except because I didn't know what might happen in 4.5 as there was no flag called ItemSendsGeometryChanges. In some other websites, following flag was suggested but it did not work for me:

self.setFlag(QGraphicsItem.ItemSendsScenePositionChanges, True)


For those who might be interested how I used itemChanged, I'll provide a portion of my code:

def itemChange(self, change, value):
if change == QGraphicsItem.ItemPositionChange:
self.updateEdges()

return QVariant(value)

Saturday, May 29, 2010

Spring term finished

The spring term has finished. Courses were pretty time-consuming this semester so I could not focus o n our research as I did last semester. Grades are not available yet but I expect them to be satisfying. I've taken Data Mining, Analysis and Design of Algorithms, Software Engineering courses.

In the data mining project, I worked on Yeast localization of proteins database and did classification&clustering analysis.

In the Software Engineering project, as I told before, I've developed a bus-timetable program JIstanbul which has both mobile and desktop versions with J2SE+Swing and J2ME. My project was selected as the best in the class. Currently, in the mobile version, the program can detect the day and fetch the timetable for that day. In the future, I'm planning to add storing time information, closest bus time, frequently used buses features.

Now I have 1 course and masters-thesis left for the next year. I'll be focusing on Robinviz in these summer days.

Sunday, April 4, 2010

RobinViz Paper and School Projects

After releasing RobinViz, I focused on my school projects. I've written a Turkish Flag drawer, Conway's Game of Life and Julia Set Fractals drawer in Java and presented the latter one in the Software Engineering class.

Currently I'm developing an Optimal Binary Search Tree implementation in Python as part of my Algorithms class. I've registered for a github account and I put all my codes there.
On the other hand, I'm working on some edge bundling stuff nowadays as part of my academic work. It's really nice but complicated. I hope I can come by a good solution to our problems in our mind.

I think I'll be fixing some problems of Robinviz in the following months. Our published paper (An integrated model for visualizing biclusters from gene expression data and PPI networks) can be found here.

As part of my Software Engineering project, I'm planning to develop a J2ME application to fetch bus timetables from the Internet and display the closest bus times for you to find the best route without waiting your bus.

Thursday, February 18, 2010

RobinViz Beta released

Things are going well and I've finished my first semester of my Masters. All of my grades are great and I'm just starting the second semester. On the other hand, I'm working on our project. When I joined the project in September 2009, one last step was missing. That was the Horizontal Coordinate Assignment Problem in Layered Graph Drawings. I've implemented Fast and Simple Horizontal Coordinate Assignment paper of Brandes et. al and we submitted our paper to International Symposium in Biocomputing (ISB 2010) in Calicut, India. Our paper was accepted and after that we decided to improve the GUI of our implementation. We developed a brand new GUI with PyQt4 and used the C++ code behind the scene to do the most of the scientific calculations. We published this novel software, RobinViz Beta version on http://code.google.com/p/robinviz.

With RobinViz, you can visualize PPI Networks and Gene Ontology as biclustered graphs. In these graphs, reliability of interactions are expressed with the thickness of the edges, h-value of the biclusters are expressed as node width etc. So the most important part of the data comes in front. I hope it shall be useful for all the scientists working on this subject.

This semester I'll be taking Algorithms, Data Mining and Advanced Java courses. I hope I'll learn a lot from them. By the way, while our professor presented our paper at the conference, I gave Introduction to Java tutorial lectures in his classes. That was also a nice experience.

Tuesday, January 5, 2010

Avatar 3D

After a long time, I went to cinema, to the film Avatar. I was not sure wheter to see this film but I wanted to taste a 3D movie so this could be a good candidate for my first 3D film.

The film was more than I expected, but not the 3D effects. It had both sorrow and thrill. For the ones who was not seen it, I won't spoil it but here's a summary.

It's the year 2154 and humans want to mine a valueable mineral on the Planet Pandora. But this mineral lies under a great tree, in which all the Pandora folk lives. So humans want Pandorians to leave their homes but of course, Pandorians won't do it. So a war begins and one human, who controls a mind-controlled avatar (Pandorian body) for diplomatic purposes, sees the fact that this is not fair and lines up on the Pandorians side. Going further, he becomes the commander of them by achieving the rank "Toruk Macto".

I felt so ashamed of being a human while watching this film. How cruel these humans are!

Sunday, December 27, 2009

Research Assistantship

Again, it's been a long time since I wrote last time. Things went unexpectedly and I've found myself in a position nowhere near I imagined.

I said that I applied Boğaziçi University for masters but although all of my qualifications were well above most of the applicants, I got rejected because that I did not bring a reference letter from my thesis advisor. Well, I went to him and he was off the office so I took the letters from my other professors. I thought these letters would be enough as they even admit students with 2,77 / 4.00 GPA! So reference letter should not have been a major issue. But it seems like it was.

Meanwhile, I had some job interviews but could not find an appropriate position according to my taste :)

Then my ex-professor who transferred to Kadir Has University from Işık University (where my BSc is from) offered me a position in his funded project. I was going to do my masters in Kadir Has University and get paid for working on the project. I accepted and started working. We are working on Graph Drawing and Visualization of Bioinformatics Networks. I'm using Pardus Linux and Python for my implementation works and I'm really happy about that. Thanks to my advisor who lets me be free on choosing my tools.

Our team consists of 3 members: me, my professor Cesim Erten and my ex-school-mate Melih Sözdinler. After I joined the team, I've done the unfinished part of their work and we submitted it to a conference and it got accepted. I'm really happy about that. I'll write about the paper when it's officially published (in February 2010).

My new university is pretty infant compared to my ex but I like it. At least everybody seems to be much more friendly. The biggest problem for me is that it takes 2-3 hours to get there and that much to come back home via public transport although we are in the same city. So I'm going to school on limited days.

Fall term is about to finish. I've taken Parallel Programming from Computer Engineering (my) department and Operating Systems, System Programming courses from IT department. They are mostly homework and presentation based. I've done my presentation on Parallel Sorting algorithms last Friday and it was good.

So, I'm a unofficial research assistant from now on. Great!