allowing Jalview windows to be created by other Java programs

Andy. You need to download the latest development version of Jalview to get my changes. This is available from
http://WWW.Jalview.org/versions.html

J. B. Procter Jalview/enfin Barton group

···

-----Original Message-----
From: Andy Lai <andycw.lai@utoronto.ca>
To: Jalview Development List <jalview-dev@jalview.org>
Sent: Tue, 05 Jul 2011 23:05
Subject: Re: [Jalview-dev] allowing Jalview windows to be created by other Java programs

Thanks fo the reply.

ok - so in reality, what you want is to provide an interface that allows the user to select from a database of alignments, and load them into the Jalview desktop, which is no problem. Do you want the user to be able to save annotation or edits back to the database as well ?

No. I don’t think that functionality is needed

hmm. I think you have not configured your netbeans project correctly. Jalview’s build script uses a classes directory to compile and assemble all the resources, then - assuming you execute the makedist or makefulldist targets, it assembles all the necessary Jars in the ‘dist’ directory. The build/classes folder sounds like something that netbeans created - so you need to tweak the netbeans project configuration to ensure the build directory is the same as the one that Jalview’s build.xml script is using.

Having said the above - It turns out that doing it is a real pain in NetBeans - and in fact, the easiest way was to add in a custom netbeans build script to ensure the ‘buildindices’ target in jalview’s build.xml is called with NetBean’s build/classes folder as the class output folder (see http://issues.jalview.org/browse/JAL-848 for the commit history). Now, you should be able to open the latest copy of the jalview development source (either from the web site, or pulling from the git repository) as a properly configured project in NetBeans.

I downloaded the latest development source (2.6.1.) and it appears to give me the same results (I assume it includes the fixed build.xml from ticket JAL-848). Since my knowledge of ANT scripts is quite limited, it’d help if you can tell me what is expected in the dist folder and in the jar file.

I assume the dist folder should contain the lib folder and the jar. The jar, in turn, should contain resources and the properties file. So far, I don’t see any of this when I clean + build. You are right, though, that build/classes is a default NetBeans thing.

I am not very sure what else I can configure in NetBeans anyway… I did change the first line of build.xml from

to

.

Point taken - and I think it should be possible to set up any IDE to work with the Jalview source, since we all have our own preferred IDE. However, be warned - UI building tools like the one in NetBeans will probably fail to work correctly with many of Jalview’s classes, since a fair amount of Jalview’s UI is dynamic (ie certain menus and dialogs are created on the fly, rather than as static layouts).

Jim.

Yes, that’s fine. The part that uses NetBean’s UI builder is quite independent of JalView.

Andy

That should be what I’ve downloaded, since that’s exactly the page where I got version 2.6.1. (the newest build?).

To be clear, I grabbed this tarball: http://www.compbio.dundee.ac.uk/~ws-dev1/jalview/release/jalview-source.tar.gz

Thanks.

Andy

···

On Wed, Jul 6, 2011 at 2:43 AM, <jprocter@compbio.dundee.ac.uk> wrote:

Andy. You need to download the latest development version of Jalview to get my changes. This is available from
http://WWW.Jalview.org/versions.html

J. B. Procter Jalview/enfin Barton group

-----Original Message-----
From: Andy Lai <andycw.lai@utoronto.ca>
To: Jalview Development List <jalview-dev@jalview.org>
Sent: Tue, 05 Jul 2011 23:05
Subject: Re: [Jalview-dev] allowing Jalview windows to be created by other Java programs

Thanks fo the reply.

ok - so in reality, what you want is to provide an interface that allows the user to select from a database of alignments, and load them into the Jalview desktop, which is no problem. Do you want the user to be able to save annotation or edits back to the database as well ?

No. I don’t think that functionality is needed

hmm. I think you have not configured your netbeans project correctly. Jalview’s build script uses a classes directory to compile and assemble all the resources, then - assuming you execute the makedist or makefulldist targets, it assembles all the necessary Jars in the ‘dist’ directory. The build/classes folder sounds like something that netbeans created - so you need to tweak the netbeans project configuration to ensure the build directory is the same as the one that Jalview’s build.xml script is using.

Having said the above - It turns out that doing it is a real pain in NetBeans - and in fact, the easiest way was to add in a custom netbeans build script to ensure the ‘buildindices’ target in jalview’s build.xml is called with NetBean’s build/classes folder as the class output folder (see http://issues.jalview.org/browse/JAL-848 for the commit history). Now, you should be able to open the latest copy of the jalview development source (either from the web site, or pulling from the git repository) as a properly configured project in NetBeans.

I downloaded the latest development source (2.6.1.) and it appears to give me the same results (I assume it includes the fixed build.xml from ticket JAL-848). Since my knowledge of ANT scripts is quite limited, it’d help if you can tell me what is expected in the dist folder and in the jar file.

I assume the dist folder should contain the lib folder and the jar. The jar, in turn, should contain resources and the properties file. So far, I don’t see any of this when I clean + build. You are right, though, that build/classes is a default NetBeans thing.

I am not very sure what else I can configure in NetBeans anyway… I did change the first line of build.xml from

to

.

Point taken - and I think it should be possible to set up any IDE to work with the Jalview source, since we all have our own preferred IDE. However, be warned - UI building tools like the one in NetBeans will probably fail to work correctly with many of Jalview’s classes, since a fair amount of Jalview’s UI is dynamic (ie certain menus and dialogs are created on the fly, rather than as static layouts).

Jim.

Yes, that’s fine. The part that uses NetBean’s UI builder is quite independent of JalView.

Andy


Jalview-dev mailing list
Jalview-dev@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

I only made the changes in the development version of Jalview - which will become version 2.7 in a month or two… this is the one that you want:
http://www.compbio.dundee.ac.uk/~ws-dev1/jalview/latest/jalview-source.tar.gz

JIm

···

On 06/07/2011 19:07, Andy Lai wrote:

That should be what I’ve downloaded, since that’s exactly the page where I got version 2.6.1. (the newest build?).

To be clear, I grabbed this tarball: http://www.compbio.dundee.ac.uk/~ws-dev1/jalview/release/jalview-source.tar.gz

Hi Jim,

I'm sorry for the short notice but could we move today's skype meeting a
bit.
A friend of mine has his Phd defense about high-throughput data at 1pm
(Leipzig time) which I would like to attend.
I think the remaining time would be rather short for us to talk.

We could either talk later in the evening today or tomorrow morning,
maybe at 9 or 10 am (german time).

best
Jan

Hi Jan,

I will be away on the NextGenBug meeting tomorrow, later today may be fine.
However, do not worry about me, as long as you and Jim can make it, it is fine.

Regards,
Peter

···

On 11/07/2011 10:24, Jan Engelhardt wrote:

Hi Jim,

I'm sorry for the short notice but could we move today's skype meeting a
bit.
A friend of mine has his Phd defense about high-throughput data at 1pm
(Leipzig time) which I would like to attend.
I think the remaining time would be rather short for us to talk.

We could either talk later in the evening today or tomorrow morning,
maybe at 9 or 10 am (german time).

best
Jan
_______________________________________________
Jalview-dev mailing list
Jalview-dev@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

That's fine - Jan, thanks for letting us know.

I'm pretty busy today.. lets talk tomorrow morning. 10am German time should be perfect.

Jim.

···

On 11/07/2011 10:40, Peter Troshin wrote:

Hi Jan,

I will be away on the NextGenBug meeting tomorrow, later today may be fine.
However, do not worry about me, as long as you and Jim can make it, it
is fine.

Regards,
Peter

On 11/07/2011 10:24, Jan Engelhardt wrote:

Hi Jim,

I'm sorry for the short notice but could we move today's skype meeting a
bit.
A friend of mine has his Phd defense about high-throughput data at 1pm
(Leipzig time) which I would like to attend.
I think the remaining time would be rather short for us to talk.

We could either talk later in the evening today or tomorrow morning,
maybe at 9 or 10 am (german time).

best
Jan
_______________________________________________
Jalview-dev mailing list
Jalview-dev@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

_______________________________________________
Jalview-dev mailing list
Jalview-dev@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev

Hi Jim,

Sorry for flooding you with e-mails (and I didn’t realize I was replying to you instead of jalview-dev until now), but I think an alternative to changing access to variables is to modularize the feature-handling methods. I’ve been tracing some more code in appletgui.FeatureRenderer. It took me a little while to realize that a larger problem in this situation is that the whole “Create new Sequence Feature(s)” functionality is done in one large block of code.

If GUI part of the process (i.e. launching the JVDialog) and the downstream processes (i.e. creating the features) are partitioned into separate functions, then it can potentially make direct manipulation of features easier.

Or perhaps I am approaching this whole thing incorrectly. In which case, I’d welcome any suggestion from you. (Again, I simply wanted to do a bunch of automatic regex searches and then turn them into features).

Andy

···

On Tue, Jul 12, 2011 at 5:11 PM, Andy Lai <andycw.lai@utoronto.ca> wrote:

To be more precise, there should at least be accessor functions for variables in FeatureRenderer and AlignmentPanel since there is currently no way to read or modify them from the outside or through inheritance.

On Tue, Jul 12, 2011 at 4:20 PM, Andy Lai <andycw.lai@utoronto.ca> wrote:

Hi Jim,

I’ve made some progress in whatever I was doing with JalView (i.e. loading JalView in my JVM and pipping my program’s output to JalView’s input to create alignments). Right now, I am working on features (i.e. I want to highlight regex matches in various different colours). It appears to me that there isn’t a very specific object called “Feature” that stores all the necessary information of a feature (probably for very practical reasons). So, I decided to call the functions for “Find All” and “Create New Feature”. One obstacle I encountered is that a lot of the variables in AlignmentPanel and AlignFrame have very restricted access privileges and absolutely no accessor functions.

It’d probably be nice if accessors are implemented for important instance variables like AlignmentPanel.idPanel so that it’d be easier for JalView users like us to manipulate the JalView processes without having to change its source code. Also, giving “protected” access to variables would also open up the possibility for Jalview classes/functions to be inherited or overridden (i.e. someone may want to change the AlignFrame’s behaviour for some purpose).

Andy

On Wed, Jul 6, 2011 at 5:47 PM, Andy Lai <andycw.lai@utoronto.ca> wrote:

Thanks. That appears to have worked quite well.

Andy

On Wed, Jul 6, 2011 at 4:04 PM, Jim Procter <jprocter@compbio.dundee.ac.uk> wrote:

On 06/07/2011 19:07, Andy Lai wrote:

That should be what I’ve downloaded, since that’s exactly the page where I got version 2.6.1. (the newest build?).

To be clear, I grabbed this tarball: http://www.compbio.dundee.ac.uk/~ws-dev1/jalview/release/jalview-source.tar.gz

I only made the changes in the development version of Jalview - which will become version 2.7 in a month or two… this is the one that you want:
http://www.compbio.dundee.ac.uk/~ws-dev1/jalview/latest/jalview-source.tar.gz

JIm

Hi Andy.

Your points are well taken. Jalview’s GUI classes are most certainly not set up for manipulation by third-party packages - which is why we’d like to infer a public API which will eventually form part of a modular-Jalview interface in Jalview v3.0. As for the current 2.7 code, you’ll have to patch it where necessary in order to achieve what you want.

For that reason, I strongly suggest you keep your Jalview code up to date by regularly pulling updates from our git repository at http://source.jalview.org/git/jalview.git (note - this is a public read only repository, you should be able to merge in your local changes, and then at the first instance, send a patch to me if you want to contribute your modifications).

To be more precise, there should at least be accessor functions for variables in FeatureRenderer and AlignmentPanel since there is currently no way to read or modify them from the outside or through inheritance.

Yes. There probably should - but the way that FeatureRender and AlignmentPanel interact is really tricky, and difficult to debug - so the publicly accessible methods are intentionally limited, otherwise ‘Bad Things’ may happen. However, from what you said before, it’s probable that there is already a public method on the applet that will do what you want - I should just be able to ensure a similar method is provided by the application’s implementation. I’ll come back to this below.

Right now, I am working on features (i.e. I want to highlight regex matches in various different colours). It appears to me that there isn’t a very specific object called “Feature” that stores all the necessary information of a feature (probably for very practical reasons).

Hmm. jalview.datamodel.SequenceFeature represents features on a jalview.datamodel.SequenceI object. If you want to add features to a sequence in an alignment, you should do:
{AlignmentI}.getSequenceAt(index of sequence).getDatasetSequence().addFeature(…);

So, I decided to call the functions for “Find All” and “Create New Feature”. One obstacle I encountered is that a lot of the variables in AlignmentPanel and AlignFrame have very restricted access privileges and absolutely no accessor functions.

It’d probably be nice if accessors are implemented for important instance variables like AlignmentPanel.idPanel so that it’d be easier for JalView users like us to manipulate the JalView processes without having to change its source code. Also, giving “protected” access to variables would also open up the possibility for Jalview classes/functions to be inherited or overridden (i.e. someone may want to change the AlignFrame’s behaviour for some purpose).

yes. true - and generally regarding protected variables - it doesn’t hurt to move some class fields from private to proctected, but generally I’m trying to avoid Russian Doll inheritance patterns wherever possible, since it is not compatible with the plugin architecture we plan to adopt in the future.

More importantly, I’m a little bit scared if you need to get at the idpanel instance for a view, and am now quite confused as to what you actually aim to achieve with your integration…

Are you trying to dynamically create and highlight sequence features on an alignment displayed in a Jalview window in response to user interface events in your own code ?

The reason I ask is that I originally thought that all you wanted was a ‘one shot’ - open a new Jalview window with a dataset (alignment+ features (possibly defined by regexes) + annotation (which allows sequences to be grouped and their ID colour set)). This could be achieved with very little messing around with Jalview’s internals - the only tricky thing being that the regex-based feature definition code is currently buried inside the Jalview gui’s Find dialog box implementation, but could be easily refactored as a public method on an analysis class.

I’m willing to provide you with precise advice about how to do this. Would you be willing to let me take a look at your code and suggest the best way of achieving what you need ?

Jim.