Skip to content

Commit d1fca22

Browse files
committed
remove genomic table stuff
1 parent 1db7e05 commit d1fca22

2 files changed

Lines changed: 24 additions & 37 deletions

File tree

src/cool_seq_tool/sources/uta_database.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,14 @@ async def get_ac_from_gene(self, gene: str) -> list[str]:
652652
:return: List of genomic accessions, sorted in desc order
653653
"""
654654
query = """
655-
SELECT DISTINCT alt_ac
656-
FROM genomic
657-
WHERE hgnc = %(gene)s
658-
AND alt_ac LIKE 'NC_00%%'
659-
ORDER BY alt_ac;
655+
SELECT DISTINCT aes.alt_ac
656+
FROM transcript AS t
657+
JOIN exon_set AS aes
658+
ON t.ac = aes.tx_ac
659+
WHERE t.hgnc = %(gene)s
660+
AND aes.alt_aln_method <> 'transcript'
661+
AND aes.alt_ac LIKE 'NC_00%%'
662+
ORDER BY aes.alt_ac;
660663
"""
661664

662665
cursor = await self.execute_query(query, {"gene": gene})
@@ -683,11 +686,22 @@ async def get_gene_from_ac(
683686
if end_pos is None:
684687
end_pos = start_pos
685688
query = """
686-
SELECT DISTINCT hgnc
687-
FROM genomic
688-
WHERE alt_ac = %(ac)s
689-
AND %(start_pos)s BETWEEN alt_start_i AND alt_end_i
690-
AND %(end_pos)s BETWEEN alt_start_i AND alt_end_i;
689+
SELECT DISTINCT t.hgnc
690+
FROM transcript AS t
691+
JOIN exon_set AS tes
692+
ON t.ac = tes.tx_ac
693+
AND tes.alt_aln_method = 'transcript'
694+
JOIN exon_set AS aes
695+
ON t.ac = aes.tx_ac
696+
AND aes.alt_aln_method <> 'transcript'
697+
JOIN exon AS te
698+
ON tes.exon_set_id = te.exon_set_id
699+
JOIN exon AS ae
700+
ON aes.exon_set_id = ae.exon_set_id
701+
AND te.ord = ae.ord
702+
WHERE aes.alt_ac = %(ac)s
703+
AND %(start_pos)s BETWEEN ae.start_i AND ae.end_i
704+
AND %(end_pos)s BETWEEN ae.start_i AND ae.end_i;
691705
"""
692706
cursor = await self.execute_query(
693707
query, {"ac": ac, "start_pos": start_pos, "end_pos": end_pos}

uta-setup.sql

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)