当前位置: 首页>>代码示例>>Python>>正文


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怎么用?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"]
开发者ID:davem22101,项目名称:semanticscience,代码行数:62,代码来源:PDBBuilder.py


注:本文中的Library.library_guess_element_from_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。