fungenomics / braindex

A web portal for exploring scRNAseq data in the developing brain, including our in-house atlas of the E10-P6 forebrain and brainstem
http://cc-shiny-01.functionalgenomics.ca/braindex/clusters/
GNU General Public License v3.0
0 stars 1 forks source link

Allow user to upload a file containing a list of genes to interrogate #17

Closed bhavyaac closed 3 years ago

bhavyaac commented 3 years ago

If this is implemented, the app will need to provide informative error messages on whether uploaded genes exist or not in the database - see issue #1

bhavyaac commented 3 years ago

Just managed to set this up! Some notes on my implementation for future me are below - I hope to include the relevant parts for the user in a future landing page!

I still need to work on creating an error message for genes that do not exist in the database.

sjessa commented 3 years ago

@bhavyaac Nice, thanks for the notes & details! This sounds great ☺️ Here are a couple comments:

bhavyaac commented 3 years ago

The main suggestion I would make is to use as input either the text box OR the file, if that's doable on the back-end! To me, it seems a bit unintuitive to append them, and to not have to clear any genes in the input box if a user decides to use a gene file (so the file would take precedence over text box input)

This makes a lot of sense. I'll work on creating a toggle for the user to choose between textbox input and gene list upload. I can condition which data is used in the app based on the state of the toggle, so only one would ever be used at a time. Let me know if that fits what you had in mind.

That's cool that the formatting of the input file works either way! I think even if this is the case, I'd still specify a preferred formatting in the docs, that way we give people just one option and don't invite any confusion πŸ™‚

This makes sense for sure! One other thing I would add to the docs is that I used certain encodings (UTF-8 for reading, UTF-8 BOM to remove extra lines associated with the file type when passing as input to the code). This works with the test files I used, which were csv files that I saved through Excel. If the file that the user provides is created with a different encoding, the file input won't work, and I'm not sure if there's a way to detect the encoding and respond with an error message, so it would be great if we could inform the user about this in the docs.

bhavyaac commented 3 years ago

Here is a gif preview of the toggle function! toggle_file_upload

bhavyaac commented 3 years ago

Something else to add to file upload documentation: The URL bookmarking system doesn't save the gene input(s) from the file, only the current state of the textbox inputs. On the other hand, the server-side bookmarking system seems to store the gene inputs from the file within the bookmarked page. (I tested this locally, but it might also be related to Shiny's tendency to cache input files, and not necessarily the bookmark storage...)

bhavyaac commented 3 years ago

I've just implemented a basic error message for genes that are not in the database. It works by comparing all of the gene names (i.e. strings) in the file with the list of genes that are provided as choices in the textbox. The next step would be to check against the annotation as well, as mentioned in issue #1. Some details:

This is what it looks like. I'm still trying to find a way to hide download button(s) if the error message was triggered, any ideas would be great! image

bhavyaac commented 3 years ago

Another note for documentation: the gene input is case sensitive, so genes that are capitalized differently will also produce validate() errors! Whitespaces after the gene name will also cause errors. See issue #1 for more discussion on making the validation more user-friendly by providing more detailed error messages.

sjessa commented 3 years ago

@bhavyaac

This is what it looks like. I'm still trying to find a way to hide download button(s) if the error message was triggered, any ideas would be great!

Maybe we can discuss this one when we meet -- if I understand correctly, we need to find a way for the download handlers to listen for the validate() output- we can do some brainstorming!