Ejemplo n.º 1
0
def insert_into_database(nex_session, source_id, locus_id, protein_name):

    print(source_id, locus_id, protein_name)

    x = LocusAlias(locus_id=locus_id,
                   source_id=source_id,
                   display_name=protein_name,
                   has_external_id_section='0',
                   alias_type='NCBI protein name',
                   created_by='STACIA')

    nex_session.add(x)
    nex_session.commit()
Ejemplo n.º 2
0
def insert_alias(nex_session, fw, locus_id, alias_type, source, source_id, ID):

    obj_url = get_url(alias_type, ID, source)

    x = LocusAlias(display_name=ID,
                   obj_url=obj_url,
                   source_id=source_id,
                   locus_id=locus_id,
                   has_external_id_section="1",
                   alias_type=alias_type,
                   created_by=CREATED_BY)
    nex_session.add(x)

    fw.write("Insert a new " + alias_type + ": " + ID + "\n")
Ejemplo n.º 3
0
def insert_alias(nex_session, fw, locus_id, source_id, gene_id):

    # print "NEW Gene ID:", gene_id

    x = LocusAlias(display_name=gene_id,
                   obj_url=link_root_url + gene_id,
                   source_id=source_id,
                   locus_id=locus_id,
                   has_external_id_section="1",
                   alias_type='Gene ID',
                   created_by=CREATED_BY)
    nex_session.add(x)

    fw.write("Insert a new NCBI Gene ID " + gene_id + "\n")
Ejemplo n.º 4
0
def insert_alias(nex_session, fw, locus_id, source_id, panther_id):

    obj_url = OBJ_URL + panther_id

    x = LocusAlias(display_name=panther_id,
                   obj_url=obj_url,
                   source_id=source_id,
                   locus_id=locus_id,
                   has_external_id_section="1",
                   alias_type=ALIAS_TYPE,
                   created_by=CREATED_BY)

    nex_session.add(x)

    fw.write("Insert a new " + ALIAS_TYPE + ": " + panther_id + "\n")
Ejemplo n.º 5
0
def insert_locus_alias(nex_session, fw, locus_id, source_id, ec):

    obj_url = ROOT_OBJ_URL + ec

    # print locus_id, source_id, ec, obj_url, ALIAS_TYPE, CREATED_BY

    x = LocusAlias(display_name = ec,
                   obj_url = obj_url,
                   source_id = source_id,
                   locus_id = locus_id,
                   has_external_id_section = "1",
                   alias_type = ALIAS_TYPE,
                   created_by = CREATED_BY)

    nex_session.add(x)

    fw.write("Insert a new " + ALIAS_TYPE + ": " + ec + " for locus_id=" + str(locus_id) + "\n")
Ejemplo n.º 6
0
def insert_locus_alias(nex_session, fw, locus_id, alias_name, alias_type, source_id, date_created, created_by):

    x = LocusAlias(locus_id = locus_id,
                   display_name = alias_name,
                   alias_type = alias_type,
                   has_external_id_section = '0',
                   source_id = source_id,
                   created_by = created_by,
                   date_created = date_created)

    nex_session.add(x)
    nex_session.flush()
    nex_session.refresh(x)

    fw.write("Insert Locus_alias row for locus_id = " + str(locus_id) + ", alias_name = " + alias_name + ", created_by = " + created_by + ", date_created = " + date_created + "\n")

    return x.alias_id
Ejemplo n.º 7
0
def insert_locus_alias(nex_session, fw, locus_id, display_name, source_id,
                       alias_type, obj_url):

    print("LOCUS_ALIAS: ", locus_id, display_name, source_id, alias_type,
          obj_url)

    x = LocusAlias(display_name=display_name,
                   obj_url=obj_url,
                   source_id=source_id,
                   locus_id=locus_id,
                   has_external_id_section='1',
                   alias_type=alias_type,
                   created_by=CREATED_BY)

    nex_session.add(x)
    nex_session.flush()
    nex_session.refresh(x)

    fw.write("insert new locus_alias: " + display_name + "\n")
Ejemplo n.º 8
0
def insert_locus_alias(nex_session, fw, source_id, locus_id, biocycID, created_by):

    x = nex_session.query(LocusAlias).filter_by(locus_id=locus_id, display_name=biocycID, alias_type='Pathway ID').one_or_none()
    if x is not None:
        return 

    x = LocusAlias(locus_id = locus_id,
                   display_name = biocycID,
                   obj_url = 'http://pathway.yeastgenome.org/YEAST/new-image?type=PATHWAY&object=' + biocycID + '&detail-level=2',
                   source_id = source_id,
                   has_external_id_section = '1',
                   alias_type = 'Pathway ID',
                   created_by = created_by)

    nex_session.add(x)
    nex_session.flush()
    nex_session.refresh(x)

    fw.write("insert new locus_alias: locus_id=" + str(locus_id) + ", biocyc_id=" + biocycID + "\n")