Пример #1
0
 def find_sec_str(self, pdb_hierarchy):
   if self.params.secondary_structure.protein.search_method == "ksdssp":
     pdb_str = pdb_hierarchy.as_pdb_string()
     print >> self.log, "  running ksdssp..."
     (records, stderr) = run_ksdssp_direct(pdb_str)
     return iotbx.pdb.secondary_structure.annotation.from_records(
         records=records,
         log=self.log)
   elif self.params.secondary_structure.protein.search_method == "mmtbx_dssp":
     from mmtbx.secondary_structure import dssp
     print >> self.log, "  running mmtbx.dssp..."
     return dssp.dssp(
       pdb_hierarchy=pdb_hierarchy,
       pdb_atoms=self.pdb_atoms,
       out=null_out()).get_annotation()
   elif self.params.secondary_structure.protein.search_method == "from_ca":
     from mmtbx.secondary_structure import find_ss_from_ca
     print >> self.log, "  running find_ss_from_ca..."
     fss = find_ss_from_ca.find_secondary_structure(
         hierarchy=pdb_hierarchy,
         out=null_out())
     return fss.get_annotation()
   elif self.params.secondary_structure.protein.search_method == "cablam":
     from mmtbx.validation import cablam
     print >> self.log, "  running cablam..."
     cablam_results = cablam.cablamalyze(
         pdb_hierarchy = pdb_hierarchy,
         outliers_only=False,
         out=null_out(),
         quiet=False)
     return cablam_results.as_secondary_structure()
   else:
     print >> self.log, "  WARNING: Unknown search method for SS. No SS found."
     return iotbx.pdb.secondary_structure.annotation.from_records()
Пример #2
0
def run(args, out=sys.stdout):
    from mmtbx.secondary_structure import dssp
    from iotbx.file_reader import any_file
    import iotbx.phil
    cmdline = iotbx.phil.process_command_line_with_files(
        args=args, master_phil=dssp.master_phil, pdb_file_def="file_name")
    params = cmdline.work.extract()
    if (params.file_name is None):
        raise Sorry("Please specify a PDB file.")
    f = any_file(params.file_name, force_type="pdb")
    pdb_hierarchy = f.file_object.hierarchy
    xray_structure = f.file_object.xray_structure_simple()
    pdb_atoms = pdb_hierarchy.atoms()
    pdb_atoms.reset_i_seq()
    t1 = time.time()
    SS = dssp.dssp(pdb_hierarchy=pdb_hierarchy,
                   pdb_atoms=pdb_atoms,
                   xray_structure=xray_structure,
                   params=params,
                   out=out,
                   log=sys.stderr)
    if (params.atom_output):
        out.write(pdb_hierarchy.as_pdb_string(crystal_symmetry=xray_structure))
    t2 = time.time()
    if (params.verbosity >= 1):
        print >> sys.stderr, "total DSSP runtime: %.3fs" % (t2 - t1)
    return SS
Пример #3
0
def run (args, out=sys.stdout) :
  from mmtbx.secondary_structure import dssp
  from iotbx.file_reader import any_file
  import iotbx.phil
  cmdline = iotbx.phil.process_command_line_with_files(
    args=args,
    master_phil=dssp.master_phil,
    pdb_file_def="file_name")
  params = cmdline.work.extract()
  if (params.file_name is None) :
    raise Sorry("Please specify a PDB file.")
  f = any_file(params.file_name, force_type="pdb")
  pdb_hierarchy = f.file_object.hierarchy
  xray_structure = f.file_object.xray_structure_simple()
  pdb_atoms = pdb_hierarchy.atoms()
  pdb_atoms.reset_i_seq()
  t1 = time.time()
  SS = dssp.dssp(
    pdb_hierarchy=pdb_hierarchy,
    pdb_atoms=pdb_atoms,
    xray_structure=xray_structure,
    params=params,
    out=out,
    log=sys.stderr)
  if (params.atom_output) :
    out.write(pdb_hierarchy.as_pdb_string(crystal_symmetry=xray_structure))
  t2 = time.time()
  if (params.verbosity >= 1) :
    print >> sys.stderr, "total DSSP runtime: %.3fs" % (t2-t1)
  return SS
Пример #4
0
 def find_sec_str(self, pdb_hierarchy):
     if (pdb_hierarchy.atoms_size() > 99999
             and self.params.secondary_structure.protein.search_method
             == "ksdssp"):
         print("Warning!!! ksdssp method is not applicable for" + \
             "structures with more than 99999 atoms!\nSwitching to from_ca.", file=self.log)
         self.params.secondary_structure.protein.search_method = "from_ca"
     if self.params.secondary_structure.protein.search_method == "ksdssp":
         pdb_str = pdb_hierarchy.as_pdb_string()
         print("  running ksdssp...", file=self.log)
         (records, stderr) = run_ksdssp_direct(pdb_str)
         return iotbx.pdb.secondary_structure.annotation.from_records(
             records=records, log=self.log)
     elif self.params.secondary_structure.protein.search_method == "mmtbx_dssp":
         from mmtbx.secondary_structure import dssp
         print("  running mmtbx.dssp...", file=self.log)
         return dssp.dssp(pdb_hierarchy=pdb_hierarchy,
                          pdb_atoms=self.pdb_atoms,
                          out=null_out()).get_annotation()
     elif self.params.secondary_structure.protein.search_method == "from_ca":
         from mmtbx.secondary_structure import find_ss_from_ca
         from_ca_args = []
         ca_label = "liberal"
         if self.params.secondary_structure.from_ca_conservative:
             from_ca_args = [
                 "alpha.rise_tolerance=0.13",
                 "beta.rise_tolerance=0.3",
                 "alpha.dot_min=0.94",
             ]
             ca_label = "conservative"
         print("  running find_ss_from_ca %s..." % ca_label, file=self.log)
         fss = find_ss_from_ca.find_secondary_structure(
             hierarchy=pdb_hierarchy,
             args = from_ca_args,
             ss_by_chain=self.params.secondary_structure.ss_by_chain,
             max_rmsd=self.params.secondary_structure.max_rmsd,
             use_representative_chains=\
              self.params.secondary_structure.use_representative_chains,
             max_representative_chains=\
              self.params.secondary_structure.max_representative_chains,
             out=null_out())
         return fss.get_annotation()
     elif self.params.secondary_structure.protein.search_method == "cablam":
         from mmtbx.validation import cablam
         print("  running cablam...", file=self.log)
         cablam_results = cablam.cablamalyze(pdb_hierarchy=pdb_hierarchy,
                                             outliers_only=False,
                                             out=null_out(),
                                             quiet=False)
         return cablam_results.as_secondary_structure()
     else:
         print("  WARNING: Unknown search method for SS. No SS found.",
               file=self.log)
         return iotbx.pdb.secondary_structure.annotation.from_records()
Пример #5
0
 def find_sec_str(self, pdb_hierarchy):
     if (pdb_hierarchy.atoms_size() > 99999
             and self.params.secondary_structure.protein.search_method
             == "ksdssp"):
         print >> self.log, "Warning!!! ksdssp method is not applicable for" + \
             "structures with more than 99999 atoms!\nSwitching to from_ca."
         self.params.secondary_structure.protein.search_method = "from_ca"
     if self.params.secondary_structure.protein.search_method == "ksdssp":
         pdb_str = pdb_hierarchy.as_pdb_string()
         print >> self.log, "  running ksdssp..."
         (records, stderr) = run_ksdssp_direct(pdb_str)
         return iotbx.pdb.secondary_structure.annotation.from_records(
             records=records, log=self.log)
     elif self.params.secondary_structure.protein.search_method == "mmtbx_dssp":
         from mmtbx.secondary_structure import dssp
         print >> self.log, "  running mmtbx.dssp..."
         return dssp.dssp(pdb_hierarchy=pdb_hierarchy,
                          pdb_atoms=self.pdb_atoms,
                          out=null_out()).get_annotation()
     elif self.params.secondary_structure.protein.search_method == "from_ca":
         from mmtbx.secondary_structure import find_ss_from_ca
         print >> self.log, "  running find_ss_from_ca..."
         fss = find_ss_from_ca.find_secondary_structure(
             hierarchy=pdb_hierarchy,
             ss_by_chain=self.params.secondary_structure.ss_by_chain,
             max_rmsd=self.params.secondary_structure.max_rmsd,
             use_representative_chains=\
              self.params.secondary_structure.use_representative_chains,
             max_representative_chains=\
              self.params.secondary_structure.max_representative_chains,
             out=null_out())
         return fss.get_annotation()
     elif self.params.secondary_structure.protein.search_method == "cablam":
         from mmtbx.validation import cablam
         print >> self.log, "  running cablam..."
         cablam_results = cablam.cablamalyze(pdb_hierarchy=pdb_hierarchy,
                                             outliers_only=False,
                                             out=null_out(),
                                             quiet=False)
         return cablam_results.as_secondary_structure()
     else:
         print >> self.log, "  WARNING: Unknown search method for SS. No SS found."
         return iotbx.pdb.secondary_structure.annotation.from_records()