def runAlignment(pdb1, pdb2): Score = 0 length = -1 align = matt+' '+pdb_dir+pdb1+':'+pdb1[-5]+' '+pdb_dir+pdb2+':'+pdb2[-5] result = commands.getoutput(align) # Parse for the score and alignment length result = splitLines('MattAlignment.txt') Score = float(result[3][2]) length = float(result[1][2]) Score = Score / length # Remove output files toremove = 'MattAlignment.fasta MattAlignment.pdb MattAlignment.spt '+\ 'MattAlignment.txt' removed = commands.getoutput('rm '+toremove) # Return the Score return str(Score)
# Remove output files toremove = 'MattAlignment.fasta MattAlignment.pdb MattAlignment.spt '+\ 'MattAlignment.txt' removed = commands.getoutput('rm '+toremove) # Return the Score return str(Score) # End of runAlignment ### End of Functions ### ### Main ### print '\nRunning runMatt.py...' # Read in the .pdb file names pdbs = splitLines(sys.argv[1]) # Initialize distance matrix with zeros Score_matrix = [] for row in range( len(pdbs) ): Score_matrix.append([]) for col in range( len(pdbs) ): Score_matrix[row].append('0.0') maxval = -1.0 for A in range( len(pdbs) ): for B in range( len(pdbs) ): if(B < A): # Fill in matrix[A][B] and matrix[B][A] with RMSD value Score_matrix[A][B] = runAlignment(pdbs[A][0], pdbs[B][0]) Score_matrix[B][A] = Score_matrix[A][B]
#!/usr/bin/python # handleSeqTree.py # Handle all the business involved in produced the sequence-based phylogenetic # tree. Use pullSeqFromPDB.py to get all the needed .fa files. Then use # runClustal.sh to produce the newick tree file. # sys.argv[1] -- list of .pdb files import sys, os, commands from kmutils import fileToList, splitLines scripts = '/home/kylem/BIMM185/scripts/' files = splitLines( sys.argv[1] ) cat = 'cat ' for f in range( len(files) ): res = commands.getoutput( 'python '+scripts+'pullSeqFromPDB.py '+files[f][0] ) cat += files[f][0][:-4] + '.fa ' res = commands.getoutput( cat + ' > allseqs.fa' ) res = commands.getoutput( 'sh '+scripts+'runClustal.sh allseqs.fa seqtree' )