Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/client/features/interactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class Interactions extends React.Component {
Phosphorylation:true,
Expression:true
}
};
};

const query = queryString.parse(props.location.search);
const sources=_.uniq(_.concat([],query.source));
const kind = sources.length>1?'PATHSBETWEEN':'Neighborhood';
ServerAPI.getNeighborhood(sources,kind).then(res=>{
ServerAPI.getNeighborhood(sources,kind).then(res=>{
const layoutConfig = getLayoutConfig('interactions');
const network= this.parse(res);
this.setState({
Expand All @@ -66,8 +66,8 @@ class Interactions extends React.Component {
loaded:_.assign(this.state.loaded,{network:true})
});
});
//get ids from uris
const geneIds = sources.map(source=>
//get ids from uris
const geneIds = sources.map(source=>
source.includes('pathwaycommons')?
ServerAPI.pcQuery('traverse',{uri:source,path:`${_.last(source.split('/')).split('_')[0]}/displayName`}).then(result=>result.json())
.then(id=> _.words(id.traverseEntry[0].value[0]).length===1 ? id.traverseEntry[0].value[0].split('_')[0] : ''):
Expand Down Expand Up @@ -102,7 +102,7 @@ class Interactions extends React.Component {
});
});
});

this.state.cy.on('trim', () => {
const state = this.state;
const ids = state.ids;
Expand All @@ -124,7 +124,7 @@ class Interactions extends React.Component {
const nodes = edges.connectedNodes();
edges.length?
categories.set(type,{edges:edges,nodes:nodes}):
(categories.delete(type),delete filters[type]);
(categories.delete(type),delete filters[type]);
});

_.tail(_.toPairs(filters)).map(pair=>this.filterUpdate(pair[0]));
Expand Down Expand Up @@ -170,7 +170,7 @@ class Interactions extends React.Component {
if(!nodeMap.has(node)){
const metadata=nodeMetadata.get(node);
nodeMap.set(node,true);
const links=_.uniqWith(_.flatten(metadata.slice(-2).map(entry => entry.split(';').map(entry=>entry.split(':')))),_.isEqual).filter(entry=>entry[0]!='intact');
const links=_.uniqWith(_.flatten(metadata.slice(-2).map(entry => entry.split(';').map(entry=>entry.split(':')))),_.isEqual).filter(entry=>entry[0]!='intact');
network.nodes.push({data:{class: "ball",id: node,label: node, queried: this.state.ids.indexOf(node)!=-1 ,
parsedMetadata:[['Type','bp:'+metadata[0].split(' ')[0].replace(/Reference/g,'').replace(/;/g,',')],['Database IDs', links]]}});
}
Expand Down Expand Up @@ -222,11 +222,11 @@ class Interactions extends React.Component {
cy.remove(edges);
cy.remove(nodes.filter(nodes=>nodes.connectedEdges().empty()));
}
else{
else{
edges.union(nodes).restore();
}
});

filters[type]=!filters[type];
this.setState({
filters:filters
Expand All @@ -246,7 +246,7 @@ class Interactions extends React.Component {
filterUpdate:(evt,type)=> this.filterUpdate(evt,type),
filters: state.filters,
download: {
types: downloadTypes.filter(ele=>ele.type==='png'||ele.type==='sif'),
types: downloadTypes.filter(ele=>ele.type==='png'||ele.type==='sif'),
promise: () => Promise.resolve(_.map(state.cy.edges(),edge=> edge.data().id).sort().join('\n'))
},
}):
Expand Down
23 changes: 16 additions & 7 deletions src/client/features/search/landing-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const Loader = require('react-loader');
const _ = require('lodash');
//usedDatabases=[['Uniprot lookup name',{configName:,gProfiler:}]]
const usedDatabases=new Map ([
['GeneCards',{configName:'Gene Cards',gProfiler:'HGNCSYMBOL'}],
['HGNC',{configName:'HGNC',gProfiler:'HGNC'}],
['GeneID',{configName:'NCBI Gene',gProfiler:'NCBIGene'}],
['Uniprot',{configName:'Uniprot',gProfiler:'Uniprot'}]
['GeneCards',{configName:'Gene Cards',gProfiler:'HGNCSYMBOL',displayName:'Gene Cards'}],
['HGNC Symbol',{configName:'HGNC Symbol',gProfiler:'HGNCSymbol',displayName:'HGNC'}],
['GeneID',{configName:'NCBI Gene',gProfiler:'NCBIGene',displayName:'NCBI Gene'}],
['Uniprot',{configName:'Uniprot',gProfiler:'Uniprot',displayName:'Uniprot'}]
]);

const linkBuilder= (source,geneQuery)=>{
Expand Down Expand Up @@ -47,9 +47,18 @@ const pcFallback = (unrecognized,genes) => {

const idToLinkConverter = (ids) =>{
const dbSet = databases.filter(databaseValue => ids[databaseValue.database]);
return _.assign({},
let dbs = _.assign({},
...dbSet.map(database=>({[database.database]:database.url+database.search+ids[database.database].replace(/[^a-zA-Z0-9:]/g)}))
);

let links = [];
usedDatabases.forEach((usedDatabase)=>{
let dbLink = dbs[usedDatabase.configName];
if (dbLink != null) {
links.push({link:dbLink,displayName:usedDatabase.displayName});
}
});
return links;
};

const getNcbiInfo = (ids,genes) => {
Expand Down Expand Up @@ -212,8 +221,8 @@ const landingBox = (props) => {
functions=expandableText(controller,landing,360, box.function,".",'span','search-landing-function','function',index);
}
let links=[];
_.forIn((box.links),(value,key)=>{
links.push(h('a.search-landing-link',{key: key, href: value},key));
box.links.forEach((link)=>{
links.push(h('a.search-landing-link',{key: link.displayName, href: link.link},link.displayName));
});
return [
h('div.search-landing-title',{key:'title',
Expand Down