Midterm (Version B) Solutions Fall 2024
First-page document preview for Midterm (Version B) Solutions Fall 2024 in BME 501: Bioinformatics at Toronto Metropolitan University (TMU). Inspect the first page below or request the complete PDF study document for free.
Independent study archive Learn more
Materials are uploaded by users for self-study purposes. PwnHero is an independent platform, not affiliated with, sponsored by, or endorsed by any university or institution.
University
Toronto Metropolitan University (TMU)
Course
BME 501: Bioinformatics
Format
Midterm Exam
Year
2024
📄 Page 1 Preview
Page 1 Key Topics & Excerpt
🔍 Text Transcript
First page excerpt for quick study reference. Complete formulas, diagrams, and subsequent pages are available in the full document.
PwnHero
BME501/CPS501 Bioinformatics Midterm, Oct. 24, 2024 B
SOLUTIONS
Answer all questions on the question pages, right below the question. Time limit: 1 h 50 m
No aids of any kind, including no calculators. You can express values as fractions if necessary.
1. Algorithm and Python (5 points):
Write a function match_with_gap(seq1, seq2, gap_position) where seq1 and seq2 are DNA
sequences with seq2 being one base longer than seq1, and gap_position is an integer from 0 to
len(seq1), inclusive. The function returns True if a gap placed at gap_position in seq1 makes the
letters of seq1 line up perfectly with those of seq2, and False otherwise. For example,
match_with_gap(‘CATGAA’, ‘CATCGAA’, 3) would return True, since in the alignment:
CAT-GAA (where the gap is at position 3)
CATCGAA
the letters of seq1 line up perfectly with the letters of seq2 (thanks to the gap). In this examle, if the 3
were any other value, the function would return False.
def match_with_gap(seq1, seq2, gap_position) :
# code here
return seq1[0 : gap_position] == seq2[0 : gap_position] and seq1[gap_position:] ==
seq2[gap_position + 1 : ]
This could be coded as a loop in place of slices in the following way:
# first part
for i in range(0, gap_position) :
if seq1[i] != seq2[i] :
return False
# second part
for i in range(gap_position, len(seq1)) :
if seq1[i] != seq2[i+1] :
return False
# matched everwhere so ..
return True
PwnHero.com
More Popular Resources in BME 501: Bioinformatics
Midterm (Version A) Solutions Fall 2011
Midterm Exam • Page 1 Preview
Midterm Solutions Fall 2016
Midterm Exam • Page 1 Preview
Midterm Solutions Fall 2017
Midterm Exam • Page 1 Preview
Midterm Solutions Fall 2018
Midterm Exam • Page 1 Preview
Midterm Solutions Fall 2023
Midterm Exam • Page 1 Preview