Skip to content

Commit

Permalink
Noissue. Search by multiple random genes
Browse files Browse the repository at this point in the history
  • Loading branch information
const8ine committed Sep 16, 2024
1 parent 8d607c5 commit c329d1a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/app/pages/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,22 @@ export class HomeComponent implements OnInit {
.pipe(takeUntil(this.subscription$))
.subscribe((gene) => {
this.genesList = gene.map((g) => g.symbol);
if (this.genesList.length > 0) {
this.randomHGNC = this.genesList[Math.floor(Math.random() * this.genesList.length)];

if (this.genesList.length !== 0) {
const n = 5;
const repeatCount = Math.floor(Math.random() * n) + 1;
const strArr = [];
for (let i = 0; i < repeatCount; i++) {
const randomGene = this.genesList[Math.floor(Math.random() * this.genesList.length)];
strArr.push(randomGene);
}

this.randomHGNC = strArr.join(',');
}
});
});
}


private getHints(query: string): void {
if (query && query.length > 1) {
this.showProgressBar = true;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"logic_null": "Not specified",
"logic_true": "Yes",
"main_page_all_genes": "All genes",
"main_page_random_gene": "Search for a random gene",
"main_page_random_gene": "Random gene(s)",
"main_page_download_results": "Feed",
"main_page_header_button": "More",
"main_page_header_description": "Open Genes provides structured data on human genes associated with aging:\nfunctions, evolution, the influence of gene activity on lifespan, age-related changes in gene expression, associations of allelic variants of genes with longevity and age-related phenotype.",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"logic_null": "Не указано",
"logic_true": "Да",
"main_page_all_genes": "Все гены",
"main_page_random_gene": "Искать по случайному гену",
"main_page_random_gene": "Случайные гены",
"main_page_download_results": "Выдача",
"main_page_header_button": "Подробнее",
"main_page_header_description": "Open Genes предоставляет структурированные данные о генах человека, ассоциированных со старением: \nфункции, эволюцию, влияние активности гена на продолжительность жизни, возрастные изменения экспрессии гена, ассоциации аллельных вариантов генов с долголетием и возрастным фенотипом.",
Expand Down

0 comments on commit c329d1a

Please sign in to comment.