Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against invalid Salmon JSON output #1172

Merged
merged 1 commit into from
Mar 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions workers/data_refinery_workers/processors/salmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,20 +990,29 @@ def _run_salmon(job_context: Dict) -> Dict:
kv.is_public = True
kv.save()

with open(os.path.join(job_context['output_directory'], 'lib_format_counts.json')) as lfc_file:
format_count_data = json.load(lfc_file)
kv = ComputationalResultAnnotation()
kv.data = format_count_data
kv.result = result
kv.is_public = True
kv.save()
with open(os.path.join(job_context['output_directory'], 'aux_info', 'meta_info.json')) as mi_file:
meta_info = json.load(mi_file)
kv = ComputationalResultAnnotation()
kv.data = meta_info
kv.result = result
kv.is_public = True
kv.save()
try:
with open(os.path.join(job_context['output_directory'], 'lib_format_counts.json')) as lfc_file:
format_count_data = json.load(lfc_file)
kv = ComputationalResultAnnotation()
kv.data = format_count_data
kv.result = result
kv.is_public = True
kv.save()
except Exception:
# See: https://github.com/AlexsLemonade/refinebio/issues/1167
logger.exception("Error parsing Salmon lib_format_counts JSON output!", processor_job=job_context["job_id"])

try:
with open(os.path.join(job_context['output_directory'], 'aux_info', 'meta_info.json')) as mi_file:
meta_info = json.load(mi_file)
kv = ComputationalResultAnnotation()
kv.data = meta_info
kv.result = result
kv.is_public = True
kv.save()
except Exception:
# See: https://github.com/AlexsLemonade/refinebio/issues/1167
logger.exception("Error parsing Salmon meta_info JSON output!", processor_job=job_context["job_id"])

job_context["success"] = True

Expand Down