Skip to content

Commit

Permalink
Fixing get_genesets_by_hom_id function
Browse files Browse the repository at this point in the history
  • Loading branch information
bergsalex committed Sep 20, 2024
1 parent a548259 commit f12bb57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-legacy"
version = "1.4.5"
version = "1.4.6"
description = ""
authors = ["Alexander Berger <[email protected]>"]
readme = "README.md"
Expand Down
14 changes: 6 additions & 8 deletions src/geneweaverdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3921,18 +3921,16 @@ def get_geneset_hom_ids(gs_id):

def get_genesets_by_hom_id(hom_ids):
"""
Find which genesets are associated with which arrays. postgres does not have an any to
any array comparision so I have to loop :(
Find which genesets are associated with which arrays.
:param hom_ids:
:return: list of genesets
"""
geneset_list = []
with PooledCursor() as cursor:
geneset_list = []
for h in hom_ids:
cursor.execute('SELECT geneset_array FROM extsrc.hom2geneset WHERE hom_id=%s', (h,))
geneset_list.append(cursor.fetchone()[0])
list(set(geneset_list[0]))
return geneset_list
cursor.execute("SELECT geneset_array FROM extsrc.hom2geneset WHERE hom_id=ANY(%s)", (hom_ids,))
for result in cursor.fetchall():
geneset_list.extend(result[0])
return list(set(geneset_list))


def get_genesets_hom_ids(gs_ids):
Expand Down

0 comments on commit f12bb57

Please sign in to comment.