Esempio n. 1
0
def main(args):
    print args

    # dump ttd targets and drugs:
    ttd_targets=Target.objects.filter(src='ttd')
    print 'ttd: %d targets' % len(ttd_targets)

    # dump drugbank targets
    db_targets=Target.objects.filter(src='db')
    print 'db: %d targets\n' % len(db_targets)

    # list shared targets in various ways
    shared('name')
    shared('gene_sym')
    shared('uniprot_id')
    
    # Look up Sam genes:
    genelist=readgenes(args.samgenes_fn)
    SamGenesWithUniprot(genelist, uniprot2gene(args.uniprot_gene_fn))
    SamGenes(genelist)

    # Look up tripNeg genes:
    genelist=readgenes(args.tripnegs_fn)
    g2s=gene2synonyms(args.gene2syn_fn)
    tripNegAll(genelist, g2s)
Esempio n. 2
0
    def __init__(self, **kwargs):
        self.cur_obj=None
        self.cur_drug=None
        self.cur_target=None
        self.attr_name=None

        # clear tables if called for:
        if 'clear_table' in kwargs and kwargs['clear_table']:
            print 'clearing tables...'
            for cls in [ Drug, DrugSynonym, DrugPathway, Target, TargetSynonym, TargetPathway]:
                dao=dao_django(cls=cls)
                query = {'src':'db'} if cls==Drug or cls==Target else {}
                dao.remove(query)

        self.stats={'n_drugs':0,
                    'n_targets':0,
                    'n_drug_syns':0,
                    'n_target_syns':0,
                    'n_drug_pathways':0,
                    'n_target_pathways':0,
                    }

        self.ug=uniprot2gene(kwargs['uniprot_gene_fn'])
Esempio n. 3
0
    def __init__(self, **kwargs):
        self.db_name=kwargs['db']
        self.cur_target=None
        self.cur_id=None
        self.targets=[]

        # fixme: all of this should really be in the dao_django class
        if 'clear_table' in kwargs and kwargs['clear_table']:
            print 'clearing tables...'
            for cls in [ Drug, DrugSynonym, DrugPathway, Target, TargetSynonym, TargetPathway]:
                objs=cls.objects.all()
                try:
                    objs.delete()
                except django.db.utils.DatabaseError:
                    print 'clearing objects the long way for %s' % cls.__name__
                    for o in objs:
                        o.delete()

        self.stats={'n_drugs':0,
                    'n_targets':0,
                    'n_pathways':0}

        self.ug=uniprot2gene(kwargs['uniprot_gene_fn'])