Пример #1
0
#!/usr/bin/env python

from file_pdb import PdbFile
import sys

if len(sys.argv) != 2:
    print('Usage: SCRIPT [input PDB]')
    sys.exit(2)

pdb_cafemol = PdbFile(sys.argv[1])
pdb_cafemol.open_to_read()
cafe_chains = pdb_cafemol.read_all()
pdb_cafemol.close()

#last_res_nums = []
#sum = 0
#for c in cafe_chains:
#    last_res_num = c.get_atom(-1).res_seq
#    sum += last_res_num
#    last_res_nums.append(last_res_num)
#print last_res_nums
#print sum

offset = 0
print('#ic   ires  res_c res    imp name')
for (ic, c) in enumerate(cafe_chains):
    for (ir, r) in enumerate(c.residues):
        for (ia, a) in enumerate(r.atoms):
            print(('%3i %6i %6i %s %6i %s' %
                   (ic + 1, a.res_seq + offset, a.res_seq, a.res_name,
                    a.res_seq, a.name)))
Пример #2
0
#!/usr/bin/env python

import sys
from file_pdb import PdbFile
from my_element import Coord

if len(sys.argv) != 3:
    print('Usage: % SCRIPT [input pdb] [output pdb]')
    sys.exit(2)

f_pdb_in = PdbFile(sys.argv[1])
f_pdb_in.open_to_read()
chains = f_pdb_in.read_all()
f_pdb_in.close()

com = Coord()
total_atom = 0
for c in chains:
    total_atom += c.num_atom()
    for iatom in range(c.num_atom()):
        com.move(c.get_atom(iatom).xyz)

com.x = -com.x / float(total_atom)
com.y = -com.y / float(total_atom)
com.z = -com.z / float(total_atom)

for c in chains:
    for iatom in range(c.num_atom()):
        c.get_atom(iatom).xyz.move(com)

f_pdb_out = PdbFile(sys.argv[2])
#!/usr/bin/env python

import sys
from file_pdb import PdbFile

if not len(sys.argv) in (4, 5):
    print('\n make a vector which represent movement from PDB1 to PDB2')
    print('\n Usage: [PDB 1] [PDB 2] [output mpvec file]')
    print(' Usage: [PDB 1] [PDB 2] [output mpvec file] [output vec file]\n')
    sys.exit(2)

f_pdb = PdbFile(sys.argv[1])
f_pdb.open_to_read()
chains1 = f_pdb.read_all()
f_pdb.close()
f_pdb = PdbFile(sys.argv[2])
f_pdb.open_to_read()
chains2 = f_pdb.read_all()
f_pdb.close()

f_out_mpvec = open(sys.argv[3], 'w')
if len(sys.argv) == 5:
    f_out_vec = open(sys.argv[4], 'w')

if len(chains1) != len(chains2):
    print('Error: len(chains1) != len(chains2)')
    sys.exit(2)

for ic, c1 in enumerate(chains1):
    c2 = chains2[ic]
Пример #4
0
from numpy import histogram

if len(sys.argv) < 6:
    print(
        '\n Usage: % SCRIPT [min] [max] [width] [PDB] [[PDB] ....] [output]\n')
    sys.exit(2)

# parameters
HIST_MIN = float(sys.argv[1])
HIST_MAX = float(sys.argv[2])
HIST_WID = float(sys.argv[3])

# Read chains from all input files
chains = []
for arg in sys.argv[4:-1]:
    file = PdbFile(arg)
    file.open_to_read()
    file.flg_HETATM = True
    chains += file.read_all()

# Output file preparing
import os
if os.path.exists(sys.argv[-1]):
    if input('File %s exists. Rewrite? [Y/n]' % sys.argv[-1]) != 'Y':
        sys.exit(2)
file_out = open(sys.argv[-1], 'w')

# Search Mg
MgIds = []
for (i_chain, chain) in enumerate(chains):
    for (i_res, res) in enumerate(chain.residues):