The function LocalAlignBestPam alternates between two different optimizations. Given a Match structure, it will call LocalAlign (to improve the local alignment) followed by a call to FindBestPam (to find the best PAM distance) until the similarity score no longer increases.
> DB := ReadDb('~cbrg/DB/SwissProt'): > CreateDayMatrices(): > m := Match(op(Sequence(Entry(8588))), op(Sequence(Entry(8577)))): > m := LocalAlignBestPam(m, DMS); > print(m); lengths=97,110 simil=275.3, PAM_dist=85.9883, offsets=5978923,5974267, identity=40.4%, similarity=12.3% ID=CY2_RHOVI AC=P00083; DE=CYTOCHROME C2 PRECURSOR. OS=RHODOPSEUDOMONAS VIRIDIS. RES=1.6 ID=CY22_RHOPA AC=P00091; DE=CYTOCHROME C2. OS=RHODOPSEUDOMONAS PALUSTRIS (STRAIN ATCC 17007 / 2.1.37). hhhhhhhthhhhtt tt tt tt hhhht hhhhhhhhh hhh QDAASGEQVFKQCLVCHSIGPGAKNKVGPVLNGLFGRHSGTIEGFAYSDANKNS___GITWTEEVFREYIRDPKA_____ |||.:||.|||||!.||. ..||.|||.|.|:.||.:||..||.||..|.|| |:.||.! . .|:.||.| QDAKAGEAVFKQCMTCHR___ADKNMVGPALGGVVGRKAGTAAGFTYSPLNHNSGEAGLVWTADNIINYLNDPNAFLKKF t tt hhhhhhhhhh _________KIPGTKMIFAGVKDEQKVSDLIAYI .!. |||.|. :.:||:..|:!||: LTDKGKADQAVGVTKMTFK_LANEQQRKDVVAYL
The results of a LocalAlignBestPam should be compared with a call to LocalAlign. Recall LocalAlign aligns at one particular PAM distance. Here we calculate it at PAM 250.
> ref := LocalAlign(m, DM); ref := Match(166.1,5978923,5974267,72,72,250,171.449) > print(ref); lengths=72,72 simil=166.1, PAM_dist=250, offsets=5978923,5974267, identity=49.3%, similarity=26.7% ID=CY2_RHOVI AC=P00083; DE=CYTOCHROME C2 PRECURSOR. OS=RHODOPSEUDOMONAS VIRIDIS. RES=1.6 ID=CY22_RHOPA AC=P00091; DE=CYTOCHROME C2. OS=RHODOPSEUDOMONAS PALUSTRIS (STRAIN ATCC 17007 / 2.1.37). hhhhhhhthhhhtt tt tt tt hhhht hhhhhhhhh hhh QDAASGEQVFKQCLVCHSIGPGAKNKVGPVLNGLFGRHSGTIEGFAYSDANKNSG___ITWTEEVFREYIRDPKA |||.:||.|||||!:||. :.||.|||:|:|::||::||..||:||..|:||| !:||.!.:.:|!:||:| QDAKAGEAVFKQCMTCHR___ADKNMVGPALGGVVGRKAGTAAGFTYSPLNHNSGEAGLVWTADNIINYLNDPNAThe similarity score is well over one hundred points lower and the alignment is approximately thirty bases shorter.