## TITLE('mRNA Translation Accuracy')
## DESCRIPTION
## Select the statement that is TRUE or FALSE about mRNA translation accuracy.
## ENDDESCRIPTION
## KEYWORDS('mRNA translation accuracy','true/false','multiple choice')
## DBsubject('Molecular Biology')
## DBchapter('')
## DBsection('')
## Date('2026-08-19')
## Author('Neil R. Voss')
## Institution('Roosevelt University')

DOCUMENT();

loadMacros(
  "PGstandard.pl",
  "PGML.pl",
  "PGchoicemacros.pl",
  "parserRadioButtons.pl",
  "PGcourse.pl",
);

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

#==========================================================
# AUTO-GENERATED GROUPS FROM YAML
#==========================================================

@true_groups = (
  [
    'bonding of the <span style="color: darkred; font-weight:700;">tRNA anticodon</span> to the <span style="color: darkgreen; font-weight:700;">mRNA codon</span>.',
    'bonding of the <span style="color: darkgreen; font-weight:700;">mRNA codon</span> to the <span style="color: darkred; font-weight:700;">tRNA anticodon</span>.',
    'base-pairing of the <span style="color: darkgreen; font-weight:700;">mRNA codon</span> to the <span style="color: darkred; font-weight:700;">tRNA anticodon</span>.',
    'base-pairing of the <span style="color: darkred; font-weight:700;">tRNA anticodon</span> to the <span style="color: darkgreen; font-weight:700;">mRNA codon</span>.',
  ],
  [
    'attachment of the specific <span style="color: darkblue; font-weight:700;">amino acid</span> to the tRNA.',
    'covalent attachment of the specific <span style="color: darkblue; font-weight:700;">amino acid</span> to the tRNA CCA tail.',
    '<span style="color: darkblue; font-weight:700;">amino acid</span> attached to tRNA by the synthase enzyme.',
    'match between the attached <span style="color: darkblue; font-weight:700;">amino acid</span> and the <span style="color: darkred; font-weight:700;">tRNA anticodon</span>',
    'match between the <span style="color: darkred; font-weight:700;">tRNA anticodon</span> and the attached <span style="color: darkblue; font-weight:700;">amino acid</span>',
  ],
);
@false_groups = (
  [
    'attachment of the carboxyl on the previous <span style="color: darkblue; font-weight:700;">amino acid</span> with the amine of the next <span style="color: darkblue; font-weight:700;">amino acid</span>.',
    'attachment of the amine on the previous <span style="color: darkblue; font-weight:700;">amino acid</span> with the carboxyl of the next <span style="color: darkblue; font-weight:700;">amino acid</span>.',
  ],
  [
    'binding of the <span style="color: darkred; font-weight:700;">tRNA anticodon</span> to small subunit of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'binding of small subunit of the <span style="color: orangered; font-weight:700;">ribosome</span> to mRNA.',
    q{binding of small subunit of the <span style="color: orangered; font-weight:700;">ribosome</span> to the mRNA's Shine-Delgarno sequence.},
  ],
  [
    'binding of the new <span style="color: #663300; font-weight:700;">tRNA molecule</span> to the A-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
  ],
  [
    'removal of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the E-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
  ],
  [
    'binding of large subunit of the <span style="color: orangered; font-weight:700;">ribosome</span> to the amino acyl-tRNA.',
    q{binding of large subunit of the <span style="color: orangered; font-weight:700;">ribosome</span> to the tRNA's CCA tail.},
  ],
  [
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the A-site to the E-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the A-site to the P-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the E-site to the A-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the E-site to the P-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the P-site to the A-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
    'translocation of the <span style="color: #663300; font-weight:700;">tRNA molecule</span> from the P-site to the E-site of the <span style="color: orangered; font-weight:700;">ribosome</span>.',
  ],
);

#==========================================================
# GLOBAL SETTINGS
#==========================================================

$topic = 'mRNA translation accuracy';
my $local_random = PGrandom->new();
$local_random->srand($problemSeed);
my @mode_choices = ("TRUE", "FALSE");
$mode = $mode_choices[$local_random->random(0, $#mode_choices, 1)];
$num_distractors = 4;
# Question text with TRUE override
$question_true = 'Accuracy in translation of mRNA into a polypeptide depends on the correct ___.';
#==========================================================
# SELECT GROUP
#==========================================================

my (@selected_group, @opposite_groups);

if ($mode eq "TRUE") {
  $group_index      = $local_random->random(0, scalar(@true_groups)-1, 1);
  @selected_group   = @{ $true_groups[$group_index] };
  @opposite_groups  = @false_groups;
} else {
  $group_index      = $local_random->random(0, scalar(@false_groups)-1, 1);
  @selected_group   = @{ $false_groups[$group_index] };
  @opposite_groups  = @true_groups;
}

#==========================================================
# PICK CORRECT + DISTRACTORS
#==========================================================

my $correct_index = $local_random->random(0, $#selected_group, 1);
$correct = $selected_group[$correct_index];

my @available_group_indices = (0 .. $#opposite_groups);
my @selected_distractor_indices = ();

while (@selected_distractor_indices < $num_distractors && @available_group_indices > 0) {
  my $random_index = $local_random->random(0, scalar(@available_group_indices)-1, 1);
  push @selected_distractor_indices, splice(@available_group_indices, $random_index, 1);
}

@distractors = ();
foreach my $group_idx (@selected_distractor_indices) {
  my @group = @{ $opposite_groups[$group_idx] };
  my $distractor_index = $local_random->random(0, $#group, 1);
  my $distractor = $group[$distractor_index];
  push @distractors, $distractor;
}

@choices = ($correct, @distractors);

#==========================================================
# SHUFFLE CHOICES (SEED-STABLE)
#==========================================================

my @choice_indices = (0 .. $#choices);
my @choice_shuffled = ();
while (@choice_indices) {
  my $pick = $local_random->random(0, $#choice_indices, 1);
  push @choice_shuffled, splice(@choice_indices, $pick, 1);
}
@choices = @choices[@choice_shuffled];

#==========================================================
# RADIO BUTTONS WITH A/B/C/D/E LABELS
#==========================================================

$rb = RadioButtons(
  [@choices],
  $correct,
  labels        => ['A','B','C','D','E'],
  displayLabels => 1,
  randomize     => 0,
  separator     => '<div style="margin-bottom: 0.7em;"></div>',
);

#==========================================================
# PGML
#==========================================================

BEGIN_PGML

[@ $mode eq "TRUE" ? $question_true : "Which one of the following statements is <span style='color: #ba372a;'><strong>FALSE</strong></span> about $topic?" @]*

[_]{$rb}

END_PGML

ENDDOCUMENT();

