public static class ImmutableSequence.Builder extends Object
addName(String) should be called for each name. On the 2nd pass, sequences can
be created using createNucleotideSequence(String, CharSequence) or createNucleotideGraphSequence(String, CharSequence, NucleotideGraph)
or createNucleotideGraphSequence(String, CharSequence, int[]).
There is an overhead to creating name-compacted ImmutableSequences in performance and the permgen memory space which may cause problems if you create
for example more than 10,000 little contigs each with their own Builder instance. Therefore it is recommended that this class only be used on sets of sequences of 1000 or more sequences.
For smaller cases, createNucleotideSequence(String, CharSequence) should be used instead.
This class is not thread safe.| Constructor and Description |
|---|
ImmutableSequence.Builder() |
| Modifier and Type | Method and Description |
|---|---|
void |
addName(String name)
Adds a name that will later be used in a call to create a sequence.
|
ImmutableSequence |
createCopyOf(SequenceDocument sequenceToCopy,
boolean createCopyEvenIfItDiscardsInformation)
Creates a ImmutableSequence copy of a given sequence.
|
ImmutableSequence |
createNucleotideGraphSequence(String name,
CharSequence charSequence,
int[] internalSequenceQualityValues)
Creates a nucleotide graph sequence compacted to use as little memory as possible
|
ImmutableSequence |
createNucleotideGraphSequence(String name,
CharSequence charSequence,
NucleotideGraph nucleotideGraph)
Creates a nucleotide graph sequence compacted to use as little memory as possible
|
ImmutableSequence |
createNucleotideSequence(String name,
CharSequence charSequence)
Creates a nucleotide sequence compacted to use as little memory as possible
|
public void addName(String name)
createNucleotideSequence(String, CharSequence) or createNucleotideGraphSequence(String, CharSequence, NucleotideGraph)
or createNucleotideGraphSequence(String, CharSequence, int[]). This allows sequence names to be analyzed for patterns
so that they can be compressed.name - the name of a sequence. Sequence names do not need to be unique - i.e. the same name can be added multiple times.IllegalStateException - If an of the sequence creation methods have already been called on this builder.public ImmutableSequence createNucleotideSequence(String name, CharSequence charSequence)
name - the name of the sequence, which should be identical to a name passed to an earlier call to addName(String). Sequence names do not need to be unique - i.e. the same name can be added multiple times.charSequence - the sequence nucleotides or residues.public ImmutableSequence createNucleotideGraphSequence(String name, CharSequence charSequence, NucleotideGraph nucleotideGraph)
name - the name of the sequence, which should be identical to a name passed to an earlier call to addName(String). Sequence names do not need to be unique - i.e. the same name can be added multiple times.charSequence - the sequence nucleotides or residues.charSequence - the sequence nucleotides or residues.nucleotideGraph - the nucleotide graph associated with these residues. Only the quality information from it is used (any trace data is ignored)public ImmutableSequence createNucleotideGraphSequence(String name, CharSequence charSequence, int[] internalSequenceQualityValues)
name - the name of the sequence, which should be identical to a name passed to an earlier call to addName(String). Sequence names do not need to be unique - i.e. the same name can be added multiple times.charSequence - the sequence nucleotides or residues.charSequence - the sequence nucleotides or residues.internalSequenceQualityValues - an array in length equal to charSequence.length() excluding any end gaps.public ImmutableSequence createCopyOf(SequenceDocument sequenceToCopy, boolean createCopyEvenIfItDiscardsInformation)
sequenceToCopy - the sequence to create a copy ofcreateCopyEvenIfItDiscardsInformation - true to create a copy even if not all information present in sequenceToCopy can be copied. For example annotations aren't supported.