Reputation: 11
in Mathematica's option SimilarityRules http://reference.wolfram.com/mathematica/ref/SimilarityRules.html for SequenceAlignment http://reference.wolfram.com/mathematica/ref/SequenceAlignment.html is a possibility of pushing simmilarity matrix - like "BLAST" "BLOSUM62" "BLOSUM80" "PAM30" "PAM70" "PAM250". What if I want to use my own ones? Do I have to define it with {{a_,a_}->1,{a_,b_}->-1} etc for each combination of letters?? or is there any possibility of writing my own and storing it as a matrix, than importing it? What is the quickest option of defining such object using mathematica's matrices?
Any help will be appreciated,
Cheers, m.
Upvotes: 0
Views: 104
Reputation: 7946
I did a grep on 'BLOSUM' (one of the named similarity rules matrices) to see where it's defined and in hope of discovering the mechanism for its implementation. What I found is that it seems to be defined in a file called SimilarityScoreMatrices.mx, which is a binary Mathematica file, roughly equivalent to an object file in a compiled language. I also looked for files with "BLOSUM' in it but found none. All this is to say that it looks like Wolfram did not intend for these names to be extended, since if they did the mechanism would probably discoverable in the documentation or at least by the kind of hunting I did.
However, you can still do what you want. If you build your rules list, you can use DumpSave[] to write it to a binary image, and use Get[] to read them back.
One final note, the SimilarityRules look an awful lot like Mathematica's SparseArray rules. I wouldn't be too surprised to find that the named similarity rules matrices are actually just SparseArrays. It might be that you're not losing any efficiency passing the rules in over what Mathematica is doing with the matrices. It MIGHT even be that you can pass in a SpareArray, but it isn't documented that way and I haven't tried it.
Upvotes: 1