serratus-bio / serratus.io

Front-end code for Serratus project website
https://serratus.io
GNU Affero General Public License v3.0
11 stars 11 forks source link

Add pre-filled URL for `palmID` page #186

Closed ababaian closed 1 year ago

ababaian commented 2 years ago

For BLAST, you can "pre-fill" the submission form by parsing the URL correctly. Such as:

So for https://blast.ncbi.nlm.nih.gov/Blast.cgi you can submit parameters/sequences using such as

https://blast.ncbi.nlm.nih.gov/Blast.cgi?PAGE_TYPE=BlastSearch&USER_FORMAT_DEFAULTS=on&SET_SAVED_SEARCH=true&PAGE=Proteins&PROGRAM=blastp&GAPCOSTS=11%201&DATABASE=nr&BLAST_PROGRAMS=blastp&MAX_NUM_SEQ=100&SHORT_QUERY_ADJUST=on&EXPECT=0.05&WORD_SIZE=6&MATRIX_NAME=BLOSUM62&COMPOSITION_BASED_STATISTICS=2&PROG_DEFAULTS=on&SHOW_OVERVIEW=on&SHOW_LINKOUT=on&ALIGNMENT_VIEW=Pairwise&MASK_CHAR=2&MASK_COLOR=1&GET_SEQUENCE=on&NEW_VIEW=on&NUM_OVERVIEW=100&DESCRIPTIONS=100&ALIGNMENTS=100&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&JOB_TITLE=%3EpalmID_u22027|Alphacoronavirus%201&QUERY=-------------MGWDYPKCDRALPNMIRMASAMILGSKH-VGCCTHSDRFYRLSNELAQVLTEVVHCTGGFYFKPGGTTSGDGTIAYANSAFNIFQAVSANVNKL----------------LGVDSNACNNVTVKSIQRKIYDN---CYRSSS--IDEEFVVEYFSYLRKHFSMMILSDDGVV------------------------------------------------------------------

This feature will add URL parsing for the https://serratus.io/palmid page such that it can accept a fasta sequence input, and thus a user will only have to one-click "submit" to analyze the sequence.

Thus to pre-submit the input string:

>palmID_u22027
AMGWDYPKCDRALPNMIRMASAMILGSKHVGCCTHSDRFYRLSNELAQV
LTEVVHCTGGFYFKPGGTTSGDGTIAYANSAFNIFQAVSANVNKLLGVD
SNACNNVTVKSIQRKIYDNCYRSSSIDEEFVVEYFSYLRKHFSMMILSD
DGVV

Where > is %3E and \n is %0A, the example above this would be:

https://serratus.io/palmid?=%3EpalmID_u22027%0AAMGWDYPKCDRALPNMIRMASAMILGSKHVGCCTHSDRFYRLSNELAQV%0ALTEVVHCTGGFYFKPGGTTSGDGTIAYANSAFNIFQAVSANVNKLLGVD%0ASNACNNVTVKSIQRKIYDNCYRSSSIDEEFVVEYFSYLRKHFSMMILSD%0ADGVV
victorlin commented 2 years ago

This should be fairly straightforward. We do the same for the Explorer results page (e.g. https://serratus.io/explorer/rdrp?run=ERR2756788).

  1. Add a parameter to the component definition: https://github.com/serratus-bio/serratus.io/blob/4cc21ac212dc114823c37bf656fa834e177c8d18/src/components/Palmid/Palmid.tsx#L10

    Example: https://github.com/serratus-bio/serratus.io/blob/4cc21ac212dc114823c37bf656fa834e177c8d18/src/components/Explorer/Base/Result/RunLookup/RunLookup.tsx#L14

  2. Use URLSearchParams.get() to set the value if it's present. Example: https://github.com/serratus-bio/serratus.io/blob/4cc21ac212dc114823c37bf656fa834e177c8d18/src/components/Explorer/Base/ExplorerBase.tsx#L80

ababaian commented 2 years ago

PR open (but not complete) https://github.com/serratus-bio/serratus.io/pull/188