Sha256: a888842fce840b772145d190ca035a380845ccd691690a06899242f6687ee36c

Contents?: true

Size: 289 Bytes

Versions: 300

Compression:

Stored size: 289 Bytes

Contents

declare -A trans
trans[G]='C'
trans[C]='G'
trans[A]='U'
trans[T]='A'

for i in $(seq 1 ${#1}); do
  nt="${1:$i-1:1}"
  comp_nt="${trans[$nt]}"

  if [ -z "$comp_nt" ]; then
    echo 'Invalid nucleotide detected.'
    exit 1
  fi

  complement="$complement$comp_nt"
done

echo $complement

Version data entries

300 entries across 300 versions & 1 rubygems

Version Path
trackler-2.2.1.42 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.41 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.40 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.39 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.38 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.37 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.36 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.35 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.34 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.33 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.32 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.31 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.30 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.29 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.28 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.27 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.26 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.25 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.24 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.23 tracks/bash/exercises/rna-transcription/example.sh