Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Load/chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def add_chemical_data(cursor, cvterm_id, organism_id, dbxref_id, pub_id, db_id,
pubchem_pub_id = cursor.fetchone()[0]

obsolete = False
for i in range(20):
for i in range(30):
cursor.execute(dbxref_sql, (db_id['CHEBI'], f"{i+1}"))
chem_dbxref_id = cursor.fetchone()[0]
##################################################################################
Expand Down
31 changes: 28 additions & 3 deletions Load/gene_alleles.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,22 @@ def feature_relationship_add(cursor, count, feat_details, tool_name, gene_name,
if 'org_abbr' in feat_details:
org_id = org_dict[feat_details['org_abbr']]
uniquename = feat_details['uniquename'].replace('<number>', "{:07d}".format(allele_count))
if name not in feature_id:
uniquename = uniquename.replace('<allele_name>', allele_name)
print(f"NOTICE: processing {name} {uniquename}")
if name == uniquename:
cursor.execute(dbxref_sql, (db_id['FlyBase'], uniquename))
dbxref_id = cursor.fetchone()[0]
cursor.execute(feat_sql, (dbxref_id, org_id, name, uniquename,
"", 0, cvterm_id[feat_details['type']]))
feat2_id = cursor.fetchone()[0]

# add synonyms
cursor.execute(syn_sql, (name, cvterm_id['symbol'], name))
symbol_id = cursor.fetchone()[0]

# add feature_synonym
cursor.execute(fs_sql, (symbol_id, feat2_id, pub_id, True))
elif name not in feature_id:
# create dbxref, accession -> uniquename
cursor.execute(dbxref_sql, (db_id['FlyBase'], uniquename))
dbxref_id = cursor.fetchone()[0]
Expand Down Expand Up @@ -374,13 +389,15 @@ def add_relationships(rela_list, cursor, count, tool_name, gene_name, allele_nam
mess = feature_relationship_add(cursor, count, item, tool_name, gene_name, allele_name, feat1_id,
cvterm_id, org_id, db_id, rela_pub, feature_id, org_dict)
log += " {}".format(mess)

return log


def create_gene_alleles(cursor, org_dict, feature_id, cvterm_id, db_id, pub_id,
num_genes=5, num_alleles=3, gene_prefix=None, allele_prefix=None,
tool_prefix=None, gene_relationships=None, allele_relationships=None, pub_format=None,
gene_props=None, allele_props=None, org_abbr='Dmel', allele_org_abbr='Dmel'
gene_props=None, allele_props=None, org_abbr='Dmel', allele_org_abbr='Dmel',
add_same_name=False
):
"""Create the genes and alleles.

Expand Down Expand Up @@ -411,6 +428,8 @@ def create_gene_alleles(cursor, org_dict, feature_id, cvterm_id, db_id, pub_id,
alelele_props: <dict>props to be added to each allele. dict has a field: [proptype, value] format
org_abbr: <string> (default 'Dmel') abbreviation for the organism.
allele_org_abbr: <string> (default 'Dmel') abbreviation for the alleles organism.
add_same_name: <bool> Some tests require an allele relationship of the same name.
See PDEV-PDEV-251
Return List: List of genes and their alleles.
[gene_id1, [allele_id1, allele_id2],
gene_id2, [allele_id3, allele_id4]]
Expand All @@ -430,6 +449,11 @@ def create_gene_alleles(cursor, org_dict, feature_id, cvterm_id, db_id, pub_id,
'uniquename': 'FBto<number>',
'type': 'engineered_region',
'relationship': 'associated_with'})
if add_same_name:
allele_relationships.append({'name': "<allele_name>",
'uniquename': '<allele_name>',
'type': 'point_mutation',
'relationship': 'partof'})
gene_allele_list = []
for i in range(num_genes):
if pub_format:
Expand Down Expand Up @@ -632,7 +656,8 @@ def create_merge_allele(cursor, org_dict, feature_id, cvterm_id, db_id, pub_id):
allele_prefix=None,
tool_prefix='Clk',
allele_relationships=allele_relationships,
pub_format="merge_title_"
pub_format="merge_title_",
add_same_name=True
)
for g_a in gene_alleles:
print("gene {}".format(g_a[0]))
Expand Down