Class: List

Defined in: src/lists.coffee

Overview

A representation of collections of objects stored in a data-warehouse.

Lists can be created through the list upload mechanism (Service#createList) and the query saving mechanism (Query#saveAsList).

Instance Method Summary

Constructor Details

- (void) constructor(properties, service)

Construct a new list.

Parameters:

  • properties (Object) The properties of this list.
  • service (Service) The service this list belongs to.

Options Hash: (properties):

  • name (String) The name of this list.
  • size (Number) The size of this list.
  • dateCreated (Number) The timestamp of the creation date for this list.
  • description (String) The description of this list.
  • The (tags) tags for this list.

Instance Method Details

- (boolean) hasTag(t) (bound)

Whether or not this list has a certain tag.

Parameters:

  • t (String) The tag this list is meant to have.

Returns:

  • (boolean) — true if this list has the certain tag.

- (Promise<Query>) query(view = ['*'])

Construct a query for data contained in this list.

Parameters:

  • view (Array<String>) An optional list of output columns. Defaults to the summary fields for objects of this type.

Returns:

  • (Promise<Query>) — A promise to yield a query.

- (Promise<?>) del(cb)

Delete this list on the server. The list should not be subsequently used.

Parameters:

  • cb (->) An optional callback, called upon successful deletion.

Returns:

  • (Promise<?>) — A promise to delete the list.

- (void) _updateTags(err, tags) (bound)

- (Promise<Array<String>>) fetchTags(cb)

Get the current set of tags for this list, and update this object so it reflects the current state of the server.

Parameters:

  • cb ((Array<String>) ->) An optional callback

Returns:

  • (Promise<Array<String>>) — A promise to yield a list of tags.

- (Promise<Array<String>>) addTags(tags, cb)

Add the given tags to the current set of tags for this list, and update this object so it reflects the current state of the server.

Parameters:

  • tags (Array<String>) The tags to add.
  • cb ((Array<String>) ->) An optional callback

Returns:

  • (Promise<Array<String>>) — A promise to yield a list of tags.

- (Promise<Array<String>>) removeTags(tags, cb)

Remove the given tags from the current set of tags for this list, and update this object so it reflects the current state of the server.

Parameters:

  • tags (Array<String>) The tags to remove.
  • cb ((Array<String>) ->) An optional callback

Returns:

  • (Promise<Array<String>>) — A promise to yield a list of tags.

- (Promise<Array<Object>>) contents(cb)

Get the contents of this list.

The dejoin function is used to ensure that all objects in the list are returned, and we don't miss out on any due to the implicit constraints of inner joins.

Parameters:

  • cb ((Array<Object>) ->) A function that receives a list of objects. Optional.

Returns:

  • (Promise<Array<Object>>) — A promise to yield a list of objects.

- (Promise<List>) rename(newName, cb)

Rename this list. Upon resolution of this actions promise, this object will have its name property set to the new value.

Parameters:

  • newName (String) The name this list should have.
  • cb ((List) ->) An optional callback.

Returns:

  • (Promise<List>) — A promise to yield the new state of the list.

- (Promise<List>) copy(opts = {}, cb = (function() {}))

Copy this list to an exact duplicate with a different name.

This function will check that any name given does not collide with any other list you have access to, adding a suffix to avoid name clashes. This means you should probably check the yielded value to see what name it ended up with.

Parameters:

  • opts (Object|String) Either an options object specifying the parameters for this operation, or the name to copy this list as.
  • cb ((List) ->) An optional function that receives a List.

Options Hash: (opts):

  • name (String) The name for the copy. If a list already exists with this name then a number will be added to the name to make it unique. (optional, defaults to @name + _copy.)
  • tags (Array<String>) Tags to apply to the new list. These tags will be in addition to any that the list currently has, which will be copied over. (optional)

Returns:

  • (Promise<List>) — A promise to yield a list.

- (Promise<Array<Object>>) enrichment(opts, cb)

Fetch the results for a particular enrichment calculation against this list. See Service#enrichment.

Parameters:

  • opts (Object) The parameters of this request.
  • cb (->) A function to call with the results when they have been received (optional).

Options Hash: (opts):

  • widget (String) The calculation to run.
  • maxp (Number) The maximum permissible p-value (optional, default = 0.05).
  • correction (String) The correction algorithm to use (default = Holm-Bonferroni).
  • population (String) The name of a list to use as a background population (optional).
  • filter (String) An extra value that some widget calculations accept.

Returns:

  • (Promise<Array<Object>>) — A promise to get results.

- (Promise<>) shareWithUser(recipient, cb)

Share this list with a recipient.

The recipient should exist as a user in the target InterMine instance.

Parameters:

  • recipient (String) The identifier of a user.
  • cb (->) A function to call on successful completion (optional).

Returns:

  • (Promise<>) — A promise to share a List.

- (Promise<>) inviteUserToShare(recipient, notify = true, cb = (function() {}))

Invite a user to share this list.

Parameters:

  • recipient (String) The email address of someone to invite to share this list.
  • notify (boolean) Whether or not to notify the recipient by email.
  • cb (->) A function to call upon successful completion.

Returns:

  • (Promise<>) — A promise to invite a user to share a list.