Skip to content

Commit

Permalink
pubmed needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlongden committed May 16, 2024
1 parent 65a2f85 commit 1762388
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
43 changes: 43 additions & 0 deletions Load/gene_alleles.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,49 @@ def create_alpha_alleles(cursor, org_dict, feature_id, cvterm_id, db_id, pub_id)
)


def add_gene_GA(cursor, organism_id, feature_id, cvterm_id, dbxref_id, pub_id, db_id):
"""Add data to test G24 banc and bangd operations.
Args:
cursor: <sql connection cursor> connection to testdb
organism_id: <int> organism id
feature_id: <dict> feature name to id
cvterm_id: <dict> cvterm name to id
dbxref_id: <dict> dbxref name to dbxref id
pub_id: <int> id of pub
db_id: <dict> db name to db id
"""
create_gene_alleles(
cursor, organism_id, feature_id, cvterm_id, db_id, pub_id,
num_genes=10,
num_alleles=1,
gene_prefix='GAproptest',
allele_prefix=None,
tool_prefix='Cjk',
pub_format="GAproptest_title_"
)
# G24 data. feature cvterm props
# fc_sql = """ INSERT INTO feature_cvterm (feature_id, cvterm_id, pub_id) VALUES (%s, %s, %s) RETURNING feature_cvterm_id """
# fcp_sql = """ INSERT INTO feature_cvtermprop (feature_cvterm_id, type_id, value, rank) VALUES (%s, %s, %s, %s) """
data = [
{'cvterm': 'date', 'cvname': 'feature_cvtermprop type', 'value': '19671008'},
{'cvterm': 'provenance', 'cvname': 'FlyBase miscellaneous CV', 'value': 'FlyBase'},
{'cvterm': 'evidence_code', 'cvname': 'FlyBase miscellaneous CV', 'value': 'inferred from direct assay'},
{'cvterm': 'located_in', 'cvname': 'relationship', 'value': None}]

for i in range(10):
# create feature cvterm
cursor.execute(fc_sql,(feature_id['GAproptest{}[Cjk1]'.format(i + 1)], cvterm_id['in vitro construct'], pub_id))
iv_id = cursor.fetchone()[0]
cursor.execute(fc_sql, (feature_id['GAproptest{}[Cjk1]'.format(i+1)], cvterm_id['amorphic allele - molecular evidence'], pub_id))
iv_id = cursor.fetchone()[0]

# create feature cvterm props
for item in data:
cursor.execute(fcp_sql, (fc_id, cvterm_id[item['cvterm']], item['value'], 0))


def add_gene_G24(cursor, organism_id, feature_id, cvterm_id, dbxref_id, pub_id, db_id):
"""Add data to test G24 banc and bangd operations.
Expand Down
4 changes: 3 additions & 1 deletion Load/pubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ def add_pub_data(cursor, feature_id, cv_id, cvterm_id, db_id, db_dbxref):
pub_sql = """ INSERT INTO pub (title, type_id, uniquename, pyear, miniref) VALUES (%s, %s, %s, %s, %s) RETURNING pub_id """
pubprop_sql = """ INSERT INTO pubprop (pub_id, rank, type_id, value) VALUES (%s, %s, %s, %s) """
editor_sql = """ INSERT INTO pubauthor (pub_id, rank, surname, givennames, editor) VALUES (%s, %s, %s, %s, %s) """
pub_dbxref_sql = """ INSERT INTO pub_dbxref (pub_id, dbxref_id) VALUES (%s, %s) """

for i in range(2, 9):
cursor.execute(pub_sql, ('Nature_{}'.format(i), cvterm_id['computer file'], 'FBrf000000{}'.format(i), '1967', 'miniref_{}'.format(i)))
pub_id = cursor.fetchone()[0]
feature_id['Nature_{}'.format(i)] = pub_id
print("Pub'{}' id = {}".format('Nature_{}'.format(i), pub_id))
cursor.execute(pub_dbxref_sql, (pub_id, db_dbxref['pubmed'][f'{i}']))

cursor.execute(pub_sql, ('unattributed', cvterm_id['unattributed'], 'unattributed', '1973', 'miniref_10'))
pub_id = cursor.fetchone()[0]
feature_id['unattributed'] = pub_id
Expand Down Expand Up @@ -48,7 +51,6 @@ def add_pub_data(cursor, feature_id, cv_id, cvterm_id, db_id, db_dbxref):
parent_pub_id = cursor.fetchone()[0]

# create general multipubs for testing
pub_dbxref_sql = """ INSERT INTO pub_dbxref (pub_id, dbxref_id) VALUES (%s, %s) """
for i in range(4, 14):
cursor.execute(pub_sql, ('Journal_{}'.format(i+1), cvterm_id['journal'], 'multipub:temp_{}'.format(i), '2018', 'miniref_{}'.format(i+1)))
pub_id = cursor.fetchone()[0]
Expand Down
4 changes: 2 additions & 2 deletions data/cv_cvterm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ FlyBase miscellaneous CV: [
'environ1', 'environ2', 'environ3','environ4', 'environ5', 'faint', 'functional group', 'female',
'in vitro construct',
'inferred from direct assay', 'inferred from mutant phenotype', 'isolated cells', 'natural population',
'male', 'misc 1', 'misc 2', 'misc 3', 'multi-individual sample',
'male', 'misc 1', 'misc 2', 'misc 3', 'multi-individual sample', 'partially',
'pheno1', 'pheno2', 'pheno3', 'pheno4', 'pheno5',
'photoactivatable fluorescent protein', 'protein detection tool', 'project',
'qualifier', 'reagent collection', 'RNA detection tool', 'single balancer', 'spontaneous',
'split system combination',
'split system combination', 'suppressible',
'transcriptome', 'umbrella project', 'unspecified']

GenBank feature qualifier: [
Expand Down
2 changes: 1 addition & 1 deletion data/db_dbxref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FBdv: []
GB: ['GB1', 'GB2']
GO: []
DOI: []
pubmed: []
pubmed: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14']
isbn: []
issn: ['1111-1111', '2222-2222', '3333-3333', '4444-4444']
PMCID: []
Expand Down

0 comments on commit 1762388

Please sign in to comment.