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


Python nex.UpdateByJsonMixin类代码示例

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


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


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