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.2 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.1 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.0 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.6 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.5 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.4 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.3 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.2 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.1 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.0.0 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.55 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.54 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.53 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.52 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.51 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.50 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.49 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.48 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.47 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.1.0.46 tracks/bash/exercises/rna-transcription/example.sh