3 followers Follow

help with command line wrapper please

Hi Guys,

I am trying. to make a simple wrapper plugin using the command line program 'sed'. Basically I am trying to do a simple search and replace on sequences.

My question is how, in the Step 2 window, do I define the file Geneious will be supplying to the program?

From the command line I would enter:


I need to know what Geneious will be calling new_file.fasta

I hope this is clear!


Ben Kiefel

Official comment


Hi Ben,

There are a few options.

The first one is to use the “-i extension” option for sed and to edit the file in-place. Then you can just read back from the same file that you use for old_file.fasta and it will contain the modified sequence.

The second option is to execute a shell so that you can use redirects rather than executing sed directly. For example:


Another option is to implement com.biomatters.geneious.publicapi.utilities.Execution.OutputListener and to capture the standard output as a String. Then provide this OutputListener when creating a new com.biomatters.geneious.publicapi.utilities.Execution.

The last option, which is more complicated, is to use the ProcessBuilder directly and to call the redirectOutput method. You would need to handle all the edge cases yourself which com.biomatters.geneious.publicapi.utilities.Execution already does for you.

If you only intend to do search and replace in this way then it is much easier to just use the built in String.replaceAll (or one of the other variants).

Hopefully one of these works for you.


Comment actions Permalink

Please sign in to leave a comment.



Hi Ben,

I see Jason replied to you with advice specifically for the Geneious JAVA API, not for the wrapper plugin.

I have taken a quick look at using SED with the Geneious Wrapper plugin tool and got it to work.

Key thing to note:

* Don't wrap the search/replace phrase with quotes as these are incorrectly  interpreted by the wrapper shell.

To follow are screenshots of the settings used.

Step 1. Make Plugin Type General Operation. "Choose" the sed executable.

Step 2. Use the settings shown below.

Step 3. Add a single option for the full sed phrase (without quotes)

I have added a command line switch (which is required) but set to ignore the Name-value separator so that the switch is not used.


Kind regards,


Moreland Gibbs 0 votes
Comment actions Permalink

Hi Moreland,


Thanks for the detailed instructions – works exactly as described!

A note in case someone else needs a similar outcome in the future. As I wanted to find a specific sequence (let's call it AAAAA) and always replace it with another (CCCCC), I changed the command line on the settings page to the following: 

I then removed the user input options at Step 3 and the plugin automatically searches for AAAAA and replaces with CCCCC!


Ben Kiefel 0 votes
Comment actions Permalink