Package intermine :: Package lists :: Module list :: Class List
[hide private]
[frames] | no frames]

Class List

source code

object --+
         |
        List


Class for representing a List on an InterMine Webservice
========================================================

Lists represent stored collections of data and saved result
sets in an InterMine data warehouse. This class is an abstraction
of this information, and provides mechanisms for managing the
data.

SYNOPSIS
--------

example::
    
    from intermine.webservice import Service

    flymine = Service("www.flymine.org/query", "SOMETOKEN")
    new_list = flymine.create_list(["h", "zen", "eve", "bib"], "Gene", name="My New List")

    another_list = flymine.get_list("Some other list")
    combined_list = new_list | another_list # Same syntax as for sets
    combined_list.name = "Union of the other lists"

    for row in combined_list.to_attribute_query().results():
        print row

OVERVIEW
--------

Lists are created from a webservice, and can be manipulated in various ways. 
The operations are:
    * Union: this | that
    * Intersection: this & that
    * Symmetric Difference: this ^ that
    * Asymmetric Difference (subtraction): this - that
    * Appending: this += that

Lists can be created from a list of identifiers that could be:
    * stored in a file
    * held in a list or set
    * contained in a string
In all these cases the syntax is the same:

    new_list = service.create_list(content, type, name="Some name", description="Some description", tags=["some", "tags"])

Lists can also be created from a query's result with the exact 
same syntax. In the case of queries, the type is not required,
but the query should have just one view, and it should be an id.

    query = service.new_query()
    query.add_view("Gene.id")
    query.add_constraint("Gene.length", "<", 100)
    new_list = service.create_list(query, name="Short Genes")

Instance Methods [hide private]
 
__init__(self, **args)
Do not construct these objects yourself.
source code
 
get_name(self) source code
 
set_name(self, new_name)
Setting the list's name causes the list's name to be updated on the server.
source code
 
del_name(self) source code
 
_add_failed_matches(self, ids) source code
 
__str__(self)
str(x)
source code
 
delete(self)
Calls the webservice to delete this list immediately.
source code
intermine.query.Query
to_query(self)
Return a new query constrained to the objects in this list, and with a single view column of the objects ids.
source code
intermine.query.Query
to_attribute_query(self)
Return a query constrained to contain the objects in this list, with all the attributes of these objects selected for output as view columns
source code
 
__and__(self, other)
Intersect this list and another
source code
 
__iand__(self, other)
Intersect this list and another, and replace this list with the result of the intersection
source code
 
__or__(self, other)
Return the union of this list and another
source code
 
__add__(self, other)
Return the union of this list and another
source code
 
__iadd__(self, other)
Append other to this list.
source code
 
_do_append(self, content) source code
 
append(self, appendix)
Append the arguments to this list
source code
 
__xor__(self, other)
Calculate the symmetric difference of this list and another
source code
 
__ixor__(self, other)
Calculate the symmetric difference of this list and another and replace this list with the result
source code
 
__sub__(self, other)
Subtract the other from this list
source code
 
__isub__(self, other)
Replace this list with the subtraction of the other from this list
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  name
The name of this list

Inherited from object: __class__

Method Details [hide private]

__init__(self, **args)
(Constructor)

source code 

Constructor

Do not construct these objects yourself. They should be fetched from a service or constructed using the "create_list" method.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

delete(self)

source code 

Delete this list from the webservice

Calls the webservice to delete this list immediately. This object should not be used after this method is called - attempts to do so will raise errors.


Property Details [hide private]

name

The name of this list

Get Method:
get_name(self)
Set Method:
set_name(self, new_name) - Setting the list's name causes the list's name to be updated on the server.
Delete Method:
del_name(self)