Left-justifying sequence region

Hello,

Is there a way in Jalview to select some columns and then left-justify all the sequences in those columns, while leaving the rest of the alignment that follows the selected region alone?

For example, I am aligning antibody sequences with different length CDRs. I’d like to select the whole CDR region, left justify all the sequences and then remove empty columns. I don’t need to align the CDR loop sequences of different lengths to each other.

Thanks,

Roland

···

Roland Dunbrack (he/his/him/him)
Institute for Cancer Research
Fox Chase Cancer Center
Philadelphia PA 19111
http://dunbrack.fccc.edu
http://dunbrack.org

Hi Roland,

Is there a way in Jalview to select some columns and then left-justify all the sequences in those columns, while leaving the rest of the alignment that follows the selected region alone?

I started implementing functionality for this some years ago - you've just given me a reason to finish it !

I've created a groovy script that you can download and run on a selected region via Jalview's groovy console:
1. Download the script here:

https://source.jalview.org/crucible/browse/~raw,r=cfba86992cd64bb0df6105bbf5dfc076ba8a93b2/jalview/examples/groovy/justifyRegionQuick.groovy

2. Open Jalview's Groovy Console (Tools->Groovy Console)
3. Load the script into the groovy console (second icon on the left of the toolbar)
4. In Jalview, select the region you want to Left Justify
5. Cross your fingers for luck and execute the script via the Calculate menu's 'Run Groovy Script' option.

If all goes well, you can undo/redo the left-justify in the normal way.

I'll also be keeping my limbs crossed in the hope this quick and dirty script works for you ! (I tested on Jalview 2.11.1, it may not work on earlier versions).

Have a great weekend,
Jim.

···

On 28/05/2020 18:07, Roland Dunbrack wrote:

--
-------------------------------------------------------------------
Dr JB Procter, Jalview Coordinator, The Barton Group
Division of Computational Biology, School of Life Sciences
University of Dundee, Dundee DD1 5EH, UK.
+44 1382 388734 | www.jalview.org | www.compbio.dundee.ac.uk

That worked perfectly!!

We used Jalview a lot to manually edit an alignment of 497 human protein kinase domains so that unaligned insertion-deletion regions were left-justified and switched to lower case. The script will make that easier for future projects.

https://www.nature.com/articles/s41598-019-56499-4

I think it would be a cool tool to be able to left- and right-justify selected columns. I’ll try to modify the script to see if it can also right-justify sequences. For instance, for CDR H3, I want about half the residues of each CDR left-justified and half right-justified because there are similar residues at the start and end of the loops with varying numbers of not well-conserved residues in between them.

Thanks,
Roland

Thanks,
Roland

···

Roland Dunbrack (he/his/him/him)
Institute for Cancer Research
Fox Chase Cancer Center
Philadelphia PA 19111
http://dunbrack.fccc.edu
http://dunbrack.org

The script has a flag for left justify that you just set to false. We should also be able to add an option to the edit menu in the next patch release of 2.11.1!

Your left/right justify example sounds like it could be accomplished by running a local alignment on that region … if you hide all columns except that region and run one of the alignment services jalview will preserve the hidden regions in the result. Some judicious customisation of gap parameters would be needed, however… so maybe it’s easier to script this.

Jim.

···

On Sat, 30 May 2020, 03:27 Roland Dunbrack, <roland.dunbrack@gmail.com> wrote:

That worked perfectly!!

We used Jalview a lot to manually edit an alignment of 497 human protein kinase domains so that unaligned insertion-deletion regions were left-justified and switched to lower case. The script will make that easier for future projects.

https://www.nature.com/articles/s41598-019-56499-4

I think it would be a cool tool to be able to left- and right-justify selected columns. I’ll try to modify the script to see if it can also right-justify sequences. For instance, for CDR H3, I want about half the residues of each CDR left-justified and half right-justified because there are similar residues at the start and end of the loops with varying numbers of not well-conserved residues in between them.

Thanks,
Roland

Thanks,
Roland


Roland Dunbrack (he/his/him/him)
Institute for Cancer Research
Fox Chase Cancer Center
Philadelphia PA 19111
http://dunbrack.fccc.edu
http://dunbrack.org

On Fri, May 29, 2020 at 1:33 PM Jim Procter <jprocter@compbio.dundee.ac.uk> wrote:

Hi Roland,

On 28/05/2020 18:07, Roland Dunbrack wrote:

Is there a way in Jalview to select some columns and then left-justify
all the sequences in those columns, while leaving the rest of the
alignment that follows the selected region alone?
I started implementing functionality for this some years ago - you’ve
just given me a reason to finish it !

I’ve created a groovy script that you can download and run on a selected
region via Jalview’s groovy console:

  1. Download the script here:

https://source.jalview.org/crucible/browse/~raw,r=cfba86992cd64bb0df6105bbf5dfc076ba8a93b2/jalview/examples/groovy/justifyRegionQuick.groovy

  1. Open Jalview’s Groovy Console (Tools->Groovy Console)
  2. Load the script into the groovy console (second icon on the left of
    the toolbar)
  3. In Jalview, select the region you want to Left Justify
  4. Cross your fingers for luck and execute the script via the Calculate
    menu’s ‘Run Groovy Script’ option.

If all goes well, you can undo/redo the left-justify in the normal way.

I’ll also be keeping my limbs crossed in the hope this quick and dirty
script works for you ! (I tested on Jalview 2.11.1, it may not work on
earlier versions).

Have a great weekend,
Jim.


Dr JB Procter, Jalview Coordinator, The Barton Group
Division of Computational Biology, School of Life Sciences
University of Dundee, Dundee DD1 5EH, UK.
+44 1382 388734 | www.jalview.org | www.compbio.dundee.ac.uk


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