When you fetch a sequence from EMBL and the Sequence is RNA it will be uploaded as RNA with U instead of T. How to convert such a sequence to DNA?
Cheers
When you fetch a sequence from EMBL and the Sequence is RNA it will be uploaded as RNA with U instead of T. How to convert such a sequence to DNA?
Cheers
Good question ! Internally we’ve tried to make Jalview T/U agnostic, so PCA and Tree calculations score them identically when computing distances, but that’s not always desirable.
We don’t have an existing option to translate betwen DNA and RNA, but the following script will do what you ask:
// get the current alignment when Calculate->Execute Script (won't work for batch mode)
def al = jalview.bin.Jalview.currentAlignFrame.getViewport().getAlignment()
// RNA to DNA
def from="(?i)u",to="t"
// DNA to RNA
// def from="(?i)t",to="u"
al.getSequences().each { s ->
s.setSequence(s.getSequenceAsString().replaceAll(from,to))
d = s.getDatasetSequence()
d.setSequence(d.getSequenceAsString().replaceAll(from,to))
}
jalview.bin.Jalview.currentAlignFrame.getViewport().alignmentChanged()
Open the groovy console (under the Jalview Desktop’s Tools menu) and paste the script. Uncomment whichever from,to definition you need and run it for the alignment you’d like to convert via Calculate->Run Groovy Console Script.
We’ve had a feature request to add this for some time (https://issues.jalview.org/browse/JAL-1000) - if this is something you’d use often do let us know so we can prioritise it !
Jim
The script works fine, Thanks.
I update my virus genome alignments once or twice a year, so I can work with the script.