### Initialize Sentry for Error Tracking (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/index.html Initializes the Sentry SDK for error monitoring and performance tracing. It includes DSN configuration, release version tagging, and integration of BrowserTracing and CaptureConsole for console error logging. This setup helps in identifying and debugging issues in the SciGrade application. ```javascript Sentry.init({ dsn: "https://4661e72aaeb74d2fbd9e23b79e9506e0@o1185775.ingest.us.sentry.io/6600341", // @AlexJSully when updating the package version number in package.json, update the version number here as well. release: "scigrade@1.2.0", integrations: [ new Sentry.BrowserTracing(), new Sentry.Integrations.CaptureConsole({ levels: ["error"], }), ], // We recommend adjusting this value in production, or using tracesSampler for finer control tracesSampleRate: 1.0, // Enable logs to be sent to Sentry enableLogs: true, }); Sentry.configureScope((scope) => { // @AlexJSully when updating the package version number in package.json, update the version number here as well. scope.setTag("app-version", "1.2.0"); }); ``` -------------------------------- ### Validate F1 Primers using JavaScript Source: https://context7.com/alexjsully/scigrade/llms.txt Checks the forward primer (F1) design. It verifies the presence of a T7 promoter sequence followed by a specific portion of the gRNA sequence. This function is crucial for ensuring the correct setup of PCR or other amplification methods. ```javascript function checkF1Primers(seq) { MARF1primers = false; possible_F1_primers = []; const begin_F1 = "TAATACGACTCACTATAG"; let count_First = true; // Check if first nucleotide is G if (seq[0] === "G") { count_First = false; } // Generate possible primers with varying lengths (16-20bp) for (let i = 16; i <= 20; i += 1) { possible_F1_primers.push(begin_F1 + seq.slice(0, i)); } // If first is not G, add alternatives starting from position 1 if (!count_First) { for (let i = 16; i <= 20; i += 1) { possible_F1_primers.push(begin_F1 + seq.slice(1, i)); } } // Check if student input matches any valid option if (possible_F1_primers.includes(document.getElementById("f1_input").value.trim())) { MARF1primers = true; } } // Usage example const gRNASeq = "CTCGTGACCACCCTGACCCA"; checkF1Primers(gRNASeq); // Expected F1: TAATACGACTCACTATAGCTCGTGACCACCCTGA ``` -------------------------------- ### Sentry Initialization and Scope Configuration (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/core/systemrun.html Initializes the Sentry SDK for error tracking and performance monitoring. It includes DSN configuration, release version tagging, and browser tracing integration. The scope is further configured to tag application version for better release management. ```javascript Sentry.init({ dsn: "https://4661e72aaeb74d2fbd9e23b79e9506e0@o1185775.ingest.sentry.io/6600341", // @AlexJSully when updating the package version number in package.json, update the version number here as well. release: "scigrade@1.2.0", integrations: [ new Sentry.BrowserTracing(), new Sentry.Integrations.CaptureConsole({ levels: ["error"], }), ], // We recommend adjusting this value in production, or using tracesSampler for finer control tracesSampleRate: 1.0, }); Sentry.configureScope((scope) => { // @AlexJSully when updating the package version number in package.json, update the version number here as well. scope.setTag("app-version", "1.2.0"); }); ``` -------------------------------- ### Configure Google Analytics (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/index.html Sets up Google Analytics tracking using Google Tag Manager (GTM). It initializes the dataLayer, configures the gtag.js script for sending data, and asynchronously loads the GTM script into the page. This enables website traffic analysis and user behavior tracking. ```javascript window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("js", new Date()); gtag("config", "G-63H7EM0MK6"); (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js", }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""; j.async = true; j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl; f.parentNode.insertBefore(j, f); })(window, document, "script", "dataLayer", "GTM-K9PRB9W"); ``` -------------------------------- ### Google Analytics and Tag Manager Initialization (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/core/systemrun.html Configures Google Analytics (gtag.js) and Google Tag Manager (GTM). It pushes the initial 'js' event with the current date to the dataLayer and asynchronously loads the GTM script, essential for tracking user behavior and marketing campaigns. ```javascript window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag("js", new Date()); gtag("config", "G-63H7EM0MK6"); (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js", }); let f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != "dataLayer" ? "&l=" + l : ""; j.async = true; j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl; f.parentNode.insertBefore(j, f); })(window, document, "script", "dataLayer", "GTM-K9PRB9W"); ``` -------------------------------- ### Load CRISPR JSON Data Files using JavaScript Source: https://context7.com/alexjsully/scigrade/llms.txt Asynchronously fetches and loads gene background information and Benchling gRNA output data from local JSON files. It uses the Fetch API and handles potential errors during the fetching process. This function is typically called on page load. ```javascript async function loadCRISPRJSON_Files() { try { // Fetch Benchling_gRNA_Outputs.json const responseBenchling = await fetch("./data/Benchling_gRNA_Outputs.json"); benchling_gRNA_outputs = await responseBenchling.json(); // Fetch gene_background_info.json const responseGeneBackground = await fetch("data/Background_info/gene_background_info.json"); gene_backgroundInfo = await responseGeneBackground.json(); } catch (err) { console.error("Error fetching file:", err); } } // Usage: Call on page load loadCRISPRJSON_Files().then(() => { fillGeneList(); loadWork(); }); ``` -------------------------------- ### Google User Authentication and Sign-out (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/core/systemrun.html Handles Google user sign-in by retrieving user profile information (name and email) and initiating a log/registration process. It also includes a function to sign out the user from their Google account. ```javascript let studentParseNum; let googleName; let googleEmail; /** * Retrieves Google user information and stores it */ function onSignIn(googleUser) { let profile = googleUser.getBasicProfile(); googleName = profile.getName(); googleEmail = profile.getEmail(); // This is null if the 'email' scope is not present. sendLogReg(); } /** * Google sign-out */ function signOut() { let auth2 = gapi.auth2.getAuthInstance(); auth2.signOut(); } ``` -------------------------------- ### Verify Student Login and Determine Access Level (JavaScript) Source: https://context7.com/alexjsully/scigrade/llms.txt This function authenticates registered students by verifying their student number against a list of registered students. It determines the access level (student, TA, or admin) based on the verification result. If the student is registered and verified, it proceeds to the next login step; otherwise, it displays an appropriate error message. ```javascript function loginVerify(student_NumVerify) { alreadyRegistered = false; let maxNum = 0; checkStudentNum = false; if (student_reg_information?.[0]?.student_list && student_reg_information[0].student_list.length > 0) { for (let i = 0; i < student_reg_information[0].student_list.length; i += 1) { if (student_reg_information[0].student_list[i].student_number === student_NumVerify) { if (student_reg_information[0].student_list[i].gmail !== "unregistered") { alreadyRegistered = true; checkStudentNum = true; studentNumber = student_NumVerify; studentParseNum = i; } else if (student_reg_information[0].student_list[i].gmail === "unregistered") { alreadyRegistered = false; } } else { maxNum += 1; } } } if (alreadyRegistered && checkStudentNum) { $("#loginForm").empty(); document.getElementById("loginP2").style.display = "block"; } else if (!alreadyRegistered) { showRegError(5); } else if (maxNum === student_reg_information[0].student_list.length) { showRegError(1); } } // Usage example const studentNumber = "1003817535"; loginVerify(studentNumber); // On success: Redirects to practice/assignment interface // On failure: Shows error modal with appropriate message ``` -------------------------------- ### Loading CRISPR Data Files Source: https://github.com/alexjsully/scigrade/blob/master/EDIT.MD This JavaScript function is responsible for loading necessary JSON data files used in the SciGrade marking algorithm. These files include gene background information and gRNA output results from Benchling. Accurate calls to these files are crucial for the system to function correctly. ```javascript function loadCRISPRJSON_Files() { // ... implementation details for loading JSON files ... // This function ensures that data from gene_background_info.json and // Benchling_gRNA_Outputs.json are correctly loaded and processed. } ``` -------------------------------- ### Login/Registration Tab Navigation (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/core/systemrun.html Manages the UI switching between login and registration forms. It updates CSS classes for active tabs and controls the display style (block/none) of the corresponding content sections using jQuery and DOM manipulation. ```javascript /** * Handle changing navigation tabs between login and register * @param {String} [which='login'] Which tab is being switched to (default login) * @example * Use this function to handle switching between the login and register content * handleLoginTabChange('login') * // returns null (does not return anything but rather un-hides the login content) */ function handleLoginTabChange(which = "login") { // Add class active to click tab and remove from other and make tab content visible if (which === "login") { // Selecting tab $("#loginTab").addClass("active"); $("#registerTab").removeClass("active"); // Adjusting tab content document.getElementById("login").style.display = "block"; document.getElementById("register").style.display = "none"; } else { // Selecting tab $("#loginTab").removeClass("active"); $("#registerTab").addClass("active"); // Adjusting tab content document.getElementById("login").style.display = "none"; document.getElementById("register").style.display = "block"; } } ``` -------------------------------- ### Generating Front-end Information Source: https://github.com/alexjsully/scigrade/blob/master/EDIT.MD These JavaScript functions are responsible for automatically generating front-end information within SciGrade after new gene data has been added. `fillGeneList()` populates the gene list, and `loadWork()` loads the relevant assignment or practice content based on the selected gene. ```javascript function fillGeneList() { // ... implementation details for filling the gene list ... } function loadWork() { // ... implementation details for loading gene-specific work ... } ``` -------------------------------- ### Submit Student Answers with Validation and Feedback (JavaScript) Source: https://context7.com/alexjsully/scigrade/llms.txt This function processes complete student submissions, including validation, marking, and feedback generation. It collects answers from input fields, gathers marking outputs, and then displays feedback options to the user. It relies on DOM elements for input and display, and uses a timeout for asynchronous operations. ```javascript function submitAnswers() { all_answers = []; all_outputs = []; all_marks = []; checkAnswers(); setTimeout(() => { markAnswers(); studentAnswers = `student_list.${studentParseNum}.${loadedMode}-${current_gene}-Answers`; studentOutputs = `student_list.${studentParseNum}.${loadedMode}-${current_gene}-Outputs`; studentMarks = `student_list.${studentParseNum}.${loadedMode}-${current_gene}-Marks`; // Collect all answers all_answers.push( document?.getElementById("sequence_input")?.value?.trim() || "", document.getElementById("pam_input").value.trim(), document.getElementById("position_input").value, document.getElementById("strand_input").value, document.getElementById("offtarget_input").value, document.getElementById("f1_input").value.trim(), document.getElementById("r1_input").value.trim(), ); // Collect marking outputs all_outputs.push( MARstrand, MARgRNAseq, MARgRNAseq_degree, MARCutPos, MARPAMseq, MAROffTarget, MAROffTarget_degree, MAROffTarget_aboveOpt, MAROffTarget_above35, MAROffTarget_onlyOption, MARF1primers, MARR1primers, ); all_marks.push(studentMark, studentMarkPercentage); // Show feedback interface document.getElementById("options_label").innerHTML = "Would you like to see feedback on your answers or start a new assignment?"; document.getElementById("seeFeedback").removeAttribute("hidden"); showFeedback(); $("#feedbackButton").click(); }, 750); } // Usage example with sample data document.getElementById("sequence_input").value = "CTCGTGACCACCCTGACCCA"; document.getElementById("pam_input").value = "CGG"; document.getElementById("position_input").value = "380"; document.getElementById("strand_input").value = "Antisense (-)"; document.getElementById("offtarget_input").value = "75.3"; document.getElementById("f1_input").value = "TAATACGACTCACTATAGCTCGTGACCACCCTGA"; document.getElementById("r1_input").value = "TTCTAGCTCTAAAACTGGGTCAGGGTGGTCACGAG"; submitAnswers(); ``` -------------------------------- ### Check Student gRNA Answers (JavaScript) Source: https://context7.com/alexjsully/scigrade/llms.txt Validates student-submitted gRNA sequences against correct outputs from the Benchling database. It checks sequence accuracy, PAM correctness, nucleotide positioning, and strand. Dependencies include global variables like MARgRNAseq, MARgRNAseq_degree, gene_backgroundInfo, and benchling_gRNA_outputs. ```javascript function checkAnswers() { // Reset answers MARgRNAseq = false; MARgRNAseq_degree = 0; MARPAMseq = false; MARCutPos = false; MARstrand = false; // Get target nucleotide position const correctNucleotidePosition = gene_backgroundInfo.gene_list[current_gene]["Target position"] - 1; // Check if gRNA sequence matches database const inputtedSeq = document?.getElementById("sequence_input")?.value?.trim() || undefined; possible_comparable_answers = []; if (inputtedSeq) { for (const answer of benchling_gRNA_outputs.gene_list[current_gene]) { if (answer.Sequence === inputtedSeq) { possible_comparable_answers.push(answer); } } } // Validate against each possible answer if (possible_comparable_answers.length > 0) { for (const possibleAnswer of possible_comparable_answers) { // Check if target nucleotide is in correct range correctNucleotideIncluded = false; if (possibleAnswer.Strand === 1) { const nucleotideIncludedRange_top = possibleAnswer.Position - 1 - 1 + 3; const nucleotideIncludedRange_bot = possibleAnswer.Position - 1 - 17; if (correctNucleotidePosition >= nucleotideIncludedRange_bot && correctNucleotidePosition <= nucleotideIncludedRange_top) { correctNucleotideIncluded = true; } } // Check strand, PAM, position, off-target score, primers if (correctNucleotideIncluded) { if (document.getElementById("strand_input").value === "Sense (+)" && possibleAnswer.Strand === 1) { MARstrand = true; } checkOffTarget(possibleAnswer["Specificity Score"]); checkF1Primers(inputtedSeq); checkR1Primers(inputtedSeq); } } } checkAnswers_executed = true; } // Usage: Called before marking checkAnswers(); ``` -------------------------------- ### Dynamically Generate Assignment Form using JavaScript Source: https://context7.com/alexjsully/scigrade/llms.txt Dynamically creates the interactive assignment form for gRNA design submission. It populates gene-specific background information and generates input fields for gRNA sequence, PAM, position, strand, off-target scores, and primers. This function relies on pre-loaded gene background information. ```javascript function loadWork() { if (gene_backgroundInfo || gene_backgroundInfo !== "" || backgroundInfo?.[0].gene_list[current_gene]) { $("#work").empty(); loadedMode = selection_inMode; checkAnswers_executed = false; let append_str = '
'; // Add gene information append_str += `

Here is some background information about your gene: ${gene_backgroundInfo?.gene_list[current_gene].name} (${current_gene})

\n`; append_str += `

Background information: ${gene_backgroundInfo?.gene_list[current_gene].Background}

\n`; append_str += `

Target site: ${gene_backgroundInfo?.gene_list[current_gene]["Target site"]}

\n`; append_str += `

Modified genetic sequence: ${gene_backgroundInfo?.gene_list[current_gene].Sequence}

\n`; append_str += "
"; // Create form with all input fields append_str += '

Please input the following information for your gRNA for your selected gene.

\n
'; append_str += '
'; append_str += ''; append_str += 'This would be your gRNA sequence 5' to 3'. NOTE: This is maxed out at 20 characters long
'; // Add PAM, position, strand, off-target, F1/R1 primer fields... append_str += ''; append_str += "
"; $("#work").append(append_str); } } // Usage: Select gene and load current_gene = "HBB"; loadWork(); ``` -------------------------------- ### Generate Student Marks Download (JavaScript) Source: https://context7.com/alexjsully/scigrade/llms.txt This JavaScript function generates a downloadable CSV table of student marks. It verifies TA or Admin access, formats the table based on 'whichType', and includes student details like number and name. The output filename includes class, student name, and date. It requires access to 'student_reg_information', 'generateRestOfIndexTable', and jQuery's 'tableToCSV' plugin. ```javascript function generateHiddenStudentDownload(whichClass, whichType) { // Verify TA/Admin access if ( student_reg_information[0].student_list[studentParseNum].type === "TA" || student_reg_information[0].student_list[studentParseNum].type === "admin" ) { downloadIndexTable_fill = generateRestOfIndexTable(downloadIndexTable_fill, whichType); $("#hiddenDownloadModal_table").empty(); const d = new Date(); let downloadIndexTable_str = "\n\t\n"; let captionTitleBegin = "SciGrade_studentMark_"; if (!whichType) { captionTitleBegin = "SciGrade_studentMarkRaw_"; } downloadIndexTable_str += `\t\t\n`; downloadIndexTable_str += downloadIndexTable_fill; // Add student data rows const studentRegList = student_reg_information[0].student_list; for (const student of studentRegList) { if (student.type === "Student" && student.studentClass === whichClass) { downloadIndexTable_str += "\t\t\n"; downloadIndexTable_str += `\t\t\t\n`; downloadIndexTable_str += `\t\t\t\n`; downloadIndexTable_str += "\t\t\n"; } } downloadIndexTable_str += "\t\n
${captionTitleBegin}${student_reg_information[0].student_list[ studentParseNum ].name.replace(/\s/g, "")}_${d.getFullYear()}-${d.getMonth()}_${d.getDate()}
${student.student_number}${student.name}
"; document.getElementById("hiddenDownloadModal_table").innerHTML += downloadIndexTable_str; $("#hiddenDownloadModal_table").tableToCSV(); } else { showRegError(7); } } // Usage example const className = "HMB311-Winter-2024"; const simpleFormat = true; generateHiddenStudentDownload(className, simpleFormat); // Downloads: SciGrade_studentMark_SmithJohn_2024-3_15.csv ``` -------------------------------- ### Service Worker Registration (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/core/systemrun.html Registers a service worker script located at './scripts/serviceWorker/sw.js'. This is typically done on the window's 'load' event to ensure the main page is ready, enabling features like offline caching and background synchronization. ```javascript // Add service workers if (typeof navigator !== "undefined" && "serviceWorker" in navigator) { // Use the window load event to keep the page load performant window.addEventListener("load", () => { navigator.serviceWorker.register("./scripts/serviceWorker/sw.js"); }); } ``` -------------------------------- ### Marking Logic in SciGrade Source: https://github.com/alexjsully/scigrade/blob/master/EDIT.MD This JavaScript code defines the core logic for marking student submissions in SciGrade. It checks gRNA sequences, PAM sequences, off-target scores, and primer sequences to determine the correctness of answers and assign marks. It relies on external data for validation. ```javascript function markAnswers() { // ... implementation details for marking ... } function checkAnswers() { // ... implementation details for checking answers ... } function checkOffTarget(score) { // ... implementation details for checking off-target scores ... } function checkF1Primers(seq) { // ... implementation details for checking F1 primers ... } function checkR1Primers(seq) { // ... implementation details for checking R1 primers ... } ``` -------------------------------- ### Validate R1 Primers using JavaScript Source: https://context7.com/alexjsully/scigrade/llms.txt Validates the reverse primer (R1) design. It ensures the primer contains the correct sgRNA scaffold sequence followed by the reverse complement of the gRNA sequence. This function is essential for the reverse transcription or annealing steps in molecular biology protocols. ```javascript const complementary_nt_dict = { A: "T", T: "A", C: "G", G: "C", }; function checkR1Primers(seq) { MARR1primers = false; possible_R1_primers = []; const begin_R1 = "TTCTAGCTCTAAAAC"; // Create complementary sequence let complementary_seq = ""; for (const sequence of seq) { complementary_seq = complementary_nt_dict[sequence] + complementary_seq; } // Generate possible primers (19-20bp of complement) for (let i = 19; i <= 20; i += 1) { possible_R1_primers.push(begin_R1 + complementary_seq.slice(0, i)); } // Check if student input matches if (possible_R1_primers.includes(document.getElementById("r1_input").value.trim())) { MARR1primers = true; } } // Usage example const gRNASeq = "CTCGTGACCACCCTGACCCA"; checkR1Primers(gRNASeq); // Expected R1: TTCTAGCTCTAAAACTGGGTCAGGGTGGTCACGAG ``` -------------------------------- ### Register Service Worker (JavaScript) Source: https://github.com/alexjsully/scigrade/blob/master/index.html Registers a service worker script located at 'core/scripts/serviceWorker/sw.js'. This enables offline capabilities, background synchronization, and other advanced features for the SciGrade web application. The registration is conditional on the 'serviceWorker' being available in the navigator object. ```javascript if (typeof navigator !== "undefined" && "serviceWorker" in navigator) { navigator.serviceWorker.register("core/scripts/serviceWorker/sw.js"); } ``` -------------------------------- ### Calculate Student Score using JavaScript Source: https://context7.com/alexjsully/scigrade/llms.txt Marks student answers and calculates a final score out of 10. It incorporates weighted partial credit for different components, including gRNA sequence correctness, PAM sequence presence, off-target scores, and primer validations (F1 and R1). This function is central to the grading system. ```javascript let studentMark = 0; let studentMarkPercentage = 0; const markTotal = 10; function markAnswers() { studentMark = 0; if (!checkAnswers_executed) { checkAnswers(); } if (checkAnswers_executed) { // gRNA sequence: 0-2 marks (full, partial, technically correct) if (MARgRNAseq) { if (MARgRNAseq_degree === 1) { studentMark += 2; // Optimal } else if (MARgRNAseq_degree === 2) { studentMark += 1; // Partial (within 20bp) } else if (MARgRNAseq_degree === 3) { studentMark += 0.5; // Technically correct (within 30bp) } } // PAM sequence: 2 marks if (MARPAMseq) { studentMark += 2; } // Off-target score: 0-2 marks if (MAROffTarget) { if (MAROffTarget_degree === 1) { studentMark += 2; // Above optimal } else if (MAROffTarget_degree === 2) { studentMark += 1; // Above 35 } else if (MAROffTarget_degree === 3) { studentMark += 0.5; // Last resort } } // F1 primers: 2 marks if (MARF1primers) { studentMark += 2; } // R1 primers: 2 marks if (MARR1primers) { studentMark += 2; } // Calculate percentage studentMarkPercentage = ((studentMark / markTotal) * 100).toFixed(2); if (studentMarkPercentage > 100) { studentMarkPercentage = 100; } else if (studentMarkPercentage < 0) { studentMarkPercentage = 0; } } } // Usage: Full submission flow submitAnswers(); // Output: studentMark = 8.5, studentMarkPercentage = 85.00 ``` -------------------------------- ### Check gRNA Off-Target Score (JavaScript) Source: https://context7.com/alexjsully/scigrade/llms.txt Evaluates the off-target specificity score of a gRNA. It determines if the score meets optimal, acceptable, or last-resort criteria based on student input and a custom marking scheme. Dependencies include document elements and global variables like MAROffTarget and offtarget_List. ```javascript function checkOffTarget(score) { MAROffTarget = false; MAROffTarget_degree = 0; MAROffTarget_aboveOpt = false; MAROffTarget_above35 = false; MAROffTarget_onlyOption = false; const OffTargetValue_down = Math.floor(score); const OffTargetValue_up = Math.ceil(score); const InputOffTargetValue = parseInt(document.getElementById("offtarget_input").value, 10); // Check if input matches expected score if (correctNucleotideIncluded && MARgRNAseq) { if (InputOffTargetValue >= OffTargetValue_down && InputOffTargetValue <= OffTargetValue_up) { MAROffTarget = true; true_counts += 1; } } // Determine quality level if (MAROffTarget) { const rangeStarter_upper = parseInt(document.getElementById("position_input").value, 10) + 35; const rangeStarter_lower = parseInt(document.getElementById("position_input").value, 10) - 35; // Calculate optimal range offtarget_List = []; for (let i = 0; i < benchling_gRNA_outputs.gene_list[current_gene].length; i += 1) { if (benchling_gRNA_outputs.gene_list[current_gene][i].Position >= rangeStarter_lower && benchling_gRNA_outputs.gene_list[current_gene][i].Position <= rangeStarter_upper) { offtarget_List.push(benchling_gRNA_outputs.gene_list[current_gene][i]["Specificity Score"]); } } const Max_range = Math.max.apply(null, offtarget_List); const Min_optimal = Max_range - Max_range * 0.2; let optimalValue = Min_optimal; // Adjust for custom marking scheme const { studentClass } = student_reg_information[0].student_list[studentParseNum]; if (student_reg_information[0].classMarkingMod[studentClass][0] === "Optimal") { if (Min_optimal > 80 || Min_optimal < 35) { optimalValue = 80; } } else { optimalValue = student_reg_information[0].classMarkingMod[studentClass][0]; } // Assign degree based on score if (InputOffTargetValue >= optimalValue) { MAROffTarget_aboveOpt = true; MAROffTarget_above35 = true; MAROffTarget_degree = 1; } else if (InputOffTargetValue >= 35) { MAROffTarget_above35 = true; MAROffTarget_degree = (Math.max.apply(null, offtarget_List) < 80) ? 1 : 2; } } } // Usage: Called during answer checking checkOffTarget(75.5); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.