Fix DE result filenames to correctly handle N/A-type metadata values (SCP-4436) #261
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.
This PR modifies DE to only convert empty cells to --Unspecified-- and leaves NA strings as-is so they are faithful to values in the metadata file.
Background:
Currently N/A-like strings as annotation labels currently will not display DE results. Pandas detects empty cells as numeric NaN which is problematic for group annotations so DE converts those values to --Unspecified-- as the DE annotation label. Unfortunately, pandas also converts a set of default NaN recognized values (like N/A). Since we construct the file name for data retrieval from annotationList values - if the value is one of the "pandas default NaN recognized values", the value in the filename is --Unspecified-- instead of N/A so the file is not found. ().
Manual test:
activate the scp-ingest-pipeline repo virtualenv
then from the scripts directory of the scp-ingest-pipeline repo, perform this setup:
Run the DE job from the ingest directory of the scp-ingest-pipeline repo:
python ingest_pipeline.py --study-id addedfeed000000000000000 --study-file-id dec0dedfeed1111111111111 differential_expression --annotation-name cell_type__ontology_label --annotation-type group --annotation-scope study --matrix-file-path ../tests/data/differential_expression/de_dense_matrix.tsv --matrix-file-type dense --annotation-file ../tests/data/differential_expression/de_dense_metadata_na.txt --cluster-file ../tests/data/differential_expression/de_dense_cluster.tsv --cluster-name de_na --study-accession SCPna --differential-expressionconfirm that the job runs successfully and the output files have the expected filenames:
This PR satisfies SCP-4436.