Created
July 18, 2014 01:15
-
-
Save yukimya/6b6148d9a385896bb00e 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: getSegment.py | |
# written by Naoyuki Miyashita on 1/06/2014 | |
# Naoyuki Miyashita (c) 2014 | |
# | |
#----------------------------------- | |
# Use lProam, pylab, numpy | |
#----------------------------------- | |
# ussage: | |
# setupTMDimerPosition.py input.pdb output.pdb distance \ | |
# "center: selection" \ | |
# "upper or lower center: selection" \ | |
# "interface: selection" \ | |
# alpha_angle rho1_angle | |
#----------------------------------- | |
# 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] | |
outfile = sys.argv[2] | |
seg = sys.argv[3] | |
key = sys.argv[4] | |
num = int(sys.argv[5]) | |
argv_array=(filename,outfile,seg,key,num) | |
return(argv_array) | |
def translation(filename,outfile,seg,key,num): | |
# read and setup pdb | |
pdb = lProam.file_read(filename) | |
# key coords | |
pdb_idx = pdb.copy() | |
pdb_sel = pdb_idx.select(seg) | |
if key == "reset": | |
resnum = pdb_sel.getResnums() | |
print resnum | |
resmax = np.amax(resnum) | |
resmin = np.amin(resnum) | |
diff = resmax - resmin + 1 | |
resnum = resnum - resmin +1 + num | |
#resnum = resnum - resmin + 1 | |
pdb_sel.setResnums(resnum) | |
elif key == "wreset": | |
resnum = pdb_sel.getResnums() | |
nlen = len(resnum) | |
print resnum,nlen | |
resnum1 = range(1,nlen) | |
print resnum1 | |
pdb_sel.setResnums(resnum1) | |
#pdb_sel = pdb_idx.select('segment WA') | |
# | |
lProam.file_write(outfile,pdb_sel) | |
return () | |
def main_calc(): | |
#input | |
argv_array=argv_read() | |
(filename,outfile,seg,key,num)=argv_array | |
# | |
translation(filename,outfile,seg,key,num) | |
# | |
return() | |
if __name__ == '__main__': | |
main_calc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment