Sha256: d21cedf15e344159220afe4c4041620b7e3bbabee9996c1a8b169eeeb80873bc

Contents?: true

Size: 552 Bytes

Versions: 206

Compression:

Stored size: 552 Bytes

Contents

class Complement {

    private def dnaMap = ["G":"C","C":"G","T":"A","A":"U"]
    private def rnaMap = ["C":"G","G":"C","A":"T","U":"A"]

    private def transcribe(seq, seqMap) {
        def result = new String()
        seq.split('').each() {
            if ( !seqMap[it] ) {
                throw new IllegalArgumentException()
            }
            result += seqMap[it]
        }
        return result
    }

    def ofDNA(strand) {
        transcribe(strand, dnaMap)
    }

    def ofRNA(strand) {
        transcribe(strand, rnaMap)
    }

}

Version data entries

206 entries across 206 versions & 1 rubygems

Version Path
trackler-2.2.1.10 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.9 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.8 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.7 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.6 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.5 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.4 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.3 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.2 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.1 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.1.0 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.6 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.5 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.4 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.3 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.2 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.1 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.2.0.0 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.1.0.55 tracks/groovy/exercises/rna-transcription/Example.groovy
trackler-2.1.0.54 tracks/groovy/exercises/rna-transcription/Example.groovy