MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Sukrit on 18 Jun 2013

Hi,

I have a large number of 30 base pair DNA sequences and I'm trying to get all pairwise alignments between them. I'm not interested in the score of the alignment so I made up a simple scoring matrix that allows me to count how many mismatches there are given the best alignment. I tried a couple things as sanity check, and now I'm not sure what's going on anymore. Essentially, I tried to align two sequences that are offset by one base. However, all the alignment functions in MATLAB that I have tried (nwalign, swalign, localalign) fail to see this and report that there are 12 mismatches between the sequences instead of 1. I've included the code for the test case below. What am I screwing up? Much appreciated..

%if true a = 'AGTCAGTCAGTC'; b = 'GTCAGTCAGTCA'; mat = [0,1,1,1; 1,0,1,1; 1,1,0,1; 1,1,1,0]; nwalign(a,b,'alphabet','nt','scoringmatrix',mat,'gapopen',1) %end

*No products are associated with this question.*

## 1 Comment

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/79436#comment_156437

Did I understand you correctly that you are seeing 12 mismatches when you are using a default scoring matrix? If I use for example this code

I only see one mismatch in the output of y.