Rosalind刷题-DNA反向互补序列

原题:Complementing a Strand of DNA

数据:https://github.com/sajesi/Julia_for_Rosalind/blob/main/data/rosalind_revc.txt

#Given: A DNA string s of length at most 1000 bp.
#Return: The reverse complement sc of s.

using Chain

function revc(DNAseq::AbstractString)
    @chain DNAseq begin
        collect
        replace('A' => 'T','C' => 'G','T' => 'A','G' => 'C')
        join
        reverse    
    end
end

seq = readchomp("data/rosalind_revc.txt")

revc(seq)