Skip to main content

What DocumentType is "Restriction Enzyme Collection"?



  • Geneious Team

    Hi Matthew,

    The Restriction Enzyme Collection document type is defined by our bundled cloning plugin so isn't part of the Geneious public API. To get a reference to it, you can use the following code:


    public static DocumentType getDocumentTypeByName(String name) {
    for (GeneiousPlugin plugin : PluginUtilities.getActiveGeneiousPlugins()) {
    for (DocumentType documentType : plugin.getDocumentTypes()) {
    if (documentType.humanReadableName.equals(name))
    return documentType;
    return null;

    getDocumentTypeByName("Restriction Enzyme Collection");

    Best regards,


  • Matthew Shum

    Thanks, Matt!

    This answered my question.

  • Sean Johnson

    Is there a way to access the restriction enzyme names and recognition sites from within a custom plugin? Using the code posted, I can make an option that will allow the user to select the correct type of document:

    options.addDocumentSelectionOption("restrictionEnzymesDocument", "Restriction enzymes document", DocumentSelectionOption.FolderOrDocuments.EMPTY, restriction_enzyme_collection_doctype, fieldsToDisplay, false, Collections.emptyList());

    But I can't figure out how make the data in the document available to other functions and classes.

    It throws an exception when I add the following line:

    public List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] documents,
                ProgressListener progressListener, Options options) throws DocumentOperationException {
    ArrayList<AnnotatedPluginDocument> selectedEnzymesDocument = (ArrayList<AnnotatedPluginDocument>) ((DocumentSelectionOption) options.getValue("restrictionEnzymesDocument")).getDocuments();
  • Moreland Gibbs


    You will have to get the actual DocumentSelectionOption first before you can call getValue() or getDocuments() on it. So in your call, if you replace 'getValue' with 'getOption' it should work (depending on where in the options you added the documentSelectionOption. If you've added them to childOptions you'll have to prefix it correspondingly.)

    ArrayList<AnnotatedPluginDocument> selectedEnzymesDocument = (ArrayList<AnnotatedPluginDocument>) ((DocumentSelectionOption) options.getOption("restrictionEnzymesDocument")).getDocuments();

    Since EnzymeDocuments are not in the PublicAPI you will have to access information via xml.

    You can call something like this:

    ArrayList<PluginDocument> selectedEnzymesDocument = new ArrayList<>();
    for (PluginDocument enzymeDocument : selectedEnzymesDocument) {
    Element enzymesElement = enzymeDocument.toXML();
    String recognitionSequence = enzymesElement.getChild("enzymes").getChild("enzyme").getChildText("recognitionSequence");

    To get more info about the whole xml and which kind of elements are in there, you can convert it into a string and print it out using 

    String humanReadableXml = StringUtilities.formatElement(enzymesElement);



Please sign in to leave a comment.