Skip to content

Commit

Permalink
Metabolic pathways visualisation (#731): get species for filtering fr…
Browse files Browse the repository at this point in the history
…om track
  • Loading branch information
DmitriiKrasnov committed Mar 30, 2022
1 parent 7363f6e commit ea1bf20
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export default class NgbGenesTableContextMenuController extends BaseController {
layoutChange.displayed = true;
this.dispatcher.emitSimpleEvent('layout:item:change', {layoutChange});
const readInfo = {
search: this.entity[`${this.ngbGenesTableService.defaultPrefix}featureName`]
search: this.entity[`${this.ngbGenesTableService.defaultPrefix}featureName`],
speciesList: [],
rewriteSpecies: true
};
const data = {
...readInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class ngbInternalPathwaysTableService extends ClientPaginationSer
this.genomeDataService = genomeDataService;
this.loadSpeciesList();
}

_internalPathways;

get internalPathways() {
Expand Down Expand Up @@ -113,13 +114,18 @@ export default class ngbInternalPathwaysTableService extends ClientPaginationSer
}

async loadInternalPathways(currentSearch) {
if (currentSearch.rewriteSpecies) {
this.internalPathwaysFilter.organisms = currentSearch.speciesList;
currentSearch.speciesList = [];
currentSearch.rewriteSpecies = false;
}
const filter = {
pagingInfo: {
pageSize: this.pageSize,
pageNum: this.currentPage
},
sortInfo: this.orderBy ? this.orderBy[0] : null,
term: currentSearch || '',
term: currentSearch.search || '',
taxIds: this.internalPathwaysFilter.organisms || []
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class ngbInternalPathwaysFilterListController {
if (this.ngbInternalPathwaysTableService.internalPathwaysFilter.organisms) {
this.selectedItems = this.ngbInternalPathwaysTableService.speciesList
.filter(organism => this.ngbInternalPathwaysTableService.internalPathwaysFilter.organisms.indexOf(organism.taxId) >= 0)
.map(organism => organism.speciesName);
.map(organism => organism.taxId);
this.displayText = [...this.selectedItems].join(', ');
}
break;
Expand Down Expand Up @@ -146,10 +146,7 @@ export default class ngbInternalPathwaysFilterListController {
prevValue.sort();
const prevValueStr = JSON.stringify(prevValue).toUpperCase();
const currValue = this.ngbInternalPathwaysTableService.speciesList
.filter(organism => organism.speciesName
? selectedItemsLowerCase.indexOf(organism.speciesName.toLowerCase()) >= 0
: selectedItemsLowerCase.indexOf(organism.taxId.toString()) >= 0
)
.filter(organism => selectedItemsLowerCase.indexOf(organism.taxId.toString()) >= 0)
.map(organism => organism.taxId);
currValue.sort();
const currValueStr = JSON.stringify(currValue).toUpperCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class ngbPathwaysService {

initEvents() {
this.dispatcher.on('read:show:pathways', data => {
this.currentSearch = data ? data.search : null;
this.currentSearch = data || null;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export default class ngbPathwaysPanelController extends baseController {
}

searchPathway() {
this.ngbPathwaysService.currentSearch = this.searchRequest;
this.ngbPathwaysService.currentSearch = {
search: this.searchRequest,
speciesList: [],
rewriteSpecies: true
};
this.dispatcher.emitSimpleEvent('pathways:internalPathways:search');
this.changeState('INTERNAL_PATHWAYS');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ export default class ngbTrackEvents {
if (data.feature.feature && data.feature.name) {
const layoutChange = this.appLayout.Panels.pathways;
layoutChange.displayed = true;
const [reference] = this.projectContext.references.filter(ref => ref.id === track.referenceId);
const speciesList = reference && reference.species
? [reference.species.taxId]
: null;
menuData.push({
events: [
{
Expand All @@ -228,7 +232,9 @@ export default class ngbTrackEvents {
},
{
data: {
search: data.feature.name
speciesList,
search: data.feature.name,
rewriteSpecies: true
},
name: 'read:show:pathways'
}],
Expand Down

0 comments on commit ea1bf20

Please sign in to comment.