Skip to content

Commit

Permalink
feat: separator for gene list or hpo terms (#1196) (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo authored Mar 25, 2024
1 parent 64e979a commit ba73b99
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
11 changes: 6 additions & 5 deletions svs/vueapp/src/components/SvFilterForm/GenesRegionsPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,15 @@ defineExpose({
ref="geneAllowListRegionTextareaRef"
v-model="props.querySettings.gene_allowlist"
:validate="validateGeneBatch"
:tokenize="/([^\s;,]+)/g"
/>
<small class="form-text">
Enter a list of genes to restrict your query to, separated with
spaces. You can use gene symbols, HGNC ids, ENSEMBL gene IDs, or
Entrez Gene IDs. For example, all of the following code for TGDS
(TDP-glucose 4,6-dehydratase): <code>TGDS</code>,
<code>HGNC:20324</code>, <code>ENSG00000088451</code>,
<code>23483</code>.
spaces, tabs, <code>;</code> or <code>,</code>. You can use gene
symbols, HGNC ids, ENSEMBL gene IDs, or Entrez Gene IDs. For example,
all of the following code for TGDS (TDP-glucose 4,6-dehydratase):
<code>TGDS</code>, <code>HGNC:20324</code>,
<code>ENSG00000088451</code>, <code>23483</code>.
</small>
</div>
</div>
Expand Down
13 changes: 7 additions & 6 deletions variants/vueapp/src/components/FilterForm/GenesRegionsPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,15 @@ defineExpose({
ref="geneAllowListRegionTextareaRef"
v-model="props.querySettings.gene_allowlist"
:validate="validateGeneBatch"
:tokenize="/([^\s;,]+)/g"
/>
<small class="form-text">
Enter a list of genes to restrict your query to, separated with
spaces. You can use gene symbols, HGNC ids, ENSEMBL gene IDs, or
Entrez Gene IDs. For example, all of the following code for TGDS
(TDP-glucose 4,6-dehydratase): <code>TGDS</code>,
<code>HGNC:20324</code>, <code>ENSG00000088451</code>,
<code>23483</code>.
Enter a list of genes to restrict your query to, separated by spaces,
tabs, <code>;</code> or <code>,</code>. You can use gene symbols, HGNC
ids, ENSEMBL gene IDs, or Entrez Gene IDs. For example, all of the
following code for TGDS (TDP-glucose 4,6-dehydratase):
<code>TGDS</code>, <code>HGNC:20324</code>,
<code>ENSG00000088451</code>, <code>23483</code>.
</small>
</div>
</div>
Expand Down
11 changes: 6 additions & 5 deletions variants/vueapp/src/components/HpoTermInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ const refreshTextValue = async (termsArray) => {
/** Refresh model value from text value. */
const refreshModelValue = () => {
const regex = /(HP:\d{7}|OMIM:\d{6}|DECIPHER:\d+|ORPHA:\d+)( - [^;]+)?(;|$)/g
const regex =
/(HP:\d{7}|OMIM:\d{6}|DECIPHER:\d+|ORPHA:\d+)( - [^;,]+)?(;|,|$)/g
const cleanTextValue = (textValue.value || '')
.replace(/^\s*;?\s*|\s*;?\s*$/g, '') // replace any cruft in beginning or end of the string
.replace(/^\s*[;,]?\s*|\s*[;,]?\s*$/g, '') // replace any cruft in beginning or end of the string
.replace(/\s{2,}/g, ' ') // replace double (or more) spaces with one space
.replace(/[;\s]{2,}/g, '; ') // replace any sequence of multiple ; and spaces with `; `
.replace(/;([^\s$])/g, '; $1') // add missing space after semicolon
.replace(/([^;])\s(HP|OMIM|DECIPHER|ORPHA):/g, '$1; $2:') // set missing semicolons in front of HPO id
.replace(/[;,\s]{2,}/g, '; ') // replace any sequence of multiple ; and spaces with `; `
.replace(/[;,]([^\s$])/g, '; $1') // add missing space after semicolon
.replace(/([^;,])\s(HP|OMIM|DECIPHER|ORPHA):/g, '$1; $2:') // set missing semicolons in front of HPO id
const hpoSelected = []
let result
while ((result = regex.exec(cleanTextValue))) {
Expand Down
2 changes: 1 addition & 1 deletion variants/vueapp/src/components/TokenizingTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const props = defineProps({
* other - tokenize based on whitespace
*/
// eslint-disable-next-line vue/require-default-prop
tokenize: Function,
tokenize: RegExp,
/**
* Definition on token validation
*
Expand Down

0 comments on commit ba73b99

Please sign in to comment.