Skip to content

Commit

Permalink
Merge branch 'master' into new_canto_stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlongden authored May 17, 2024
2 parents 5d6d0e0 + 8a01eea commit 561ecfd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
22 changes: 22 additions & 0 deletions Load/add_dbxref_to_cvterms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def add_dbxref_data_to_cvterms(cursor, cv_cvterm_id, db_id, dbxref_id):

# NOTE: these may not be correct but can be used to create some for testing.
# The FBxx may not match the actual production ones
cv_to_FB = {
"FlyBase anatomy CV": "FBbt",
"FlyBase development CV": "FBdv",
"FlyBase miscellaneous CV": "FBcv"
}
dbx_sql = """ INSERT INTO dbxref (db_id, accession) VALUES (%s, %s) RETURNING dbxref_id """
add_to_cvterm = """ UPDATE cvterm SET dbxref_id = %s where cvterm_id = %s """
for cv in (cv_to_FB.keys()):
fb_id = db_id[cv_to_FB[cv]]
count = 1
for cvterm in cv_cvterm_id[cv]:

print("Adding CV %s to type %s" % (cvterm, cv_to_FB[cv]))
print(cv_cvterm_id[cv][cvterm])
cursor.execute(dbx_sql, (fb_id, count))
dbx_id = cursor.fetchone()[0]
cursor.execute(add_to_cvterm, (dbx_id, cv_cvterm_id[cv][cvterm]))
count += 1
3 changes: 3 additions & 0 deletions add-test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from Load.drivers import add_driver_data
from Load.geneproduct import create_geneproducts
from Load.teis import create_teis
from Load.add_dbxref_to_cvterms import add_dbxref_data_to_cvterms

conn = psycopg2.connect(database="fb_test")
cursor = conn.cursor()
Expand Down Expand Up @@ -566,6 +567,8 @@ def load_pub_author_pubprop(parsed_yaml):
# transposable_element_insertion_site (teis)
create_teis(cursor, organism_id, feature_id, cvterm_id, dbxref_id, db_id, pub_id)

add_dbxref_data_to_cvterms(cursor, cv_cvterm_id, db_id, dbxref_id)

conn.commit()
conn.close()
print("SUCCESS")
2 changes: 1 addition & 1 deletion data/cv_cvterm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ FlyBase: ['FlyBase analysis']
FlyBase_internal: ['pubprop type:curated_by']

FlyBase development CV: ['late embryonic stage', 'embryonic stage', 'adult stage', 'development 1', 'development 2', 'development 3',
'wandering third instar larval stage']
'wandering third instar larval stage', 'laval stage']
FlyBase miscellaneous CV: [
'CRISPR/Cas9', 'amorphic allele - molecular evidence', 'assay', 'biosample', 'biotic stimulus study', 'cell isolation', 'chemical entity',
'conditional', 'colocalizes_with', 'comment',
Expand Down
6 changes: 3 additions & 3 deletions data/db_dbxref.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
testdb: ['hh-1']
testdb2: []
EMBL-EBI Single Cell Expression Atlas Datasets: []
FBbt: ['dissociated larval fat cell', 'CP1 lineage neuron']
FBcv: []
FBdv: []
FBbt: ['dissociated larval fat cell', 'CP1 lineage neuron', 'eye']
FBcv: ['maternal effect', 'eye', 'visible']
FBdv: ['adult stage', 'larval stage', 'embryonic stage']
GB: ['GB1', 'GB2']
GO: []
DOI: []
Expand Down

0 comments on commit 561ecfd

Please sign in to comment.