本文整理汇总了Python中Library.library_guess_element_from_name方法的典型用法代码示例。如果您正苦于以下问题:Python Library.library_guess_element_from_name方法的具体用法?Python Library.library_guess_element_from_name怎么用?Python Library.library_guess_element_from_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library.library_guess_element_from_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_ATOM
# 需要导入模块: import Library [as 别名]
# 或者: from Library import library_guess_element_from_name [as 别名]
def process_ATOM(self, rec):
## load current atom since this record indicates a new atom
if self.atm_map:
self.load_atom(self.atm_map)
self.atm_map = {}
## optimization
atm_map = self.atm_map
## always derive element from atom name for PDB files -- they are
## too messed up to use the element column
try:
name = rec["name"]
except KeyError:
atm_map["name"] = ""
atm_map["element"] = ""
else:
atm_map["name"] = name.strip()
res_name = rec.get("resName", "")
gelement = Library.library_guess_element_from_name(name, res_name)
if gelement != None:
atm_map["element"] = gelement
## additional atom information
if rec.has_key("serial"):
atm_map["serial"] = rec["serial"]
if rec.has_key("altLoc"):
atm_map["alt_loc"] = rec["altLoc"]
if rec.has_key("resName"):
atm_map["res_name"] = rec["resName"]
if rec.has_key("chainID"):
atm_map["chain_id"] = rec["chainID"]
## construct fragment_id
if rec.has_key("resSeq"):
if rec.has_key("iCode"):
atm_map["fragment_id"] = "%d%s" % (rec["resSeq"],rec["iCode"])
else:
atm_map["fragment_id"] = "%d" % (rec["resSeq"])
## add the model number for the atom
if self.model_num != None:
atm_map["model_id"] = self.model_num
## position
if rec.has_key("x"):
atm_map["x"] = rec["x"]
if rec.has_key("y"):
atm_map["y"] = rec["y"]
if rec.has_key("z"):
atm_map["z"] = rec["z"]
if rec.has_key("occupancy"):
atm_map["occupancy"] = rec["occupancy"]
if rec.has_key("tempFactor"):
atm_map["temp_factor"] = rec["tempFactor"]