How to convert a fetched RNA sequence to DNA

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?


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 -> 
  d = s.getDatasetSequence()

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 ( - if this is something you’d use often do let us know so we can prioritise it !


The script works fine, Thanks.

I update my virus genome alignments once or twice a year, so I can work with the script.

1 Like