1 follower Follow

Generating documents containing sequences with gaps

We want to generate a new document using sequences with gaps create based on an alignment. We select first a nucleotide alignment,

We are using the backTranslationPlugin as an example.

It seems that
DocumentUtilities.createAnnotatedPluginDocuments does not accept sequences contained in the alignment directly. If we try to create new Sequences by using the strings we also run into exceptions.

The basic code below exemplifies the problem:

public List<AnnotatedPluginDocument> performOperation(AnnotatedPluginDocument[] documents, ProgressListener progressListener, Options options) throws DocumentOperationException {

// Our selection signature guarantees we have just one AminoAcidSequenceDocument here.
PluginDocument document = documents[0].getDocument();

List<PluginDocument> sequenceDocuments = new ArrayList<>();

sequenceDocuments.add(((SequenceAlignmentDocument) document).getSequence(0)); // FIRST problem line
NucleotideSequenceDocument dnaSequenceDocument = new DefaultNucleotideSequence(
" A slice",
"some description",
"AT-C", new Date());
return DocumentUtilities.createAnnotatedPluginDocuments(sequenceDocuments); // At this point due to FIRST problem line I get a

//When executing DocumentUtilities.createAnnotatedPluginDocuments(sequenceDocuments) it generates 21:55:50.150 WARNING: Exception: java.lang.RuntimeException: Class com.biomatters.geneious.publicapi.implementations.NucleotideAlignmentSequence must have a public empty constructor. due to First problem line.
// if First problem line is commented out it generates sequence is not valid when executing DocumentUtilities.createAnnotatedPluginDocuments(sequenceDocuments). Fails in fails AnnotadedPluginDocument.confirmDocumentValid

Is there any way to achieve this?

Thank you

Please sign in to leave a comment.

1 comment


Geneious cannot store standalone sequences containing gaps as gaps. You have to call


first. This will still return a sequence that can be saved stand-alone.

Richard Moir 0 votes
Comment actions Permalink