FW: feature export from aligned file

I am new Jalview user. I load my feature to my sequences by Jalview. Then I aligned them. How can I export my feature from aligned file. I mean I need to have new position of each animo acids in aligned file. Is it possible? If not, Please help me how can I do that with other software or programming language?

This isn’t something that is built in to Jalview, because we’ve never needed to do this for our own analyses. However, it is very easy to do with a bit of scripting.

If you open the Groovy console (from the tools menu), you can copy and paste in the following script into the window that opens:

// start script
for (aw in Jalview.getAlignframes())
println("Aligned positions for features in alignment "+aw.getTitle());

for (sq in aw.getViewport().getAlignment().getSequences())
for (sf in sq.getDatasetSequence().getSequenceFeatures())
println([sf.getType(),sf.getDescription(), sq.findIndex(sf.getBegin()), sq.findIndex(sf.getEnd())].join("\t")+"\n")
// end script

Then, hit the Run icon (or press control+R or CMD+R if you are on a mac) and the output panel will contain the aligned positions for all the alignment windows currently displayed in the Jalview desktop.

Is that what you were wanting to do ?


The University of Dundee is a registered Scottish Charity, No: SC015096


Hello Amir. I’ve cced this to the Jalview discussion list - since that’s where you’d normally discuss feature requests like this.

On 29/04/2014 17:08, Geoff Barton wrote:

Hello Amir.

Thank you so much for your help. Oh, Sorry, but I had sent my request
to 'jalview-discuss@jalview.org' but I got the following answer:

yes. you need to subscribe to post. An invite should now be in your

Your script is really nice but I have two problem with it. Is it
possible to modify this?

It's a script - so you can change it as you see fit !

1)I need to have something like that the script produces but I need
also to know name of each sequences before the features. Something
like the following pattern:

Name_of_seq1 feature_type1
feature_Description1 index_of_feature_in_aligned_file1

You can get the name of the sequence with 'getName()'. Change the print
statement to:

println([sq.getName(), sf.getType(),sf.getDescription(),
sq.findIndex(sf.getBegin()), sq.findIndex(sf.getEnd())].join("\t")+"\n")

2)It doesn’t allow me to see all the features, I think the output
panel has limitation in number of line (I have 64 sequences) and I can
just see last part of result.

Hmm - really ? I guess you'll need to write it to a file.

This is the quickest way of doing that:
1. add the following line to the top of the script:

def outfile = new File("file_to_write.tsv");

2. Change the println statement to outfile.writeLine :
outfile.writeLine( [sq.getName(), sf.getType(),sf.getDescription(),
sq.findIndex(sf.getBegin()), sq.findIndex(sf.getEnd())].join("\t"))

You can find out more about groovy scripting here:


The University of Dundee is a registered Scottish Charity, No: SC015096


On Wed Apr 30 09:08:02 2014, Amir Banaei Esfahani wrote: