Skip to content

PrairieLearn/pl-oer-element-alignmenttable

Repository files navigation

PrairieLearn OER Element: Sequence Alignment Table

This element was developed by Pai Zheng and Yujie Miao. Please carefully test the element and understand its features and limitations before deploying it in a course. It is provided as-is and not officially maintained by PrairieLearn, so we can only provide limited support for any issues you encounter!

If you like this element, you can use it in your own PrairieLearn course by copying the contents of the elements folder (and potentially the serverFilesCourse, see below) into your own course repository. After syncing, the element can be used as illustrated by the example question that is also contained in this repository.

pl-alignment-table element

This element creates a dymnamic programming (DP) table for sequence alignment algorithms. It can be used both to display non-interactive instructional materials and interactive, auto-graded questions where students fill in cells and highlight the optimal path.

Note that this element requires a server.py script to fill in the table contents or grade answers. Although it is possible to manually generate and grade tables, we recommend using the provided libraries by also copying the scripts from the serverFilesCourse folder of this course. See the documentation below and the sample question for details how to configure, randomize and grade this element.

Example

Non-interactive table as question material

    <pl-dp-table answers-name="q1" is-material="true"></pl-dp-table>

Interactive table where students fill cells and highlight the optimal path

  <pl-dp-table answers-name="q2" type="local"></pl-dp-table>

Pre-filled table with path highlighting only

  <pl-dp-table answers-name="q3" path-only="true" type="fitting"></pl-dp-table>

Element Attributes

Attribute Type Description
answers-name string (required) Unique identifier for the element
is-material boolean (default: false) If true, the table is displayed non-interactively as question material, with all cells already filled.
path-only boolean (default: false) Only relevant if is-material is false. If true, the table is displayed with all cells already filled, asking students to only select the correct path.
type string (default: global) Only relevant if is-material is false. Alignment type (global, fitting, or local); this affects feedback given to students during grading.
placeholder string (default: ``) Only relevant if is-material is false. Placeholder text for unfilled table cells.

Sequence Generation

The row and column headers for the alignment table (i.e., the two sequences to be aligned) are defined by the parameters v and w. These can be set manually in the question's server.py file, or randomized by calling the provided generate_paired_sequences function in the paired_HMM.py file in the serverFilesCourse folder. The following example shows how to use the function:

from sequenceAlignment_autograder.paired_HMM import generate_paired_sequences

sequence_length = 4
data["params"]["v"], data["params"]["w"] = generate_paired_sequences(sequence_length)

In addition to the sequence length, the function can be custom-tailored using the following named parameters:

  • alphabet (default: ["A", "C", "G", "T"]) defined the alphabet to be used in the sequences
  • match_prob (default: 0.3) defines the probability for a match
  • delta (default: 0.2) defines the probability for a gap opening
  • epsilon (default: 0.1) defines the probability for a gap extension

Pre-filling and Grading Tables

The element provides auto-graders that can be used to both generate the contents of question material tables and to grade student submissions. These auto-graders are available in the serverFilesCourse folder in the files global_alignment.py, fitting_alignment.py, and local_alignment.py. Simply import the grader(s) that match the desired alignment type and call the corresponding function (e.g., global_alignment). The following example shows how to use the function, and the other alignment types work analogously:

from sequenceAlignment_autograder.global_alignment import global_alignment

# This assumes that you have either generated or manually defined the sequences v and w as shown previously
data["correct_answers"]["q1"] = global_alignment(data["params"]["v"], data["params"]["w"])

Note that the element will automatically pre-fill the path and/or table contents or use them for grading, based on the table attributes is-material and path-only. Also note that the chosen alignment type should match the table's type attribute. Only the answers defined in data["correct_answers"] are used for actual grading, but a type mismatch might lead to inconsistent feedback for students.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published