Help needed - Groovy scripts stopped working

Dear Jalview Staff

A couple of years ago, one of your colleagues, Mungo helped me out by writing a couple of groovy scripts. However, for some reason, they don’t seem to work on the latest version of Jalview (2.11.1.4). My old computer has Jalview 2.11.0 on it and the scripts still work on there. Unfortunately, I cant get my hands on 2.11.0 anywhere. Moreover, it will be better to keep running the latest versions.

I was hoping that you will be able to diagnose the problem and help me out again. I can use the script as directed by you but am completely hopeless in diagnosing any problem. The error message shown on my computer is below. I am happy to share the scripts and the alignment file if needed.

Thanks again for your kind help.

Best wishes

Manoj

ERROR MESSAGE IN GROOVY CONSOLE:

import jalview.util.ColorUtils

import jalview.datamodel.SequenceFeature

import jalview.schemes.FeatureColour

import jalview.analysis.Finder

def af = jalview.bin.Jalview.currentAlignFrame

def av = af.viewport

def fr = af.featureRenderer

def finder = new Finder(av)

new File(“D:/MUD/MK_Databases/Arabidopsis_Proteome/Jalview_Mapping/0_Peps/AcylPeps_CESA2.txt”).eachLine

{

line →

if (!line.startsWith(‘#’))

{

tokens = line.split(“\t”)

motif = tokens[0]

featureName = tokens[1]

featureColour = ColorUtils.parseColourString(tokens[2])

featureScore = (tokens.length < 4 ? 0 : Float.parseFloat(tokens[3]))

fr.setColour(featureName, new FeatureColour(featureColour))

finder.findAll(motif, false, false)

matches = finder.searchResults.results

matches.each

{

sf = new SequenceFeature(featureName, motif, it.start, it.end, featureScore, null)

it.sequence.addSequenceFeature(sf)

}

}

}

av.setShowSequenceFeatures(true)

af.alignPanel.paintAlignment(false, false)

Exception thrown

groovy.lang.MissingMethodException: No signature of method: jalview.analysis.Finder.findAll() is applicable for argument types: (java.lang.String, java.lang.Boolean, java.lang.Boolean) values: [C, false, false]

Possible solutions: findAll(), findAll(java.lang.String, boolean, boolean, boolean), findAll(groovy.lang.Closure), find(), findNext(java.lang.String, boolean, boolean, boolean)

at PeptidePainter$_run_closure1.doCall(PeptidePainter.groovy:22)

at PeptidePainter.run(PeptidePainter.groovy:11)

@ben_soares ? I think @manoj_kumar 's script just needs an additional false in the findAll call, but best check :slight_smile:

Hi Manoj,

Jim is right, it just needs an extra false added to the findAll method, which has had an extra “ignoreHidden” flag added to it since 2.11.0.

So here’s the very slightly edited script, which will hopefully Just Work now – please let us know!
I’ve added it as an attachment too.

Ben

import jalview.util.ColorUtils
import jalview.datamodel.SequenceFeature
import jalview.schemes.FeatureColour
import jalview.analysis.Finder
def af = jalview.bin.Jalview.currentAlignFrame
def av = af.viewport
def fr = af.featureRenderer
def finder = new Finder(av)
new File("D:/MUD/MK_Databases/Arabidopsis_Proteome/Jalview_Mapping/0_Peps/AcylPeps_CESA2.txt").eachLine
{
  line ->
   if (!line.startsWith('#'))
   {
    tokens = line.split("\\t")
    motif = tokens[0]
    featureName = tokens[1]
    featureColour = ColorUtils.parseColourString(tokens[2])
    featureScore = (tokens.length < 4 ? 0 : Float.parseFloat(tokens[3]))
    fr.setColour(featureName, new FeatureColour(featureColour))
    finder.findAll(motif, false, false, false)
    matches = finder.searchResults.results
    matches.each
    {
        sf = new SequenceFeature(featureName, motif, it.start, it.end, featureScore, null)
        it.sequence.addSequenceFeature(sf)
    }
  }
}
av.setShowSequenceFeatures(true)
af.alignPanel.paintAlignment(false, false)

groovyMotifs_edited.txt (1.0 KB)