Skip to content

Enhance STlist documentation and replace regex for sample name checks - #20

Open
kweav wants to merge 1 commit into
FridleyLab:mainfrom
kweav:patch-1
Open

kweav wants to merge 1 commit into
FridleyLab:mainfrom
kweav:patch-1

Conversation

@kweav

@kweav kweav commented Jun 12, 2026 •

Copy link
Copy Markdown

Updated documentation for STlist function and improved sample name validation.

When working with the STlist function for reading in a list of dataframes, I hadn't noticed the requirement to have gene names in the first column for my RNA counts data. So my suggested change adds the note about that requirement from a previous part of the documentation (file paths) to the part of the documentation about lists of data frames.

Also, when providing data where I had formatted my sample IDs in way that matched the stated requirements, I was receiving an error code saying my data didn't follow the allowed pattern. However I was using Br####-DX which followed all of the stated requirements (not beginning with a number but rather a letter, and only having alphanumeric characters, spaces, dashes, or underscores). So I'm suggesting a different regex pattern and have simplified it to only conduct one test rather than two separate ones.

My suggested regex pattern looks for a letter at the beginning (denoted by the caret) and then alpha-numeric, space, dash, or underscore after throughout to the end of the string (denoted by the dollar sign)

I've tested the regex pattern change with several examples, and the test now works as expected. I have not tested if this change has any downstream implications for the spatialGE package.

Updated documentation for STlist function and improved sample name validation.
Comment thread R/STList.R
if(test_number){
# Sample names should begin with letters only and contain only alpha-numerics, spaces, dashes, and underscores
# Regex pattern looks for a letter at the beginning (denoted by the caret) and then alpha-numeric, space, dash, or underscore after throughout to the end of the string (denoted by the dollar sign)
test_sample_name = any(!sapply(sample_names, function(i){grepl("^[A-Za-z][A-Za-z0-9 _-]*$​", i)}))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Could add something so pattern doesn't end with an underscore, space, or dash.

This branch has not been deployed

No deployments
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.

1 participant