Skip to content

Commit

Permalink
Search box: cope with weird PMID formatting
Browse files Browse the repository at this point in the history
Handle things like "PMID 38830897", "PubMed_38830897" or
"PMID38830897".

Refs #2275
  • Loading branch information
kimrutherford committed Nov 12, 2024
1 parent 37c6f8e commit 8ab682d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/search-box/search-box.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,15 @@ export class SearchBoxComponent implements OnInit {
}

observableFromToken(token: string): Observable<Array<DisplayModel>> {
token = token.trim();
let observables = [];
const geneSummaryObservable = of(this.summariesFromToken(token));
observables.push(geneSummaryObservable);

token = token.replace(this.sysGeneIdRe, '').replace(this.sysTranscriptIdRe, '').trim();
token = token.replace(/^PMID: +/, 'PMID:'); // handle copy and paste from PubMed pages

// handle copy and paste from PubMed pages, and other weird things that happen to PMIDs
token = token.replace(/^(PMID|PubMed)[: _\-]*/i, 'PMID:');

if (token.length > 0) {
// for now we filter out systematic IDs because they cause Lucene problems
Expand Down

0 comments on commit 8ab682d

Please sign in to comment.