def testMATLAB(self): sca = fromfile(pathDatafile('msa_Cys_knot_sca.dat')) expect = sca.reshape((10, 10)) fasta = FASTA[:, :10] result = buildSCAMatrix(fasta, turbo=True) assert_array_almost_equal(expect, result, err_msg='turbo failed') result = buildSCAMatrix(fasta, turbo=False) assert_array_almost_equal(expect, result, err_msg='w/out turbo failed')
def testMATLAB(self): sca = fromfile(pathDatafile("msa_Cys_knot_sca.dat")) expect = sca.reshape((10, 10)) fasta = FASTA[:, :10] result = buildSCAMatrix(fasta, turbo=True) assert_array_almost_equal(expect, result, err_msg="turbo failed") result = buildSCAMatrix(fasta, turbo=False) assert_array_almost_equal(expect, result, err_msg="w/out turbo failed")
def testZero(self): msa = array([list("ACCD"), list("ACDD"), list("ACCC"), list("ACDC")], dtype="|S1") expect = array([log(0.975 / 0.025) * 0.5, log(0.95 / 0.05) * 0.5]) weight = ((expect ** 2).sum()) ** 0.5 expect = expect / weight * array([log(0.975 / 0.025), log(0.95 / 0.05)]) expect = (expect ** 2).mean() - (expect.mean()) ** 2 expect = array([[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, expect, 0.0], [0.0, 0.0, 0.0, expect]]) result = buildSCAMatrix(msa) assert_array_almost_equal(expect, result, err_msg="turbo failed") result = buildSCAMatrix(msa, turbo=False) assert_array_almost_equal(expect, result, err_msg="w/out turbo failed")
def testZero(self): msa = array([list('ACCD'), list('ACDD'), list('ACCC'), list('ACDC')], dtype='|S1') expect = array([log(0.975 / .025) * .5, log(0.95 / .05) * .5]) weight = ((expect**2).sum())**.5 expect = expect / weight * array([log(0.975 / .025), log(0.95 / .05)]) expect = (expect**2).mean() - (expect.mean())**2 expect = array([ [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., expect, 0.], [0., 0., 0., expect], ]) result = buildSCAMatrix(msa) assert_array_almost_equal(expect, result, err_msg='turbo failed') result = buildSCAMatrix(msa, turbo=False) assert_array_almost_equal(expect, result, err_msg='w/out turbo failed')
import prody.sequence as sequence import prody import matplotlib.pyplot as plt alignment = prody.MSAFile("pkinase.fasta") #get positions -> by hand for now positions = [72, 83, 117, 119, 194, 251, 354, 355, 357, 429, 432] #user alignSequenceToMSA instead to derive positions automatically #set up webservice to get correspondance between MSA position and a particular PDB structure alignment.setSlice(positions) prody.writeMSA("test.fasta", alignment) pa = prody.parseMSA("pocket_type1.fasta") labs = pa.getLabels() seqidmatrix = prody.buildSeqidMatrix(pa) scamatrix = prody.buildSCAMatrix(pa) tree = prody.calcTree(names=labs, distance_matrix=seqidmatrix) plt.figure() show = prody.showTree(tree, format='plt')