Created
July 18, 2014 01:25
-
-
Save yukimya/2d0302a75a483db83c23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GPL v 3.0 | |
# script name: maxmin.py | |
# written by Naoyuki Miyashita on 12/20/2013 | |
# Naoyuki Miyashita (c) 2013 | |
# | |
#----------------------------------- | |
# Use lProam, pylab, numpy | |
#----------------------------------- | |
# ussage: | |
# python maxmin.py filename.pdb ¨selection¨ | |
#----------------------------------- | |
# Please use prody selection rules in the atom selections. | |
# | |
from pylab import * | |
import numpy as np | |
import scipy as sp | |
import lProam | |
from prody import * | |
from matplotlib import pyplot as plt | |
from scipy import stats | |
# | |
def argv_read(): | |
filename = sys.argv[1] | |
sele = sys.argv[2] | |
argv_array=(filename,sele) | |
return(argv_array) | |
def translation(filename,sele): | |
# read and setup pdb | |
pdb = lProam.file_read(filename) | |
# key coords | |
pdb_idx = pdb.copy() | |
pdb_sele = pdb_idx.select(sele) | |
print pdb_sele | |
pdb_coord = pdb_sele.getCoords() | |
print pdb_coord | |
xara=np.array([]) | |
yara=np.array([]) | |
zara=np.array([]) | |
# | |
xara=pdb_coord[:,0] | |
yara=pdb_coord[:,1] | |
zara=pdb_coord[:,2] | |
#print xara | |
# | |
min_x = np.amin(xara) | |
min_y = np.amin(yara) | |
min_z = np.amin(zara) | |
max_x = np.amax(xara) | |
max_y = np.amax(yara) | |
max_z = np.amax(zara) | |
center_x = (max_x + min_x)*0.5 | |
center_y = (max_y + min_y)*0.5 | |
center_z = (max_z + min_z)*0.5 | |
size_x = max_x - min_x | |
size_y = max_y - min_y | |
size_z = max_z - min_z | |
print "=== MaxMin ========" | |
print "min (x,y,z) = ",min_x, min_y, min_z | |
print "max (x,y,z) = ",max_x, max_y, max_z | |
print "size (x,y,z) = ",size_x, size_y, size_z | |
print "center (x,y,z) = ",center_x, center_y, center_z | |
print "-------------------" | |
return () | |
def main_calc(): | |
#input | |
argv_array=argv_read() | |
(filename,sele)=argv_array | |
# | |
translation(filename,sele) | |
# | |
return() | |
if __name__ == '__main__': | |
main_calc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment