SlideShare a Scribd company logo
1 of 18
Homework Assignment 3: Chapter 3
St. Clair & Visick
, Putting your skills into practice, problem 5
Tuesday, October 28
Homework Assignment 3 will be due Tuesday, November 4.
What changes are needed to construct a semi-global alignment
like in the third homework assignment? The global alignment
works pretty well on sequences that are nearly the same length.
Let's try another example where the sequence lengths are more
disparate.
$ ruby global.rb -d cgctatag cta
Dynamic programming table:
|
|
c
|
g
|
c
|
t
|
a
|
t
|
a
|
g
|
----+------+------+------+------+------+------+------+------+------+
|
|
|
|
|
|
|
|
|
|
|
0 |<
-1 |<
-2 |<
-3 |<
-4 |<
-5 |<
-6 |<
-7 |<
-8 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
|
|
|
|
|
|
|
|
c
|
-1 |
1 |<
0 |<
-1 |<
-2 |<
-3 |<
-4 |<
-5 |<
-6 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
^ |
|
|
|
|
|
|
|
t
|
-2 |
0 |
1 |<
0 |
0 |<
-1 |<
-2 |<
-3 |<
-4 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
^ |
^ |
|
|
|
|
|
|
a
|
-3 |
-1 |
0 |
1 |<
0 |
1 |<
0 |<
-1 |<
-2 |
----+------+------+------+------+------+------+------+------+------+
Alignment 1
cgctatag
__c__ta_
Alignment 2
cgctatag
c____ta_
Alignment 3
cgctatag
__ct__a_
Alignment 4
cgctatag
c__t__a_
Alignment 5
cgctatag
__cta___
Alignment 6
cgctatag
c__ta___
The 5th alignment really looks better here even though they all
6 scored the same -2. The problem is that terminal gaps are
scored the same as internal gaps. If we are trying to see if a
short sequence lines up best with a similar sized piece that is
somewhere inside the longer sequence, internal gaps need to
have a larger penalty than terminal gaps. If the terminal gap
penalty was reduced to
0
while the other scoring stayed the same, that should get the
desired result where the 5th alignment is clearly the best with a
score of
3
. Simply modifying how the global alignment program fills in
the outside rows and columns of the dynamic programming
table should be all that is required to do a semi-global
alignment.
$ ruby semi-global.rb -d cgctatag cta
Dynamic programming table:
|
|
C
|
G
|
C
|
T
|
A
|
T
|
A
|
G
|
----+------+------+------+------+------+------+------+------+------+
|
|
|
|
|
|
|
|
|
|
|
0 |<
0 |<
0 |<
0 |<
0 |<
0 |<
0 |<
0 |<
0 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
|
|
|
|
|
|
|
^ |
C
|
0 |
1 |<
0 |
1 |<
0 |
0 |
0 |
0 |
0 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
^ |
|
^ |
|
|
|
|
^ |
T
|
0 |
0 |
1 |<
0 |
2 |<
1 |
1 |<
0 |
0 |
----+------+------+------+------+------+------+------+------+------+
|
^ |
|
^ |
|
^ |
|
|
|
|
A
|
0 |<
0 |<
0 |
1 |<
1 |
3 |<
3 |<
3 |<
3 |
----+------+------+------+------+------+------+------+------+------+
Alignment 1
Sequence 1 0001 CGCTATAG
|||
Sequence 2 0001 __CTA___
For Second part on Homework Assignment 3, add numbers to
make longer alignments more readable something like this:
$ ruby semi-global.rb acalifornia2009.fasta
acalifornia2009m1.fasta
Alignment 1
Sequence 1 0001
TAGATATTAAAGATGAGTCTTCTAACCGAGGTCGAAACGT
ACGTTCTTTCTATCATCCCG
||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0001
____________ATGAGTCTTCTAACCGAGGTCGAAACGTAC
GTTCTTTCTATCATCCCG
Sequence 1 0061
TCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTGGAA
AGTGTCTTTGCAGGAAAGAAC
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0049
TCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTGGAA
AGTGTCTTTGCAGGAAAGAAC
Sequence 1 0121
ACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGA
CCAATCTTGTCACCTCTGACT
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0109
ACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGA
CCAATCTTGTCACCTCTGACT
Sequence 1 0181
AAGGGAATTTTAGGATTTGTGTTCACGCTCACCGTGCCCA
GTGAGCGAGGACTGCAGCGT
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0169
AAGGGAATTTTAGGATTTGTGTTCACGCTCACCGTGCCCA
GTGAGCGAGGACTGCAGCGT
Sequence 1 0241
AGACGCTTTGTCCAAAATGCCCTAAATGGGAATGGGGAC
CCGAACAACATGGATAGAGCA
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0229
AGACGCTTTGTCCAAAATGCCCTAAATGGGAATGGGGAC
CCGAACAACATGGATAGAGCA
Sequence 1 0301
GTTAAACTATACAAGAAGCTCAAAAGAGAAATAACGTTC
CATGGGGCCAAGGAGGTGTCA
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0289
GTTAAACTATACAAGAAGCTCAAAAGAGAAATAACGTTC
CATGGGGCCAAGGAGGTGTCA
Sequence 1 0361
CTAAGCTATTCAACTGGTGCACTTGCCAGTTGCATGGGCC
TCATATACAACAGGATGGGA
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0349
CTAAGCTATTCAACTGGTGCACTTGCCAGTTGCATGGGCC
TCATATACAACAGGATGGGA
Sequence 1 0421
ACAGTGACCACAGAAGCTGCTTTTGGTCTAGTGTGTGCCA
CTTGTGAACAGATTGCTGAT
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0409
ACAGTGACCACAGAAGCTGCTTTTGGTCTAGTGTGTGCCA
CTTGTGAACAGATTGCTGAT
Sequence 1 0481
TCACAGCATCGGTCTCACAGACAGATGGCTACTACCACCA
ATCCACTAATCAGGCATGAA
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0469
TCACAGCATCGGTCTCACAGACAGATGGCTACTACCACCA
ATCCACTAATCAGGCATGAA
Sequence 1 0541
AACAGAATGGTGCTGGCTAGCACTACGGCAAAGGCTATG
GAACAGATGGCTGGATCGAGT
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0529
AACAGAATGGTGCTGGCTAGCACTACGGCAAAGGCTATG
GAACAGATGGCTGGATCGAGT
Sequence 1 0601
GAACAGGCAGCGGAGGCCATGGAGGTTGCTAATCAGACT
AGGCAGATGGTACATGCAATG
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0589
GAACAGGCAGCGGAGGCCATGGAGGTTGCTAATCAGACT
AGGCAGATGGTACATGCAATG
Sequence 1 0661
AGAACTATTGGGACTCATCCTAGCTCCAGTGCTGGTCTGA
AAGATGACCTTCTTGAAAAT
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0649
AGAACTATTGGGACTCATCCTAGCTCCAGTGCTGGTCTGA
AAGATGACCTTCTTGAAAAT
Sequence 1 0721
TTGCAGGCCTACCAGAAGCGAATGGGAGTGCAGATGCAG
CGATTCAAGTGATCCTCTCGT
|||||||||||||||||||||||||||||||||||||||||||||||||||
Sequence 2 0709
TTGCAGGCCTACCAGAAGCGAATGGGAGTGCAGATGCAG
CGATTCAAGTGA_________
Sequence 1 0781
CATTGCAGCAAATATCATTGGGATCTTGCACCTGATATTG
TGGATTACTGATCGTCTTTT
Sequence 2 0760
_____________________________________________________
_______
Sequence 1 0841
TTTCAAATGTATTTATCGTCGCTTTAAATACGGTTTGAAA
AGAGGGCCTTCTACGGAAGG
Sequence 2 0760
_____________________________________________________
_______
Sequence 1 0901
AGTGCCTGAGTCCATGAGGGAAGAATATCAACAGGAACA
GCAGAGTGCTGTGGATGTTGA
Sequence 2 0760
_____________________________________________________
_______
Sequence 1 0961
CGATGGTCATTTTGTCAACATAGAGCTAGAGTAAAAAACT
AC
Sequence 2 0760
__________________________________________
From global to local by comparing the recursion functions:
Comments on early submissions:
score = (0..last_row).inject([]) {|s,e| s << [(e == 0
? e:e = 0) * Sigma]}
# This might work by accident but is very unclear.
# If what you want to say with the ternary operator is the score
is 0
# in the first column then you don't need the ternary operator at
all
# s << [0]
# I suppose you could use
# s << [(e == 0 ? e : 0)*Sigma]
# but it is redundant.
# Putting an assignment inside a ternary operator is a bad idea.
# If you really need to allow a side effect like that then perhaps
# you should use a short cut logical operator like &&.
From
# the standpoint of clear, functional programming even this is a
kludge.

More Related Content

Similar to Homework Assignment 3 Chapter 3 St. Clair & Visick, Putting you.docx

Metadata Matters
Metadata MattersMetadata Matters
Metadata Matters
afa reg
 

Similar to Homework Assignment 3 Chapter 3 St. Clair & Visick, Putting you.docx (20)

Optimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsOptimizing Queries Using Window Functions
Optimizing Queries Using Window Functions
 
Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Dr...
Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Dr...Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Dr...
Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Dr...
 
Application Performance Monitoring in Distributed Applications
Application Performance Monitoring in Distributed ApplicationsApplication Performance Monitoring in Distributed Applications
Application Performance Monitoring in Distributed Applications
 
MySQL Functions
MySQL FunctionsMySQL Functions
MySQL Functions
 
Chemlb27
Chemlb27Chemlb27
Chemlb27
 
Using Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query PerformanceUsing Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query Performance
 
Building advanced data-driven applications
Building advanced data-driven applicationsBuilding advanced data-driven applications
Building advanced data-driven applications
 
Functional Database Strategies
Functional Database StrategiesFunctional Database Strategies
Functional Database Strategies
 
Window functions in MariaDB 10.2
Window functions in MariaDB 10.2Window functions in MariaDB 10.2
Window functions in MariaDB 10.2
 
Rfc 3412
Rfc 3412Rfc 3412
Rfc 3412
 
MariaDB: ANALYZE for statements (lightning talk)
MariaDB:  ANALYZE for statements (lightning talk)MariaDB:  ANALYZE for statements (lightning talk)
MariaDB: ANALYZE for statements (lightning talk)
 
M|18 User Defined Function
M|18 User Defined FunctionM|18 User Defined Function
M|18 User Defined Function
 
Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.
 
The two little bugs that almost brought down Booking.com
The two little bugs that almost brought down Booking.comThe two little bugs that almost brought down Booking.com
The two little bugs that almost brought down Booking.com
 
Randolf Geist – IT-Tage 2015 – Oracle Parallel Execution – Analyse und Troubl...
Randolf Geist – IT-Tage 2015 – Oracle Parallel Execution – Analyse und Troubl...Randolf Geist – IT-Tage 2015 – Oracle Parallel Execution – Analyse und Troubl...
Randolf Geist – IT-Tage 2015 – Oracle Parallel Execution – Analyse und Troubl...
 
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 
The Current State of Table API in 2022
The Current State of Table API in 2022The Current State of Table API in 2022
The Current State of Table API in 2022
 
Metadata Matters
Metadata MattersMetadata Matters
Metadata Matters
 
Storing metrics at scale with Gnocchi
Storing metrics at scale with GnocchiStoring metrics at scale with Gnocchi
Storing metrics at scale with Gnocchi
 

More from fideladallimore

I had started the paper but have no time to finish.Please help.docx
I had started the paper but have no time to finish.Please help.docxI had started the paper but have no time to finish.Please help.docx
I had started the paper but have no time to finish.Please help.docx
fideladallimore
 
I have 3 posts from class I need someone to read them and ague which.docx
I have 3 posts from class I need someone to read them and ague which.docxI have 3 posts from class I need someone to read them and ague which.docx
I have 3 posts from class I need someone to read them and ague which.docx
fideladallimore
 
I choose Energy source of Human This is my topic.You have to put.docx
I choose Energy source of Human This is my topic.You have to put.docxI choose Energy source of Human This is my topic.You have to put.docx
I choose Energy source of Human This is my topic.You have to put.docx
fideladallimore
 
I am trying to do use two bluetooth modules to control an LEDs.  I a.docx
I am trying to do use two bluetooth modules to control an LEDs.  I a.docxI am trying to do use two bluetooth modules to control an LEDs.  I a.docx
I am trying to do use two bluetooth modules to control an LEDs.  I a.docx
fideladallimore
 
i am taking  camp 1 online I need some one to help me with itthe p.docx
i am taking  camp 1 online I need some one to help me with itthe p.docxi am taking  camp 1 online I need some one to help me with itthe p.docx
i am taking  camp 1 online I need some one to help me with itthe p.docx
fideladallimore
 

More from fideladallimore (20)

I had started the paper but have no time to finish.Please help.docx
I had started the paper but have no time to finish.Please help.docxI had started the paper but have no time to finish.Please help.docx
I had started the paper but have no time to finish.Please help.docx
 
I have 3 posts from class I need someone to read them and ague which.docx
I have 3 posts from class I need someone to read them and ague which.docxI have 3 posts from class I need someone to read them and ague which.docx
I have 3 posts from class I need someone to read them and ague which.docx
 
I have 4 chapters worth of Operations Management homework.It needs.docx
I have 4 chapters worth of Operations Management homework.It needs.docxI have 4 chapters worth of Operations Management homework.It needs.docx
I have 4 chapters worth of Operations Management homework.It needs.docx
 
i have 3 papers due on Thursday for my philosophy class. The papers .docx
i have 3 papers due on Thursday for my philosophy class. The papers .docxi have 3 papers due on Thursday for my philosophy class. The papers .docx
i have 3 papers due on Thursday for my philosophy class. The papers .docx
 
i have 2 test on Tuesday at 3 pm and i have another one at 430 it.docx
i have 2 test on Tuesday at 3 pm and i have another one at 430 it.docxi have 2 test on Tuesday at 3 pm and i have another one at 430 it.docx
i have 2 test on Tuesday at 3 pm and i have another one at 430 it.docx
 
i have 2 assignmets will be today 1- Focus on Web Design IIT.docx
i have 2 assignmets will be today 1- Focus on Web Design IIT.docxi have 2 assignmets will be today 1- Focus on Web Design IIT.docx
i have 2 assignmets will be today 1- Focus on Web Design IIT.docx
 
I got a scholarship to study civil engineering so they asked me to w.docx
I got a scholarship to study civil engineering so they asked me to w.docxI got a scholarship to study civil engineering so they asked me to w.docx
I got a scholarship to study civil engineering so they asked me to w.docx
 
I composed an experiment with different materials (metals and non-me.docx
I composed an experiment with different materials (metals and non-me.docxI composed an experiment with different materials (metals and non-me.docx
I composed an experiment with different materials (metals and non-me.docx
 
I have 5 page paper due tomorrow. Basically its a concert report so .docx
I have 5 page paper due tomorrow. Basically its a concert report so .docxI have 5 page paper due tomorrow. Basically its a concert report so .docx
I have 5 page paper due tomorrow. Basically its a concert report so .docx
 
I choose Energy source of Human This is my topic.You have to put.docx
I choose Energy source of Human This is my topic.You have to put.docxI choose Energy source of Human This is my topic.You have to put.docx
I choose Energy source of Human This is my topic.You have to put.docx
 
I am wiiling to pay $10.00 I just need these discussion questions an.docx
I am wiiling to pay $10.00 I just need these discussion questions an.docxI am wiiling to pay $10.00 I just need these discussion questions an.docx
I am wiiling to pay $10.00 I just need these discussion questions an.docx
 
I am taking a class its the managing information and databse i am lo.docx
I am taking a class its the managing information and databse i am lo.docxI am taking a class its the managing information and databse i am lo.docx
I am taking a class its the managing information and databse i am lo.docx
 
I am trying to teach my dog Fido to sit. Everytime he sits, I give h.docx
I am trying to teach my dog Fido to sit. Everytime he sits, I give h.docxI am trying to teach my dog Fido to sit. Everytime he sits, I give h.docx
I am trying to teach my dog Fido to sit. Everytime he sits, I give h.docx
 
I am trying to do use two bluetooth modules to control an LEDs.  I a.docx
I am trying to do use two bluetooth modules to control an LEDs.  I a.docxI am trying to do use two bluetooth modules to control an LEDs.  I a.docx
I am trying to do use two bluetooth modules to control an LEDs.  I a.docx
 
i am taking  camp 1 online I need some one to help me with itthe p.docx
i am taking  camp 1 online I need some one to help me with itthe p.docxi am taking  camp 1 online I need some one to help me with itthe p.docx
i am taking  camp 1 online I need some one to help me with itthe p.docx
 
I am responsible for this one bullet that is highlighted in pink as .docx
I am responsible for this one bullet that is highlighted in pink as .docxI am responsible for this one bullet that is highlighted in pink as .docx
I am responsible for this one bullet that is highlighted in pink as .docx
 
I am new to this site.. I was on Student of Fortune until they clo.docx
I am new to this site.. I was on Student of Fortune until they clo.docxI am new to this site.. I was on Student of Fortune until they clo.docx
I am new to this site.. I was on Student of Fortune until they clo.docx
 
I am looking for you to go a bit deeper in Section Three, and work t.docx
I am looking for you to go a bit deeper in Section Three, and work t.docxI am looking for you to go a bit deeper in Section Three, and work t.docx
I am looking for you to go a bit deeper in Section Three, and work t.docx
 
I am looking for a Power Point Presentation about ISIS ,,, Including.docx
I am looking for a Power Point Presentation about ISIS ,,, Including.docxI am looking for a Power Point Presentation about ISIS ,,, Including.docx
I am looking for a Power Point Presentation about ISIS ,,, Including.docx
 
I am looking for 75 words a piece for each questions1.  What d.docx
I am looking for 75 words a piece for each questions1.  What d.docxI am looking for 75 words a piece for each questions1.  What d.docx
I am looking for 75 words a piece for each questions1.  What d.docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 

Homework Assignment 3 Chapter 3 St. Clair & Visick, Putting you.docx

  • 1. Homework Assignment 3: Chapter 3 St. Clair & Visick , Putting your skills into practice, problem 5 Tuesday, October 28 Homework Assignment 3 will be due Tuesday, November 4. What changes are needed to construct a semi-global alignment like in the third homework assignment? The global alignment works pretty well on sequences that are nearly the same length. Let's try another example where the sequence lengths are more disparate. $ ruby global.rb -d cgctatag cta Dynamic programming table: | | c | g | c | t | a
  • 3. | 0 |< -1 |< -2 |< -3 |< -4 |< -5 |< -6 |< -7 |< -8 | ----+------+------+------+------+------+------+------+------+------+ | ^ | | | | | | |
  • 4. | | c | -1 | 1 |< 0 |< -1 |< -2 |< -3 |< -4 |< -5 |< -6 | ----+------+------+------+------+------+------+------+------+------+ | ^ | ^ | |
  • 5. | | | | | | t | -2 | 0 | 1 |< 0 | 0 |< -1 |< -2 |< -3 |< -4 | ----+------+------+------+------+------+------+------+------+------+ |
  • 6. ^ | ^ | ^ | | | | | | | a | -3 | -1 | 0 | 1 |< 0 | 1 |< 0 |<
  • 7. -1 |< -2 | ----+------+------+------+------+------+------+------+------+------+ Alignment 1 cgctatag __c__ta_ Alignment 2 cgctatag c____ta_ Alignment 3 cgctatag __ct__a_ Alignment 4 cgctatag c__t__a_ Alignment 5 cgctatag __cta___ Alignment 6 cgctatag c__ta___ The 5th alignment really looks better here even though they all 6 scored the same -2. The problem is that terminal gaps are scored the same as internal gaps. If we are trying to see if a short sequence lines up best with a similar sized piece that is somewhere inside the longer sequence, internal gaps need to have a larger penalty than terminal gaps. If the terminal gap penalty was reduced to 0 while the other scoring stayed the same, that should get the desired result where the 5th alignment is clearly the best with a score of 3 . Simply modifying how the global alignment program fills in
  • 8. the outside rows and columns of the dynamic programming table should be all that is required to do a semi-global alignment. $ ruby semi-global.rb -d cgctatag cta Dynamic programming table: | | C | G | C | T | A | T | A |
  • 10. 0 |< 0 |< 0 |< 0 | ----+------+------+------+------+------+------+------+------+------+ | ^ | | | | | | | | ^ | C | 0 | 1 |< 0 |
  • 11. 1 |< 0 | 0 | 0 | 0 | 0 | ----+------+------+------+------+------+------+------+------+------+ | ^ | ^ | | ^ | | | | | ^ | T |
  • 12. 0 | 0 | 1 |< 0 | 2 |< 1 | 1 |< 0 | 0 | ----+------+------+------+------+------+------+------+------+------+ | ^ | | ^ | | ^ | | | |
  • 13. | A | 0 |< 0 |< 0 | 1 |< 1 | 3 |< 3 |< 3 |< 3 | ----+------+------+------+------+------+------+------+------+------+ Alignment 1 Sequence 1 0001 CGCTATAG ||| Sequence 2 0001 __CTA___ For Second part on Homework Assignment 3, add numbers to make longer alignments more readable something like this: $ ruby semi-global.rb acalifornia2009.fasta acalifornia2009m1.fasta Alignment 1 Sequence 1 0001 TAGATATTAAAGATGAGTCTTCTAACCGAGGTCGAAACGT ACGTTCTTTCTATCATCCCG
  • 14. |||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0001 ____________ATGAGTCTTCTAACCGAGGTCGAAACGTAC GTTCTTTCTATCATCCCG Sequence 1 0061 TCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTGGAA AGTGTCTTTGCAGGAAAGAAC |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0049 TCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTGGAA AGTGTCTTTGCAGGAAAGAAC Sequence 1 0121 ACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGA CCAATCTTGTCACCTCTGACT |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0109 ACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGA CCAATCTTGTCACCTCTGACT Sequence 1 0181 AAGGGAATTTTAGGATTTGTGTTCACGCTCACCGTGCCCA GTGAGCGAGGACTGCAGCGT |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0169 AAGGGAATTTTAGGATTTGTGTTCACGCTCACCGTGCCCA GTGAGCGAGGACTGCAGCGT Sequence 1 0241 AGACGCTTTGTCCAAAATGCCCTAAATGGGAATGGGGAC CCGAACAACATGGATAGAGCA
  • 15. |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0229 AGACGCTTTGTCCAAAATGCCCTAAATGGGAATGGGGAC CCGAACAACATGGATAGAGCA Sequence 1 0301 GTTAAACTATACAAGAAGCTCAAAAGAGAAATAACGTTC CATGGGGCCAAGGAGGTGTCA |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0289 GTTAAACTATACAAGAAGCTCAAAAGAGAAATAACGTTC CATGGGGCCAAGGAGGTGTCA Sequence 1 0361 CTAAGCTATTCAACTGGTGCACTTGCCAGTTGCATGGGCC TCATATACAACAGGATGGGA |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0349 CTAAGCTATTCAACTGGTGCACTTGCCAGTTGCATGGGCC TCATATACAACAGGATGGGA Sequence 1 0421 ACAGTGACCACAGAAGCTGCTTTTGGTCTAGTGTGTGCCA CTTGTGAACAGATTGCTGAT |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0409 ACAGTGACCACAGAAGCTGCTTTTGGTCTAGTGTGTGCCA CTTGTGAACAGATTGCTGAT Sequence 1 0481 TCACAGCATCGGTCTCACAGACAGATGGCTACTACCACCA ATCCACTAATCAGGCATGAA
  • 16. |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0469 TCACAGCATCGGTCTCACAGACAGATGGCTACTACCACCA ATCCACTAATCAGGCATGAA Sequence 1 0541 AACAGAATGGTGCTGGCTAGCACTACGGCAAAGGCTATG GAACAGATGGCTGGATCGAGT |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0529 AACAGAATGGTGCTGGCTAGCACTACGGCAAAGGCTATG GAACAGATGGCTGGATCGAGT Sequence 1 0601 GAACAGGCAGCGGAGGCCATGGAGGTTGCTAATCAGACT AGGCAGATGGTACATGCAATG |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0589 GAACAGGCAGCGGAGGCCATGGAGGTTGCTAATCAGACT AGGCAGATGGTACATGCAATG Sequence 1 0661 AGAACTATTGGGACTCATCCTAGCTCCAGTGCTGGTCTGA AAGATGACCTTCTTGAAAAT |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0649 AGAACTATTGGGACTCATCCTAGCTCCAGTGCTGGTCTGA AAGATGACCTTCTTGAAAAT Sequence 1 0721 TTGCAGGCCTACCAGAAGCGAATGGGAGTGCAGATGCAG CGATTCAAGTGATCCTCTCGT
  • 17. ||||||||||||||||||||||||||||||||||||||||||||||||||| Sequence 2 0709 TTGCAGGCCTACCAGAAGCGAATGGGAGTGCAGATGCAG CGATTCAAGTGA_________ Sequence 1 0781 CATTGCAGCAAATATCATTGGGATCTTGCACCTGATATTG TGGATTACTGATCGTCTTTT Sequence 2 0760 _____________________________________________________ _______ Sequence 1 0841 TTTCAAATGTATTTATCGTCGCTTTAAATACGGTTTGAAA AGAGGGCCTTCTACGGAAGG Sequence 2 0760 _____________________________________________________ _______ Sequence 1 0901 AGTGCCTGAGTCCATGAGGGAAGAATATCAACAGGAACA GCAGAGTGCTGTGGATGTTGA Sequence 2 0760 _____________________________________________________ _______ Sequence 1 0961 CGATGGTCATTTTGTCAACATAGAGCTAGAGTAAAAAACT AC
  • 18. Sequence 2 0760 __________________________________________ From global to local by comparing the recursion functions: Comments on early submissions: score = (0..last_row).inject([]) {|s,e| s << [(e == 0 ? e:e = 0) * Sigma]} # This might work by accident but is very unclear. # If what you want to say with the ternary operator is the score is 0 # in the first column then you don't need the ternary operator at all # s << [0] # I suppose you could use # s << [(e == 0 ? e : 0)*Sigma] # but it is redundant. # Putting an assignment inside a ternary operator is a bad idea. # If you really need to allow a side effect like that then perhaps # you should use a short cut logical operator like &&. From # the standpoint of clear, functional programming even this is a kludge.