Skip to content

Commit

Permalink
V1.2.3 Update (#85)
Browse files Browse the repository at this point in the history
* GitHub action test (#83) (#84)

* Create DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update DH_upload.yml

* Update and rename DH_upload.yml to DH_GHCR_upload.yml

* Update DH_GHCR_upload.yml

* Delete .github/workflows/GHCR_docker.yml

* Update DH_GHCR_upload.yml

* Update BioSample/SRA handler to fix bug for one sample
  • Loading branch information
dthoward96 authored Sep 25, 2024
1 parent c4a0d54 commit 90b59ff
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion biosample_sra_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,15 @@ def process_biosample_sra_report(report_file: str, database: str, submission_dir
if "Action" not in report_dict["SubmissionStatus"]:
return submission_status, submission_id
try:
for action_dict in report_dict["SubmissionStatus"]["Action"]:
# If only a single sample, convert into list for proper formatting
if isinstance(report_dict["SubmissionStatus"]["Action"], list):
action_list = report_dict["SubmissionStatus"]["Action"]
elif isinstance(report_dict["SubmissionStatus"]["Action"], dict):
action_list = [report_dict["SubmissionStatus"]["Action"]]
else:
print(f"Error: Unable to correctly process BioSample report at: {report_file}", file=sys.stderr)
return submission_status, submission_id
for action_dict in action_list:
# Skip if incorrect database
if "@target_db" not in action_dict or action_dict["@target_db"].lower() != database.lower():
continue
Expand All @@ -271,6 +279,8 @@ def process_biosample_sra_report(report_file: str, database: str, submission_dir
sample_info.append({sample_name_col:sample_name, f"{column_prefix}_status":action_dict["@status"], f"{column_prefix}_accession":accession, f"{column_prefix}_message":""})
except:
pass
if submission_status == "PROCESSED" and not sample_info:
print(f"Error: Unable to process {database} report.xml to retrieve accessions at: {report_file}", file=sys.stderr)
if sample_info:
update_df = pd.DataFrame(sample_info)
upload_log.update_submission_status_csv(submission_dir=submission_dir, update_database=database, update_df=update_df)
Expand Down

0 comments on commit 90b59ff

Please # to comment.