Skip to content

Commit

Permalink
update call to pass a test
Browse files Browse the repository at this point in the history
  • Loading branch information
tcezard committed Apr 22, 2024
1 parent 8b0e334 commit 3f33912
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion eva_submission/eload_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def check_variant_db(self):
metadata_connection_handle=conn,
assembly_accession=assembly,
taxonomy_id=self.taxonomy,
ncbi_api_key=cfg['eutils_api_key']
ncbi_api_key=cfg.get('eutils_api_key')
)

for db_info in assembly_to_db_name.values():
Expand Down
6 changes: 3 additions & 3 deletions eva_submission/eload_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def get_reference_fasta_and_report(species_name, reference_accession, output_dir
if NCBIAssembly.is_assembly_accession_format(reference_accession):
assembly = NCBIAssembly(
reference_accession, species_name, output_directory,
eutils_api_key=cfg['eutils_api_key']
eutils_api_key=cfg.get('eutils_api_key')
)
if not os.path.isfile(assembly.assembly_fasta_path) or not os.path.isfile(assembly.assembly_report_path) or overwrite:
assembly.download_or_construct(overwrite=overwrite)
return assembly.assembly_fasta_path, assembly.assembly_report_path
elif NCBISequence.is_genbank_accession_format(reference_accession):
reference = NCBISequence(reference_accession, species_name, output_directory,
eutils_api_key=cfg['eutils_api_key'])
eutils_api_key=cfg.get('eutils_api_key'))
if not os.path.isfile(reference.sequence_fasta_path) or overwrite:
reference.download_contig_sequence_from_ncbi(genbank_only=True)
return reference.sequence_fasta_path, None
Expand All @@ -54,7 +54,7 @@ def resolve_accession_from_text(reference_text):
if NCBIAssembly.is_assembly_accession_format(reference_text):
return [reference_text]
# Search for a reference genome that resolve this text
accession = retrieve_genbank_assembly_accessions_from_ncbi(reference_text, api_key=cfg['eutils_api_key'])
accession = retrieve_genbank_assembly_accessions_from_ncbi(reference_text, api_key=cfg.get('eutils_api_key'))
if accession:
return accession

Expand Down
4 changes: 2 additions & 2 deletions eva_submission/vep_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def get_species_and_assembly(assembly_acc):
Returns None if the taxonomy is not known.
"""
# We first need to search for the species associated with the assembly
assembly_dicts = get_ncbi_assembly_dicts_from_term(assembly_acc, api_key=cfg['eutils_api_key'])
assembly_dicts = get_ncbi_assembly_dicts_from_term(assembly_acc, api_key=cfg.get('eutils_api_key'))
taxid_and_assembly_name = set([
(assembly_dict.get('taxid'), assembly_dict.get('assemblyname'))
for assembly_dict in assembly_dicts
Expand Down Expand Up @@ -253,7 +253,7 @@ def recursive_nlst(ftp, root, pattern):

@retry(tries=4, delay=2, backoff=1.2, jitter=(1, 3), logger=logger)
def download_and_extract_vep_cache(ftp, vep_cache_file, taxonomy_id):
scientific_name = retrieve_species_scientific_name_from_tax_id_ncbi(taxonomy_id, api_key=cfg['eutils_api_key'])
scientific_name = retrieve_species_scientific_name_from_tax_id_ncbi(taxonomy_id, api_key=cfg.get('eutils_api_key'))
species_name = scientific_name.replace(' ', '_').lower()

tmp_dir = tempfile.TemporaryDirectory()
Expand Down
2 changes: 0 additions & 2 deletions tests/resources/submission_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ ena:
ftpport: 22
username: demo
password: password

eutils_api_key: test

0 comments on commit 3f33912

Please sign in to comment.