npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

biojs-vis-gprofiler

v0.6.0

Published

Retrieve most relevant GO terms from g:Profiler

Downloads

13

Readme

biojs-vis-gprofiler

NPM version Build Status

Retrieve most relevant terms from g:Profiler and render these as a string cloud.

Getting Started

Install the module with: npm install biojs-vis-gprofiler. Copy the minified module build/biojsvisgprofiler.min.js to your scripts directory.

Usage without a module loader:

<script src="/path/to/biojsvisgprofiler.min.js"></script>
<script type="text/javascript">

document.addEventListener("DOMContentLoaded", function(e) {
  gp = new biojsVisGprofiler({
    container : "#myContainer",
    width     : 600,
    height    : 600,
  });

  gp.on("onrender", function() {
    console.log("caught render event");
  });

  gp.render({
    query     : ["swi4", "swi6", "mbp1", "mcm1", "fkh1", "fkh2"],
    organism  : "scerevisiae",
  });
});

</script>

If using a module loader such as require.js require the module from within your application or directly, such as:

<script src="require.js"></script>
<script>

require(['/path/to/biojsvisgprofiler.min.js'], function(biojsVisGprofiler) {
	...
});

</script>

Compatibility notes

Note that version 0.6.0 of biojs-vis-gprofiler introduces some breaking changes to the API of the GProfiler class and therefore to the parameters accepted by bioJSVisGProfiler.render. This is due to migrating to g:Profiler 2 API and dropping support for legacy g:Profiler.

The following parameters have been removed:

  • hierFiltering - no longer supported
  • maxPValue - replaced by the similar userThreshold parameter
  • maxSetSize - no longer supported
  • minSetSize - no longer supported
  • regionQuery - region symbols are now detected automatically
  • sortByStructure - no longer supported

The following changes have been made in the returned data structure by fields:

  • domain - The set of possible values is different: these are now source IDs as accepted by srcFilter; except in the case of GO whose subset is still {BP, CC, MF} for backward compatibility.
  • subgraph - Always 1.
  • depth - Always 1.
  • intersection - Always an empty array.

In addition, logoHttpPost has been removed from BioJSVisGProfiler constructor parameters, as g:Profiler 2 does not support HTTP POST requests outside its API.

Documentation

Index

Classes

Typedefs

class: BioJSVisGProfiler

Members

new BioJSVisGProfiler(attrs)

Construct a BioJSVisGProfiler object.

Params

  • attrs Object - Pass properties to the constructor via this object.

Properties

  • container string - Container wherein the cloud will be rendered, in selector format. required
  • width int - Width of the rendered cloud, in pixels. default: 300
  • height int - Height of the rendered cloud, in pixels. default: 300
  • maxN int - Max number of strings to display.
  • maxTermLen int - Max length of a term description, keep this at a reasonable value to ensure all terms are displayed. No effect if useTerms is false.
  • useTerms boolean - Display whole functional terms instead of single words.
  • warnings boolean - Log rendering warnings to the console.
  • showLogo boolean - Set to false to suppress displaying the g:Profiler logo at the bottom right.
  • showInfo boolean - Set to false to suppress displaying the default tooltip upon clicking a string.
  • sizer renderCb - Callback function returning the point size of a string.
  • colorer renderCb - Callback function returning the color of a string.
  • scorer scorerCb - Callback function returning the score for a string. This is used for ordering to select maxN top strings and is passed to the sizer and colorer callbacks. Note that the scores are normalized to sum to 1.
  • distiller distillerCb - Callback function returning an array of strings to be rendered.

Example

var gp = require('biojs-vis-gprofiler');

gp = new gp({
  container  : "#myContainer",
  width      : 600,
  height     : 600,
});

gp.on("onrender", function() {
  console.log("caught render event");
});

gp.render({
  query    : ["swi4", "swi6", "mbp1"],
  organism : "scerevisiae",
});

bioJSVisGProfiler.render(attrs)

Query g:Profiler and render a cloud.

Params

  • attrs Object - Passed through to GProfiler.query.

Fires

bioJSVisGProfiler.renderStored(data)

Render cloud based on an object previously returned by GProfiler.query.

Params

  • data Object - Object returned by GProfiler.query.

Fires

bioJSVisGProfiler.getGProfiler()

Return an instance of GProfiler.

bioJSVisGProfiler.getInfoboxId()

Return the infobox element id attribute.

event: "onrender"

Fired when cloud rendering has completed.

event: "onclick"

Fired upon click on a cloud element

Params

  • termdata Array - Array of data structures returned from g:Profiler per functional category associated with the clicked string.
  • event Event

class: GProfiler

Members

new GProfiler()

Construct a GProfiler object.

gProfiler.query(attrs, cb)

Query g:Profiler. See also Compatibility notes above.

Params

  • attrs Object - g:Profiler query attributes. See g:Profiler for detailed documentation on these parameters.
  • cb function - A callback function receiving the result object from a g:Profiler query.

Fields of attrs:

Properties

  • query Array - A list of query symbols. required
  • organism String - The organism name in g:Profiler format, generally the first character of the genus + species in lowercase. E.g. "Mus musculus" -> "mmusculus". default: hsapiens
  • significant boolean - Only return statistically significant results. default: true
  • orderedQuery boolean - Ordered query. default: false.
  • excludeIEA boolean - Exclude electronic GO annotations. default: false.
  • underrep boolean - Measure underrepresentation. default: false.
  • userThreshold float - Custom significance threshold. Defaults to 0.05 in g:Profiler.
  • correctionMethod String - Algorithm used for determining the significance threshold, one of "gSCS", "fdr", "bonferroni". default: "gSCS".
  • domainSize String - Statistical domain size, one of "annotated", "known". default: annotated.
  • numericNS String - Namespace to use for fully numeric IDs.
  • customBG Array - Array of symbols to use as a statistical background.
  • srcFilter Array - Array of data sources to use. Currently these include GO (GO:BP, GO:MF, GO:CC to select a particular GO branch), KEGG, REAC, TF, MI, CORUM, HP. Please see the g:GOSt web tool for the comprehensive list and details on incorporated data sources.

gProfiler.getQueryParams(queryAttrs)

Return the HTTP request parameters for a query.

Params

  • queryAttrs Object - See the documentation for GProfiler.query. If not specified, the active query (the last query executed via GProfiler.query) is used. Otherwise, an error is thrown.

Returns: Object

gProfiler.getQueryURL(queryAttrs)

Return g:Profiler URL encoding a query.

Params

  • queryAttrs Object - See the documentation for GProfiler.query. If not specified, the active query (the last query executed via GProfiler.query) is used. Otherwise, an error is thrown.

Returns: String | null - If the resulting URL lengths exceeds the maximum allowed length, null is returned.

gProfiler.getRootURL()

Return g:Profiler root URL.

Returns: String

callback: renderCb

Params

  • attrs Object - Pass properties via this object.

Properties

  • score float - A score for the string (sum of all scores == 1).
  • scaling int - A constant scaling value proportional to the size of the container.
  • str string - The string being rendered.
  • termdata Array - Array of data structures returned from g:Profiler per functional category associated with the current string.

Type: function

callback: distillerCb

Params

  • termdata Object - The data structure returned from g:Profiler for a functional category.

Type: function
Returns: Array | null - - An array of strings associated with the current term. Return null to discard the term.

callback: scorerCb

Params

  • attrs Object - Pass properties via this object.

Properties

  • str string - The string being rendered.
  • termdata Array - Array of data structures returned from g:Profiler per functional category associated with the current string.

Type: function
Returns: float

Contributing

Please submit all issues and pull requests to the tambeta/biojs-vis-gprofiler repository!

Support

If you have any problems or a suggestion please open an issue here.

License

The BSD License

Copyright (c) 2014-2019, Tambet Arak

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the Tambet Arak nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.