Did not find any barcode-spots of the specified object in input for 'feature_df'. #57
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.
Hi,
When I run the function runCnvAnalysis(), I got this error:
Error in addFeatures(object = object, feature_df = ordered_cnv_df2, overwrite = TRUE) : Did not find any barcode-spots of the specified object in input for 'feature_df'.
After careful debugging, I found that the problem arises from the barcode name processing in the runCnvAnalysis() function. The function changes the barcode names, whereas the barcode in the spata2 objects are not changed. Thereby, the barcode name discrepancy appears.
Specifically, after testing the source code in the runCnvAnalysis() function, I found that the barcodes’ dot symbols are all changed to hyphen symbols by using
stringr::str_replace_all(string = barcodes, pattern = "\\.", replacement = "-")
. I see the replacement is meaningful, because the statementresults <- utils::read.table(result_dir)
reads the file from disk and make all the hyphen changed to dot in the column names, which is a default behavior of R language. So there is a need to replace all dot back to hyphen.However, changing the barcode names in the function might not be the best way to handle the custom barcode naming conventions from different users. In our case, our barcode names have dot as well as hyphen to designate the hierarchical structure of the naming levels. So, here I propose a way to keep the barcode unchanged while keep the code running and to make the barcode name consistent with the one in the spata2 object. My solution is to read the file with the parameter
check.names = FALSE
, like thisutils::read.table(result_dir, check.names = FALSE)
. This way all the hyphens are kept and not changed to dot. Then the dot to hyphen conversion statements are all deleted. After testing the barcode names in different R object produced thereafter, I found the barcode name without any change works well throughout the rest of the function runCnvAnalysis() as well as addFeatures() called by runCnvAnalysis().Thanks for your contribution to the field and help to our research.
Best,