[Biojava-dev] Using DNASequence reverseComplement
PATERSON Trevor
trevor.paterson at roslin.ed.ac.uk
Mon May 17 15:24:34 UTC 2010
Sorry for raising that behemoth earlier..
I have a separate problem with the DNASequence API -
Probably I just don't understand how to use the View objects
If I make a DNASequence
DNASequence seq = new DNASequence("AAAAACCCCGGGTT");
i.e. length = 14,
I might reasonably want to get the ReverseComplement of bases 11-14, which should 'be' "AACC"
But I cannot manage to get this in one easy step....
seq.toString(): AAAAACCCCGGGTT --> FINE
seq.getReverseComplement().getSequenceAsString(): AACCCGGGGTTTTT --> FINE
But when I try to use bounds on this complement - methods refer back to the original seq's iterator, not the complement
seq.getReverseComplement().getSequenceAsString(11,14,Strand.POSITIVE): GGTT
i.e the same as seq.getSequenceAsString(11,14,Strand.POSITIVE)
seq.getReverseComplement().getSequenceAsString(11,14,Strand.NEGATIVE): TTGG
i.e the same as seq.getSequenceAsString(11,14,Strand.NEGATIVE)
Is this the desired behaviour? How would I get the desired reverseComplement fragment?
The only obvious way that I can see is
DNASequence subseq = new DNASequence(seq.getSequenceAsString(11, 14, Strand.POSITIVE));
System.out.println(""+ subseq.getReverseComplement().getSequenceAsString());
_____________________________________________________________________________________________
On a related point I was mightily confused by the Strand.POSITIVE/Strand.NEGATIVE enumeration
I was naively interpreting them to refer to the strand of the DNA:
Whereas they infact refer to the directionality of the Iterator *on the same Strand*
A better name might be Direction:FORWARDS/Direction.BACKWARDS?
Positive and negative strand has loaded biological meaning for newbies like me ( sense versus antisense )
So I made the assumption that a Strand.NEGATIVE call would itself reverseComplement
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the biojava-dev
mailing list