Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#!/bin/bash clear echo \"Enter your oligonucleotide sequence: \" read SEQ if [[

ID: 3583646 • Letter: #

Question

#!/bin/bash clear echo

"Enter your oligonucleotide sequence: "

read SEQ

if [[ "$SEQ" == [ATCGatcg] ]];

then

echo "Your entered oligonucleotide sequence is $SEQ"

else echo "Error! $SEQ is not a valid sequence. Enter an oligonucleotide sequence."

fi

I need to write a script that checks if an entered string is an oligonucleotide. An oligonucleotide is a string of any length that contains only A,G,C,T,a,c,g,t. If they contain any other characters, it is not an oligonucleotide. I have the script below but can only get one output and not the other. Please help.

Explanation / Answer

echo "Enter your oligonucleotide sequence:"
read SEQ
if [(index "$SEQ" A > 0 ) -o (index "$SEQ" G > 0 ) -o (index "$SEQ" C > 0 ) -o (index "$SEQ" T > 0 ) -o (index $SEQ" a > 0 ) -o (index "$SEQ" c > 0 ) -o (index "$SEQ" g > 0 ) -o (index "$SEQ" t > 0 )]
then echo
"Your entered oligonucleotide sequence is $SEQ"
else echo "Error! $SEQ is not a valid sequence. Enter an oligonucleotide sequence."
fi