-
Notifications
You must be signed in to change notification settings - Fork 4
NucleotideSequence
This section deals with modifying a NucleotideSequence by using a NucleotideSequenceBuilder.
If the sequence is already stored as a NucleotideSequence, you can either use the NucleotideSequenceBuilder constructor that takes a NucleotideSequence object new NucleotideSequenceBuilder( myseq) or as of Jillion 5, a new method on the NucleotideSequence object itself toBuilder() which will return a new builder instance:
NucleotideSequence originalSequence = ...
NucleotideSequence ungappedSequence = originalSequence.toBuilder()
.ungap()
.build();If the sequence is a String, you must use the NucleotideSequenceBuilder constructor that takes a String object:
NucleotideSequence ungappedSequence = new NucleotideSequenceBuilder("AC-GT-AC-GT")
.ungap()
.build();
//ungappedSequence will now contain "ACGTACGT"NucleotideSequenceBuilders have a method called reverseComplement() which will reverse complement the current sequence stored in the builder. Any future additions to the sequence will not be auto-complemented.
NucleotideSequence complementedSeq = new NucleotideSequenceBuilder("AAAAGGGG")
.reverseComplement()
.build();
//complementedSeq will now contain "CCCCTTTT"NucleotideSequenceBuilders use method chaining to allow users to write more intent revealing code:
NucleotideSequence seq = new NucleotideSequenceBuilder("AA--AAG-GG-G")
.reverseComplement()
.ungap()
.append("NNNN")
.build();
//seq will now contain "CCCCTTTTNNNN"