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.82 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.81 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.80 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.79 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.78 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.77 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.76 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.75 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.74 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.73 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.72 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.71 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.70 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.69 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.68 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.67 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.66 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.65 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.64 tracks/bash/exercises/rna-transcription/example.sh
trackler-2.2.1.63 tracks/bash/exercises/rna-transcription/example.sh