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"
>>>
>>> print "The combination of the two lists has %d elements" % combined_list.size
>>> print "The combination of the two lists has %d elements" % len(combined_list)
>>>
>>> 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")
|
|
|
get_name(self)
The name of the list used to access it programmatically |
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)
Raises an error - lists must always have a name |
source code
|
|
|
__len__(self)
Returns the number of elements in the object |
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
|
|
|
__iter__(self)
Return an iterator over the objects in this list, with all attributes
selected for output |
source code
|
|
|
__getitem__(self,
index)
Get a member of this list by index |
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
|
|
|
|
|
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__
|
|
date_created
When this list was originally created
|
|
tags
The tags associated with this list
|
|
description
The human readable description of this list
|
|
title
The fixed title of this list
|
|
is_authorized
Whether or not the current user is authorised to make changes to this
list
|
|
list_type
The type of the InterMine objects this list can contain
|
|
size
Return the number of elements in the list.
|
|
count
Alias for obj.size.
|
|
name
The name of this list
|
Inherited from object :
__class__
|
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 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.
|
date_created
When this list was originally created
- Get Method:
- unreachable.date_created(self)
- When this list was originally created
|
tags
The tags associated with this list
- Get Method:
- unreachable.tags(self)
- The tags associated with this list
|
description
The human readable description of this list
- Get Method:
- unreachable.description(self)
- The human readable description of this list
|
title
The fixed title of this list
- Get Method:
- unreachable.title(self)
- The fixed title of this list
|
is_authorized
Whether or not the current user is authorised to make changes to this
list
- Get Method:
- unreachable.is_authorized(self)
- Whether or not the current user is authorised to make changes to this list
|
list_type
The type of the InterMine objects this list can contain
- Get Method:
- unreachable.list_type(self)
- The type of the InterMine objects this list can contain
|
size
Return the number of elements in the list. Also available as
len(obj)
- Get Method:
- unreachable.size(self)
- Return the number of elements in the list.
|
count
Alias for obj.size. Also available as len(obj)
- Get Method:
- unreachable.count(self)
- Alias for obj.size.
|
name
The name of this list
- Get Method:
- get_name(self)
- The name of the list used to access it programmatically
- 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)
- Raises an error - lists must always have a name
|