Fixing query logic & order of operations for automated AnnData DE jobs (SCP-5946) #2213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BACKGROUND & CHANGES
This update addresses two corner cases when processing differential expression jobs from AnnData files:
The query to find the associated matrix file (i.e. the AnnData file) can fail if the
ExpressionFileInfo
document is not properly initialized. There was only one recorded instance of this, so it is unclear if there is a related bug or this is simply user error, but it causesDifferentialExpressionResult
objects to not properly save, even though the output files successfully generated. Jobs will continually retry on this file every time a qualifying ingest event checks if the study is eligible for DE. Now, instead of directly querying on that nested document, the convenience methodstudy_file.is_raw_counts_file?
is used as this is more robust across different file types. Also, the filename query was updated to only referenceupload_file_name
as this value is always set, regardless of how the file was uploaded.If raw counts data is extracted after the initial file upload by the user or an admin specifying via the upload wizard, automated downstream DE jobs do not properly launch because the check for eligibility happens before the file is updated to indicate it had raw counts data extracted. Now, the order of these operations is switched and DE eligibility is checked last.
MANUAL TESTING
To test the fix for the file query issue:
ExpressionFileInfo
document and then remove it from the source fileTo test the DE job launch issue:
Save
on the expression tab form. This should launch a job to re-extract the raw counts info indevelopment.log
:development.log
(there should be at least one, but it will depend on eligible annotations/clusters in this study):