Skip to content

Commit

Permalink
Fix typo in SQL query and adjust behavior when Ensembl cannot resolve…
Browse files Browse the repository at this point in the history
… taxonomy (#148)
  • Loading branch information
sundarvenkata-EBI authored May 5, 2023
1 parent c25578d commit e011363
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions eva_submission/eload_ingestion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import csv
import os
import requests
import shutil
import subprocess
from pathlib import Path
Expand Down Expand Up @@ -422,7 +423,7 @@ def _get_supported_assembly_from_evapro(self, tax_id: int = None):
with self.metadata_connection_handle as conn:
current_query = (
f"SELECT assembly_id FROM {SUPPORTED_ASSEMBLY_TRACKER_TABLE}"
f"WHERE taxonomy_id={tax_id} AND current=true;"
f" WHERE taxonomy_id={tax_id} AND current=true;"
)
results = get_all_results_for_query(conn, current_query)
if len(results) > 0:
Expand All @@ -432,7 +433,13 @@ def _get_supported_assembly_from_evapro(self, tax_id: int = None):

def _insert_new_supported_asm_from_ensembl(self, tax_id: int = None):
tax_id = tax_id or self.taxonomy
target_assembly = get_supported_asm_from_ensembl(tax_id)
target_assembly = None
try:
target_assembly = get_supported_asm_from_ensembl(tax_id)
except requests.exceptions.HTTPError as ex:
# Ensembl throws HTTP 400 Error if it cannot resolve a tax ID
if ex.errno == 400:
pass
if target_assembly:
add_to_supported_assemblies(self.metadata_connection_handle, source_of_assembly='Ensembl',
target_assembly=target_assembly, taxonomy_id=tax_id)
Expand Down

0 comments on commit e011363

Please sign in to comment.