Exemplo n.º 1
0
    def onvalue(self, mo):
        value=mo.group(1)
        if self.attr_name in self.attr_names: 
            real_attr_name=self.attr_names[self.attr_name]
            setattr(self.cur_obj, real_attr_name, value)

        # Synonyms
        elif self.attr_name == 'Synonyms':
            if self.cur_target:
                syn=TargetSynonym(synonym=value, target=self.cur_target)
                self.cur_target.syns.append(syn)
            else:
                syn=DrugSynonym(synonym=value, drug=self.cur_drug)
                self.stats['n_drug_syns']+=1
                self.cur_obj.drugsynonym_set.add(syn)
                syn.save()


        # Gene_Name
        elif self.attr_name == 'Gene_Name':
            self.cur_target.gene_sym=value
            try:
                self.cur_target.uniprot_id=','.join(self.ug.g2u[value])
            except KeyError:
                pass
Exemplo n.º 2
0
 def on_Synonyms(self, row):
     syn=TargetSynonym(synonym=row[2], target=self.cur_target)
     syn.save()
     self.cur_target.synonyms.add(syn)