Created
September 9, 2018 13:14
-
-
Save keitaroyam/7a06528b81a2f7eb86853adc27bec8fd to your computer and use it in GitHub Desktop.
calculate solvent fraction from pdb (cctbx)
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
import iotbx.pdb | |
import mmtbx.utils | |
from mmtbx.scaling.matthews import p_vm_calculator | |
def run(pdbin): | |
pdb_inp = iotbx.pdb.input(pdbin) | |
xray_structure = pdb_inp.xray_structure_simple() | |
print "Read from %s" % pdb_in | |
xray_structure.show_summary(prefix=" ") | |
print "Mask-based calculation" | |
print " Solvent Content:", mmtbx.utils.f_000(xray_structure=xray_structure).solvent_fraction | |
hierarchy = pdb_inp.construct_hierarchy() | |
counts = hierarchy.overall_counts() | |
num_aa = counts.resname_classes.get("common_amino_acid", 0) | |
num_na = counts.resname_classes.get("common_rna_dna", 0) | |
print "Sequence-based calculation" | |
print " Number of amino acids: %d" % num_aa | |
print " Number of bases: %d" % num_na | |
vm_calc = p_vm_calculator(xray_structure.crystal_symmetry(), n_residues=num_aa, n_bases=num_na) | |
print " Solvent Content: ", vm_calc.solc(vm=vm_calc.vm(copies=1)) | |
# run() | |
if __name__ == "__main__": | |
import sys | |
pdb_in = sys.argv[1] | |
run(pdb_in) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment