• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python nex.UpdateByJsonMixin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中src.sgd.model.nex.UpdateByJsonMixin的典型用法代码示例。如果您正苦于以下问题:Python UpdateByJsonMixin类的具体用法?Python UpdateByJsonMixin怎么用?Python UpdateByJsonMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

 def __init__(self, obj_json):
     UpdateByJsonMixin.__init__(self, obj_json)
     self.format_name = str(obj_json.get('parent_id')) + ' - ' + str(obj_json.get('child_id'))
     self.display_name = str(obj_json.get('parent_id')) + ' - ' + str(obj_json.get('child_id'))
     if self.relation_type is not None:
         self.format_name = self.format_name + ' - ' + self.relation_type
         self.display_name = self.display_name + ' - ' + self.relation_type
开发者ID:kkarra,项目名称:SGDBackend,代码行数:7,代码来源:bioconcept.py


示例2: __init__

 def __init__(self, obj_json):
     UpdateByJsonMixin.__init__(self, obj_json)
     if self.format_name is None:
         self.format_name = self.genbank_accession
     if self.display_name is None:
         self.display_name = self.genbank_accession
     self.link = None if self.format_name is None else '/contig/' + self.format_name + '/overview'
开发者ID:kkarra,项目名称:SGDBackend,代码行数:7,代码来源:bioitem.py


示例3: to_min_json

 def to_min_json(self, include_description=False):
     obj_json = UpdateByJsonMixin.to_min_json(self, include_description=include_description)
     obj_json['length'] = len(self.residues)
     obj_json['is_chromosome'] = True if self.is_chromosome == 1 else False
     obj_json['centromere_start'] = self.centromere_start
     obj_json['centromere_end'] = self.centromere_end
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:7,代码来源:bioitem.py


示例4: to_json

 def to_json(self):
     obj_json = UpdateByJsonMixin.to_json(self)
     new_obj_json = {'id': obj_json['id']}
     for key, value in obj_json.iteritems():
         if key != 'id':
             new_obj_json[key] = value == 1
     return new_obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:7,代码来源:auxiliary.py


示例5: convert

    def convert(self, newly_created_obj):
        if self.commit_interval is not None and (self.added_count + self.updated_count + self.deleted_count) % self.commit_interval == 0:
            self.session.commit()

        if newly_created_obj is None:
            self.none_count += 1
            return 'None'
        key = newly_created_obj.unique_key()
        if key not in self.keys_already_seen:
            self.keys_already_seen.add(key)
            current_obj_json = None if key not in self.key_to_current_obj_json else self.key_to_current_obj_json[key]
            newly_created_obj_json = UpdateByJsonMixin.to_json(newly_created_obj)
            if current_obj_json is None:
                if newly_created_obj.id in self.current_obj_ids:
                    current_obj_by_id = self.current_obj_query(self.session).filter_by(id=newly_created_obj.id).first()
                    self.session.delete(current_obj_by_id)
                self.session.add(newly_created_obj)
                self.added_count += 1
                return 'Added'
            elif newly_created_obj.compare(current_obj_json):
                current_obj = self.current_obj_query(self.session).filter_by(id=current_obj_json['id']).first()
                if current_obj is not None:
                    current_obj.update(newly_created_obj_json)
                    self.updated_count += 1
                    return 'Updated'
                else:
                    self.error_count += 1
                    return 'Error'
            else:
                self.no_change_count += 1
                return 'No Change'
        else:
            self.duplicate_count += 1
            return 'Duplicate'
开发者ID:kkarra,项目名称:SGDBackend,代码行数:34,代码来源:transformers.py


示例6: to_json

 def to_json(self):
     obj_json = UpdateByJsonMixin.to_json(self)
     obj_json['reference'] = None if self.reference is None else self.reference.to_json()
     obj_json['datasetcolumns'] = [x.to_min_json() for x in self.datasetcolumns]
     obj_json['tags'] = [x.tag.to_min_json() for x in self.bioitem_tags]
     obj_json['urls'] = [x.to_min_json() for x in self.urls]
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:7,代码来源:bioitem.py


示例7: to_json

 def to_json(self):
     obj_json = UpdateByJsonMixin.to_json(self)
     obj_json["references"] = [x.reference.to_min_json() for x in self.alias_references]
     if self.category in {
         "PDB identifier",
         "UniParc ID",
         "UniProtKB/Swiss-Prot ID",
         "UniProtKB/TrEMBL ID",
         "UniProtKB Subcellular Location",
         "Protein version ID",
         "EC number",
         "InterPro ID",
         "RefSeq protein version ID",
         "RefSeq nucleotide version ID",
         "TPA protein version ID",
         "DNA version ID",
         "protein GI",
         "TPA Accession ID",
         "PDB ID",
         "RefSeq Accession ID",
         "TC number",
         "PANTHER",
     }:
         obj_json["protein"] = True
     else:
         obj_json["protein"] = False
     return obj_json
开发者ID:yeastgenome,项目名称:SGDBackend,代码行数:27,代码来源:misc.py


示例8: to_json

    def to_json(self):
        obj_json = UpdateByJsonMixin.to_json(self)
        obj_json['locus_count'] = self.locus_count
        obj_json['descendant_locus_count'] = self.descendant_locus_count

        obj_json['urls'] = [x.to_json() for x in sorted(self.urls, key=lambda x: x.display_name)]
        obj_json['aliases'] = [x.display_name for x in sorted(self.aliases, key=lambda x: x.display_name)]
        return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:8,代码来源:bioconcept.py


示例9: to_semi_json

 def to_semi_json(self):
     obj_json = UpdateByJsonMixin.to_min_json(self)
     obj_json['pcl_filename'] = self.pcl_filename
     obj_json['geo_id'] = self.geo_id
     obj_json['short_description'] = self.short_description
     obj_json['condition_count'] = self.condition_count
     obj_json['reference'] = None if self.reference is None else self.reference.to_min_json()
     obj_json['tags'] = [x.tag.to_min_json() for x in self.bioitem_tags]
     obj_json['display_name'] = self.display_name.replace('.', '. ')
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:10,代码来源:bioitem.py


示例10: to_json

 def to_json(self, linkit=False):
     obj_json = UpdateByJsonMixin.to_json(self)
     obj_json["references"] = sorted(
         [x.reference.to_semi_json() for x in self.paragraph_references],
         key=lambda x: (x["year"], x["pubmed_id"]),
         reverse=True,
     )
     if linkit:
         obj_json["text"] = obj_json["html"]
     del obj_json["html"]
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:11,代码来源:paragraph.py


示例11: to_json

 def to_json(self):
     obj_json = UpdateByJsonMixin.to_json(self)
     obj_json['references'] = [x.reference.to_min_json() for x in self.alias_references]
     if self.category in {'PDB identifier', 'UniParc ID', 'UniProt/Swiss-Prot ID', 'UniProt/TrEMBL ID',
         'UniProtKB Subcellular Location', 'Protein version ID', 'EC number', 'InterPro', 'RefSeq protein version ID',
         'RefSeq nucleotide version ID', 'TPA protein version ID', 'DNA version ID', 'NCBI protein GI', 'TPA Accession',
         'PDB ID', 'RefSeq Accession', 'TC number', 'PANTHER'}:
         obj_json['protein'] = True
     else:
         obj_json['protein'] = False
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:11,代码来源:misc.py


示例12: to_json

    def to_json(self):
        obj_json = UpdateByJsonMixin.to_json(self)
        obj_json['abstract'] = None if len(self.paragraphs) == 0 else self.paragraphs[0].to_json(linkit=True)
        obj_json['bibentry'] = None if self.bibentry is None else self.bibentry.text
        obj_json['reftypes'] = [x.reftype.to_min_json() for x in self.ref_reftypes]
        obj_json['authors'] = [x.author.to_min_json() for x in self.author_references]
        interaction_locus_ids = set()
        interaction_locus_ids.update([x.locus1_id for x in self.physinteraction_evidences])
        interaction_locus_ids.update([x.locus2_id for x in self.physinteraction_evidences])
        interaction_locus_ids.update([x.locus1_id for x in self.geninteraction_evidences])
        interaction_locus_ids.update([x.locus2_id for x in self.geninteraction_evidences])
        regulation_locus_ids = set()
        regulation_locus_ids.update([x.locus1_id for x in self.regulation_evidences])
        regulation_locus_ids.update([x.locus2_id for x in self.regulation_evidences])
        obj_json['urls'] = [x.to_min_json() for x in self.urls]
        obj_json['counts'] = {
            'interaction': len(interaction_locus_ids),
            'go': len(set([x.locus_id for x in self.go_evidences])),
            'phenotype': len(set([x.locus_id for x in self.phenotype_evidences])),
            'regulation': len(regulation_locus_ids)
        }
        obj_json['related_references'] = []
        for child in self.children:
            child_json = child.child.to_semi_json()
            child_json['abstract'] = None if len(child.child.paragraphs) == 0 else child.child.paragraphs[0].to_json(linkit=True)
            child_json['reftypes'] = [x.reftype.to_min_json() for x in child.child.ref_reftypes]
            obj_json['related_references'].append(child_json)
        for parent in self.parents:
            parent_json = parent.parent.to_semi_json()
            parent_json['abstract'] = None if len(parent.parent.paragraphs) == 0 else parent.parent.paragraphs[0].to_json(linkit=True)
            parent_json['reftypes'] = [x.reftype.to_min_json() for x in parent.parent.ref_reftypes]
            obj_json['related_references'].append(parent_json)
        obj_json['urls'] = [x.to_json() for x in self.urls]
        if self.journal is not None:
            obj_json['journal']['med_abbr'] = self.journal.med_abbr

        id_to_dataset = {}
        for expression_evidence in self.expression_evidences:
            if expression_evidence.datasetcolumn.dataset_id not in id_to_dataset:
                id_to_dataset[expression_evidence.datasetcolumn.dataset_id] = expression_evidence.datasetcolumn.dataset
        obj_json['expression_datasets'] = [x.to_semi_json() for x in id_to_dataset.values()]
        return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:42,代码来源:reference.py


示例13: __init__

 def __init__(self, session_maker, current_obj_query, name=None, commit_interval=None, commit=False, delete_untouched=False, already_deleted=0):
     self.session = session_maker()
     self.current_obj_query = current_obj_query
     self.name = name
     self.commit_interval = commit_interval
     self.commit = commit
     self.delete_untouched = delete_untouched
     self.key_to_current_obj_json = dict()
     self.current_obj_ids = set()
     for obj in current_obj_query(self.session):
         self.key_to_current_obj_json[obj.unique_key()] = UpdateByJsonMixin.to_json(obj)
         self.current_obj_ids.add(obj.id)
     self.keys_already_seen = set()
     self.none_count = 0
     self.added_count = 0
     self.updated_count = 0
     self.no_change_count = 0
     self.duplicate_count = 0
     self.error_count = 0
     self.deleted_count = already_deleted
开发者ID:kkarra,项目名称:SGDBackend,代码行数:20,代码来源:transformers.py


示例14: __init__

 def __init__(self, obj_json):
     UpdateByJsonMixin.__init__(self, obj_json)
     self.format_name = str(obj_json.get("parent_id")) + " - " + str(obj_json.get("child_id"))
     self.display_name = str(obj_json.get("parent_id")) + " - " + str(obj_json.get("child_id"))
开发者ID:kkarra,项目名称:SGDBackend,代码行数:4,代码来源:bioentity.py


示例15: __init__

 def __init__(self, obj_json):
     UpdateByJsonMixin.__init__(self, obj_json)
     self.format_name = create_format_name(obj_json.get('display_name'))
     if obj_json.get('eco_id') in eco_id_to_category:
         self.category = eco_id_to_category[obj_json.get('eco_id')]
开发者ID:kkarra,项目名称:SGDBackend,代码行数:5,代码来源:misc.py


示例16: to_json

    def to_json(self):
        obj_json = UpdateByJsonMixin.to_json(self)

        # Phenotype overview
        phenotype_paragraphs = [x.to_json() for x in self.paragraphs if x.category == "PHENOTYPE"]
        classical_groups = dict()
        large_scale_groups = dict()
        strain_groups = dict()
        for evidence in self.phenotype_evidences:
            if evidence.experiment.category == "classical genetics":
                if evidence.mutant_type in classical_groups:
                    if evidence.phenotype_id not in classical_groups[evidence.mutant_type]:
                        classical_groups[evidence.mutant_type][evidence.phenotype_id] = evidence.phenotype
                else:
                    classical_groups[evidence.mutant_type] = {evidence.phenotype_id: evidence.phenotype}
            elif evidence.experiment.category == "large-scale survey":
                if evidence.mutant_type in large_scale_groups:
                    if evidence.phenotype_id not in large_scale_groups[evidence.mutant_type]:
                        large_scale_groups[evidence.mutant_type][evidence.phenotype_id] = evidence.phenotype
                else:
                    large_scale_groups[evidence.mutant_type] = {evidence.phenotype_id: evidence.phenotype}

            if evidence.strain is not None:
                if evidence.strain.display_name in strain_groups:
                    strain_groups[evidence.strain.display_name] += 1
                else:
                    strain_groups[evidence.strain.display_name] = 1
        experiment_categories = []
        mutant_types = set(classical_groups.keys())
        mutant_types.update(large_scale_groups.keys())
        for mutant_type in mutant_types:
            experiment_categories.append(
                [
                    mutant_type,
                    0 if mutant_type not in classical_groups else len(classical_groups[mutant_type]),
                    0 if mutant_type not in large_scale_groups else len(large_scale_groups[mutant_type]),
                ]
            )
        strains = []
        for strain, count in strain_groups.iteritems():
            strains.append([strain, count])
        experiment_categories.sort(key=lambda x: x[1] + x[2], reverse=True)
        experiment_categories.insert(0, ["Mutant Type", "classical genetics", "large-scale survey"])
        strains.sort(key=lambda x: x[1], reverse=True)
        strains.insert(0, ["Strain", "Annotations"])
        obj_json["phenotype_overview"] = {
            "paragraph": None if len(phenotype_paragraphs) == 0 else phenotype_paragraphs[0]["text"],
            "experiment_categories": experiment_categories,
            "strains": strains,
            "classical_phenotypes": dict(
                [(x, [phenotype.to_min_json() for phenotype in y.values()]) for x, y in classical_groups.iteritems()]
            ),
            "large_scale_phenotypes": dict(
                [(x, [phenotype.to_min_json() for phenotype in y.values()]) for x, y in large_scale_groups.iteritems()]
            ),
        }

        # Go overview
        man_mf = dict()
        man_bp = dict()
        man_cc = dict()
        htp_mf = dict()
        htp_bp = dict()
        htp_cc = dict()
        for evidence in self.go_evidences:
            goterm = evidence.go
            ev_json = None
            if goterm.go_aspect == "molecular function" and evidence.annotation_type == "manually curated":
                if goterm.id not in man_mf:
                    man_mf[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = man_mf[goterm.id]

            elif goterm.go_aspect == "molecular function" and evidence.annotation_type == "high-throughput":
                if goterm.id not in htp_mf:
                    htp_mf[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = htp_mf[goterm.id]

            elif goterm.go_aspect == "biological process" and evidence.annotation_type == "manually curated":
                if goterm.id not in man_bp:
                    man_bp[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = man_bp[goterm.id]

            elif goterm.go_aspect == "biological process" and evidence.annotation_type == "high-throughput":
                if goterm.id not in htp_bp:
                    htp_bp[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = htp_bp[goterm.id]

            elif goterm.go_aspect == "cellular component" and evidence.annotation_type == "manually curated":
                if goterm.id not in man_cc:
                    man_cc[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = man_cc[goterm.id]

            elif goterm.go_aspect == "cellular component" and evidence.annotation_type == "high-throughput":
                if goterm.id not in htp_cc:
                    htp_cc[goterm.id] = {"term": goterm.to_min_json(), "evidence_codes": [], "qualifiers": []}
                ev_json = htp_cc[goterm.id]

            if ev_json is not None:
                if evidence.experiment_id is not None:
                    evidence_code_ids = [x["id"] for x in ev_json["evidence_codes"]]
#.........这里部分代码省略.........
开发者ID:kkarra,项目名称:SGDBackend,代码行数:101,代码来源:bioentity.py


示例17: to_semi_json

 def to_semi_json(self):
     obj_json = UpdateByJsonMixin.to_min_json(self)
     obj_json["description"] = self.description
     return obj_json
开发者ID:kkarra,项目名称:SGDBackend,代码行数:4,代码来源:bioentity.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sim.Sim类代码示例发布时间:2022-05-27
下一篇:
Python sessionhandler.SESSIONS类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap