當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。