-
Notifications
You must be signed in to change notification settings - Fork 2
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
Skip sample metadata addition to colData if cellhash is present #664
Skip sample metadata addition to colData if cellhash is present #664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, but I suggested a tiny restructure to reduce nesting and I think you have the test backward?
bin/sce_to_anndata.R
Outdated
if (!(opt$feature_name %in% altExpNames(sce))) { | ||
stop("feature_name must match name of altExp in provided SCE object.") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want this condition first, still, then use } else if (opt$feature_name == "cellhash") {
to reduce nesting depth.
bin/sce_to_anndata.R
Outdated
) | ||
} else { | ||
# warn that the altExp cannot be converted | ||
message( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be consistent in whether we use warning()
or message()
here. I guess I would lean toward warning()
for both?
Co-authored-by: Joshua Shapiro <josh.shapiro@ccdatalab.org>
I updated the order of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with one spacing update
alt_sce, | ||
anndata_file = opt$output_feature_h5 | ||
) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, this else is another else... we need to fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, this is fine, it is the nested if
! (This is what I was saying about failing first... just helps my brain parse it)
Co-authored-by: Joshua Shapiro <josh.shapiro@ccdatalab.org>
When running the multiplexed samples through the workflow, I was getting the following error:
This is because we are using the
sce_to_anndata.R
script to convert all objects to AnnData prior to runningCellAssign
. In a separate process, we use this same script to do the conversion to produce the final AnnData output. However, in that process, we are skipping any multiplexed samples and when runningCellAssign
, we are keeping multiplexed samples. The issue here is that we have a step in theformat_czi
function that merges thecolData
with thesample_metadata
usinglibrary_id
as the join column. This won't work when trying to convert an SCE that contains multiplexed data since thelibrary_id
will match up with multiple samples.To get around this, I added a check in the
format_czi
function to make sure thatcellhash
is not analtExp
found in the SCE object. If so, no sample metadata is added to thecolData
. I also updated the check for convertingaltExp
objects to only convert if the feature name was notcellhash
.