adding scripts for struct params
This commit is contained in:
parent
31dd74d5ac
commit
ec25e9fd2d
5 changed files with 270 additions and 0 deletions
59
meta_data_analysis/RD.py
Executable file
59
meta_data_analysis/RD.py
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Thu Feb 6 12:18:24 2020
|
||||
|
||||
@author: tanu
|
||||
"""
|
||||
#http://foldxsuite.crg.eu/faq-page#
|
||||
# after fold x downlaoded, extract and run it from
|
||||
#https://biopython.org/DIST/docs/api/Bio.PDB.ResidueDepth%27-module.html
|
||||
#proDepth: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0007072
|
||||
#Depth server: http://cospi.iiserpune.ac.in/depth/htdocs/index.html
|
||||
# needs biopython and msms
|
||||
|
||||
# load libraries
|
||||
import sys, os
|
||||
import pandas as pd
|
||||
from Bio.PDB.ResidueDepth import ResidueDepth
|
||||
from Bio.PDB.PDBParser import PDBParser
|
||||
from Bio.PDB.ResidueDepth import get_surface
|
||||
|
||||
#%%
|
||||
homedir = os.path.expanduser('~') # spyder/python doesn't recognise tilde
|
||||
os.getcwd()
|
||||
os.chdir(homedir + '/git/LSHTM_analysis/meta_data_analysis/struct_params')
|
||||
os.getcwd()
|
||||
#%%
|
||||
parser = PDBParser()
|
||||
structure = parser.get_structure("3pl1", "/home/tanu/git/3pl1.pdb")
|
||||
model = structure[0]
|
||||
surface = get_surface(model)
|
||||
|
||||
rd = ResidueDepth(model)
|
||||
print(rd['A',(' ', 152, ' ')])
|
||||
rd.keys()
|
||||
foo = rd.property_dict
|
||||
rd.property_keys
|
||||
baz = rd.property_list
|
||||
|
||||
|
||||
#To calculate the residue depth (average atom depth of the atoms in a residue):
|
||||
from Bio.PDB.ResidueDepth import residue_depth
|
||||
chain = model['A']
|
||||
res152 = chain[152]
|
||||
rd2 = residue_depth(res152, surface)
|
||||
|
||||
# df from dict
|
||||
foo1 = pd.DataFrame.from_dict(baz, orient='index', columns = ['res_depth', 'surface'])
|
||||
test = pd.Series(foo, name = "test")
|
||||
|
||||
# df from list
|
||||
foo2 = pd.DataFrame(baz, columns = ['residue', 'residue depth'])
|
||||
|
||||
|
||||
### iterate
|
||||
for i in range(185):
|
||||
print(i)
|
||||
rd3 = residue_depth(res+i, surface)
|
||||
print(rd3)
|
Loading…
Add table
Add a link
Reference in a new issue