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

Make sure dimensions for UMAPs exist #651

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

allyhawkins
Copy link
Member

When trying to generate the test data, I came across this error in the cell type report, where the dimensions set in the chunk options don't always exist. For each cell type annotation method, we have a chunk that is evaluated only if that method exists. Here was where we were defining the dimensions to use to create the UMAP in the following chunk. The problem with this approach is that if a method doesn't exist, then the dimensions don't get assigned to a variable. Then in the chunk where we create the UMAP we define the figure height and width with variables that don't exist. So here I'm just setting all the dimensions to a dummy set of dimensions in the event that a cell type method wasn't used. That way the variable exists when going to the UMAP chunk, even if that chunk doesn't get evaluated.

Copy link
Member

@sjspielman sjspielman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me!

Though, a less verbose way to do this could be something like...

# before anything else
umap_dims <- c(1,1)

And updating those values with submitter, singler, and cellassign for each subsequent chunk. We'd then change all the chunk params to fig.width = umap_dims[1], fig.height = umap_dims[2]. In other words, there would not be submitter_dims, singler_dims, or cellassign_dims variables anymore.

I don't really know which is better. I love the verbosity of variable names to make sure things are in the right spot, but the option I suggested above reduces the amount of code. So...pick your favorite!

Either way, happy to approve now since this code works too!

@allyhawkins
Copy link
Member Author

I don't really know which is better. I love the verbosity of variable names to make sure things are in the right spot, but the option I suggested above reduces the amount of code. So...pick your favorite!

Hmmm I think I like being explicit since the dims could be different based on the number of cell types. So instead of overwriting them, we should name them separately.

@allyhawkins allyhawkins merged commit 3cbff62 into development Jan 11, 2024
3 checks passed
@allyhawkins allyhawkins deleted the allyhawkins/set-up-fake-dims branch January 11, 2024 17:16
allyhawkins added a commit that referenced this pull request Jan 25, 2024
@allyhawkins allyhawkins mentioned this pull request Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants