From deba20e153aed973e8403aa8b403cd0c5a34b88f Mon Sep 17 00:00:00 2001 From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:32:05 +0200 Subject: [PATCH] Small fixes --- ena-submission/README.md | 23 ++++++++++++++++++++--- ena-submission/Snakefile | 9 +++++---- ena-submission/scripts/create_assembly.py | 4 +++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/ena-submission/README.md b/ena-submission/README.md index c244a6c52..2c55fdc54 100644 --- a/ena-submission/README.md +++ b/ena-submission/README.md @@ -201,7 +201,7 @@ curl -X 'POST' 'http://localhost:8079/groups' \ "country": "Germany" }, "contactEmail": "something@loculus.org"}' -loculus_accession = $(curl -X 'POST' \ +LOCULUS_ACCESSION = $(curl -X 'POST' \ 'http://localhost:8079/cchf/submit?groupId=1&dataUseTermsType=OPEN' \ -H 'accept: application/json' \ -H "Authorization: Bearer ${JWT}" \ @@ -231,9 +231,26 @@ snakemake trigger_submission_to_ena_from_file Alternatively you can upload data to the [test folder](https://github.com/pathoplexus/ena-submission/blob/main/test/approved_ena_submission_list.json) and run `snakemake trigger_submission_to_ena`. -5. Create project, sample and assembly: `snakemake results/project_created results/sample_created results/assembly_created` - you will need the credentials of the ENA test submission account for this. +5. Create project, sample and assembly: `snakemake results/project_created results/sample_created results/assembly_created` - you will need the credentials of the ENA test submission account for this. (You can terminate the rules after you see assembly creation has been successful, or earlier if you see errors.) -6. Note that ENA's dev server does not always finish processing and you might not receive a `gcaAccession` for your dev submissions. If you would like to test the full submission cycle on the ENA dev instance it makes sense to manually alter the gcaAccession in the database to `ERZ24784470` (a known test submission with 2 chromosomes/segments - sadly ERZ accessions are private so I do not have other test examples). +6. Note that ENA's dev server does not always finish processing and you might not receive a `gcaAccession` for your dev submissions. If you would like to test the full submission cycle on the ENA dev instance it makes sense to manually alter the gcaAccession in the database to `ERZ24784470` (a known test submission with 2 chromosomes/segments - sadly ERZ accessions are private so I do not have other test examples). You can do this after connecting via pgAdmin or connecting via the CLI: + +```sh +psql -h 127.0.0.1:5432 -U postgres -d loculus +``` + +Then perform the update: + +```sql +SET search_path TO "ena-submission"; +UPDATE assembly_table +SET result = '{"erz_accession": "ERZ24784470", "segment_order": ["L", "M"]}'::jsonb +WHERE accession = '$LOCULUS_ACCESSION'; +``` + +Exit `psql` using `\q`. + +7. Upload to loculus (you can run the webpage locally if you would like to see this visually), `snakemake results/assembly_created results/uploaded_external_metadata`. If you experience issues you can look at the database locally using pgAdmin. On local instances the password is `unsecure`. diff --git a/ena-submission/Snakefile b/ena-submission/Snakefile index 4954131cb..32ec0d227 100644 --- a/ena-submission/Snakefile +++ b/ena-submission/Snakefile @@ -13,10 +13,6 @@ for key, value in defaults.items(): if not key in config: config[key] = value -Path("results").mkdir(parents=True, exist_ok=True) -with open("results/config.yaml", "w") as f: - f.write(yaml.dump(config)) - LOG_LEVEL = config.get("log_level", "INFO") SUBMIT_TO_ENA_PROD = config.get("submit_to_ena_prod", False) SUBMIT_TO_ENA_DEV = not SUBMIT_TO_ENA_PROD @@ -38,6 +34,11 @@ if SUBMIT_TO_ENA_PROD: config["ena_reports_service_url"] = "https://www.ebi.ac.uk/ena/submit/report" +Path("results").mkdir(parents=True, exist_ok=True) +with open("results/config.yaml", "w") as f: + f.write(yaml.dump(config)) + + rule all: input: triggered="results/triggered", diff --git a/ena-submission/scripts/create_assembly.py b/ena-submission/scripts/create_assembly.py index 65f329a53..7173ea55b 100644 --- a/ena-submission/scripts/create_assembly.py +++ b/ena-submission/scripts/create_assembly.py @@ -368,7 +368,9 @@ def assembly_table_create( ) continue logger.info(f"Starting assembly creation for accession {row["accession"]}") - segment_order = get_segment_order(sample_data_in_submission_table[0]["unaligned_sequences"]) + segment_order = get_segment_order( + sample_data_in_submission_table[0]["unaligned_nucleotide_sequences"] + ) assembly_creation_results: CreationResults = create_ena_assembly( ena_config, manifest_file, center_name=center_name, test=test )