-
-
Notifications
You must be signed in to change notification settings - Fork 22
Developer's Guide
To initialize mutation mapper with the minimal settings, you will need to provide list of genes, and the target container:
var options = {
el: '#my_mutation_mapper_div_id', // target element where the components will be rendered
data: {
geneList: ['TP53', 'KRAS']
}
};
var mutationMapper = new MutationMapper(options);
mutationMapper.init();This will initialize the MutationMapper instance and render the contents within the provided target element.
This minimal configuration requires a server side component and will only work if Mutation Mapper can access to the default data services defined for the proxies. For a more advanced initialization, see the section Customizing Data Proxies.
By default, each data proxy instance requires a web service to get the data. You can customize data proxies by setting the corresponding configuration options. For example, the code below initializes a Mutation Mapper instance where the data is collected from cBioPortal web services.
var options = {
el: '#my_mutation_mapper_div_id', // target element where the components will be rendered
data: {
geneList: ['TP53', 'KRAS']
},
proxy: {
mutationProxy: {
options: {
servletName: 'http://www.cbioportal.org/getMutationData.json',
params: {
geneticProfiles: 'ov_tcga_pub_mutations',
caseSetId: 'ov_tcga_pub_3way_complete'
}
}
},
pfamProxy: {
options: {
servletName: 'http://www.cbioportal.org/getPfamSequence.json'
}
}
}
};
var mutationMapper = new MutationMapper(options);
mutationMapper.init();Although this will initialize the basic view components, you need more than that to have a fully functioning mutation mapper which gets all its data from cBioPortal web services:
var options = {
el: '#my_mutation_mapper_div_id', // target element where the components will be rendered
data: {
geneList: ['TP53', 'KRAS']
},
proxy: {
mutationProxy: {
options: {
servletName: 'http://www.cbioportal.org/getMutationData.json',
params: {
geneticProfiles: 'ov_tcga_pub_mutations',
caseSetId: 'ov_tcga_pub_3way_complete'
}
}
},
pfamProxy: {
options: {
servletName: 'http://www.cbioportal.org/getPfamSequence.json'
}
},
mutationAlignerProxy: {
options: {
servletName: 'http://www.cbioportal.org/getMutationAligner.json'
}
},
pdbProxy: {
options: {
servletName: 'http://www.cbioportal.org/get3dPdb.json',
subService: false,
listJoiner: ' ',
}
}
}
};
var mutationMapper = new MutationMapper(options);
mutationMapper.init();MutationMapper comes with a built-in data manager to fetch and cache data from remote web services. It is mainly designed to help adding custom data to the existing mutation model instances at runtime, but it can also be used for arbitrary data fetching and caching purposes on the client side.
Here is an example dataManager configuration to add custom annotation data to the existing mutation model instances:
var options = {
proxy: {
// this requires custom implementation of the class MyAnnotationProxy
customAnnotationProxy: {
instanceClass: MyAnnotationProxy,
options: {
servletName: 'http://www.example.org/custom-annotation-json/'
}
}
},
dataManager: {
dataFn: {
customAnnotation: function(dataProxies, params, callback) {
var mutations = params.mutations || params.mutationTable.getMutations();
var annotationProxy = dataProxies.customAnnotationProxy;
var queryData = [];
annotationProxy.getAnnotationData(queryData, function(annotationData) {
// enrich current mutation data with the annotation data
// (assuming that the custom class MutationEnrichmentUtil implemented)
MutationEnrichmentUtil.enrichMutationData(mutations, annotationData);
if (_.isFunction(callback))
{
callback(params);
}
});
}
}
}
};