This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merge Two Sequences With Biojava3?

I want to merge DNASequence together , Is there any quick way to do this? Currently I have to get DNA sequences to Strings, concatenate them, then construct a new DNASequence from the newly concatenated strings.

e.g

DNASequence result = new DNASequence("ACGT");
result = new DNASequence(result.getSequenceAsString() + otherSequence.getSequenceAsString());

This does not look very nice and probably not the best performance either.

biojava java

2 answers

this is the fastest way

String s3 = s1.concat(s2);

or you can use

StringBuffer.append(s2)  [Java String buffer][1]

To be honest with you that looks as good as Java gets.

Log in to answer this question.