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


Python DBSession.chirality方法代码示例

本文整理汇总了Python中app.model.DBSession.chirality方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.chirality方法的具体用法?Python DBSession.chirality怎么用?Python DBSession.chirality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.model.DBSession的用法示例。


在下文中一共展示了DBSession.chirality方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DBSession

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import chirality [as 别名]
        mol = DBSession().query(ReagentMol).options(eagerload('lots')).get(mol_id)
        if mol is None:
            continue
        obmol=OBMol()
        conv.ReadString(obmol, mol_struct)
        chirality = 'R' # Default to relative if there is stereochemistry
        if not obmol.IsChiral():
            chirality = 'A'
        if getChiralFlag(mol_struct):
            chirality = 'A'
        # before assigning structure to this mol, check if we'll violate
        # unique constraint on inchi...
        mol_inchi = toInchi(mol_struct)
        DBSession().flush()
        mi = DBSession().query(ReagentMol).options(eagerload('lots')).filter(ReagentMol.mol_inchi == mol_inchi).first()
        mol.chirality = chirality
        if mi:
            # Corner case: If a chemical (say mol_id 123) was in our sd
            # file, and there is another molecule (say 456) with a different
            # name for that structure, and 456 has a CAS but didn't get a
            # struct, then 123's lots will get moved over to 456.  Later on
            # when we hit 456 in the sd file we should just skip over it--it'll
            # get retrieved by the DBSession().get(..) query as well as the
            # InCHI query.  We can tell this happened since
            # mi.mol_id == mol.mol_id
            if mi.mol_id == mol.mol_id:
                continue

            if mi.mol_cas_no != mol.mol_cas_no and mi.mol_cas_no and mol.mol_cas_no:
                print "Collision--CAS disagrees, existing struct %d : %d, new %d : %d" % (mi.mol_id, len(mi.lots), int(mol_id), len(mol.lots))
                if mi not in merge:
开发者ID:aytsai,项目名称:ricebowl,代码行数:33,代码来源:upload_molecules.py


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