diff --git a/Load/gene_alleles.py b/Load/gene_alleles.py index 5f83e0d..863e231 100644 --- a/Load/gene_alleles.py +++ b/Load/gene_alleles.py @@ -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: connection to testdb + organism_id: organism id + feature_id: feature name to id + cvterm_id: cvterm name to id + dbxref_id: dbxref name to dbxref id + pub_id: id of pub + db_id: 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. diff --git a/Load/pubs.py b/Load/pubs.py index f996c25..ffd894b 100644 --- a/Load/pubs.py +++ b/Load/pubs.py @@ -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 @@ -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] diff --git a/data/cv_cvterm.yaml b/data/cv_cvterm.yaml index f5ff68f..8cdf084 100644 --- a/data/cv_cvterm.yaml +++ b/data/cv_cvterm.yaml @@ -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: [ diff --git a/data/db_dbxref.yaml b/data/db_dbxref.yaml index 186002b..454c5af 100644 --- a/data/db_dbxref.yaml +++ b/data/db_dbxref.yaml @@ -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: []