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.22 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.21 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.20 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.19 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.18 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.17 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.16 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.15 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.14 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.13 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.12 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.11 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.10 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.9 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.8 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.7 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.6 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.5 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.4 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.3 tracks/bash/exercises/rna-transcription/example.sh