Skip to content

Commit

Permalink
Small updates after testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-parker committed Jul 23, 2024
1 parent 992d254 commit 7147777
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
15 changes: 15 additions & 0 deletions ena-submission/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ rule create_project:
--log-level {params.log_level} \
"""

rule create_sample:
input:
script="scripts/create_sample.py",
config="results/config.yaml",
output:
sample_created=touch("results/sample_created"),
params:
log_level=LOG_LEVEL,
shell:
"""
python {input.script} \
--config-file {input.config} \
--log-level {params.log_level} \
"""

rule get_ena_submission_list_and_sleep:
input:
file="results/ena_submission_list.json"
Expand Down
5 changes: 4 additions & 1 deletion ena-submission/scripts/create_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def construct_project_set_object(
project_type = ProjectType(
center_name=XmlAttribute(group_info["institution"]),
alias=XmlAttribute(f"{row["group_id"]}:{row["organism"]}:{config.unique_project_suffix}"),
# alias=XmlAttribute(
# f"{row["group_id"]}:{row["organism"]}:{config.unique_project_suffix}:{datetime.now(tz=pytz.utc)}" # For testing
# ),
name=metadata_dict["scientific_name"],
title=f"{metadata_dict["scientific_name"]}: Genome sequencing",
description=(
Expand Down Expand Up @@ -275,7 +278,7 @@ def create_project(log_level, config_file):
f"Found {len(entries_with_errors)} entries in project_table in status HAS_ERRORS",
f" for {time_threshold}m",
)
for row in ready_to_submit_project:
for row in entries_with_errors:
# TODO: Query ENA to check if project has in fact been created
# If created update project_table
# If not retry 3 times, then raise for manual intervention
Expand Down
2 changes: 1 addition & 1 deletion ena-submission/scripts/ena_submission_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_sample_xml(sample_set):
submission_set = get_submission_dict()
files = {
"SUBMISSION": xmltodict.unparse(submission_set, pretty=True),
"SAMPLE": dataclass_to_xml(sample_set, root_name="PROJECT_SET"),
"SAMPLE": dataclass_to_xml(sample_set, root_name="SAMPLE_SET"),
}
return files

Expand Down
3 changes: 1 addition & 2 deletions ena-submission/scripts/submission_db_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class SubmissionTableEntry:

@dataclass
class ProjectTableEntry:
accession: str
version: str
group_id: int
organism: str
errors: str | None = None
warnings: str | None = None
Expand Down
2 changes: 1 addition & 1 deletion ena-submission/scripts/test_ena_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_sample_set_construction(self):
organism_metadata["taxon_id"] = "Test taxon"
center_name = "Fake center name"
config = mock.Mock()
config.metadata_map = {
config.metadata_mapping = {
"subject exposure": {"loculus_fields": ["exposure_event"]},
"type exposure": {"loculus_fields": ["exposure_event"]},
"hospitalisation": {
Expand Down

0 comments on commit 7147777

Please sign in to comment.