MATLAB: How to use a custom scoring matrix with the NWALIGN function in Bioinformatics Toolbox 3.1 (R2008a)

Bioinformatics Toolboxblosumswalign

I see that the NWALIGN function takes a parameter-value pair,
[Score, Alignment, Start] = nwalign(Seq1,Seq2)
... = nwalign(Seq1,Seq2, ...'ScoringMatrix', ScoringMatrixValue, ...)
However, the documentation states that ScoringMatrixValue must be a string chosen from a list of predefined scoring matrices. I would like to use a custom scoring matrix with the function.

Best Answer

As of MATLAB 7.8 (R2009a), it is possible to pass a custom scoring matrix to NWALIGN using the 'ScoringMatrix' option of the NWALIGN function. The argument 'ScoringMatrixValue' can either be an actual scoring matrix passed to the function or the name of a function that returns a scoring matrix when called. For example, the following call to NWALIGN will use the custom matrix defined in variable "mysmat"
mysmat = eye(24);
score = nwalign('ACGT', 'ACCT', 'ScoringMatrix', mysmat);
Prior to MATLAB 7.8 (R2009a), there are no workarounds.