Skip to main content

help with command line wrapper please



  • 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:

    new String[] { “sh”, “sed ‘s/CGTGACAATTCCAAAACACCCTGTACTTGCAGA/CGTGACAATTCCAAAAACACCCTGTACTTGCAGA/g’ old_file.fasta > new_file.fasta” }

    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.


  • Moreland Gibbs

    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,


  • Ben Kiefel

    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!



Please sign in to leave a comment.