annotate webapollo.py @ 0:1f2e360f7554 draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
author gga
date Mon, 11 Sep 2017 05:48:05 -0400
parents
children c570db69288b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1 from __future__ import print_function
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
2
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
3 import argparse
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
4 import collections
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
5 import json
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
6 import logging
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
7 import os
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
8 import time
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
9
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
10 from abc import abstractmethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
11 from builtins import next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
12 from builtins import object
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
13 from builtins import str
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
14
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
15 from BCBio import GFF
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
16
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
17 from Bio import SeqIO
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
18
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
19 from future import standard_library
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
20
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
21 import requests
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
22
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
23
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
24 standard_library.install_aliases()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
25 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
26 import StringIO as io
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
27 except BaseException:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
28 import io
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
29 logging.getLogger("requests").setLevel(logging.CRITICAL)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
30 log = logging.getLogger()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
31
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
32
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
33 #############################################
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
34 # BEGIN IMPORT OF CACHING LIBRARY #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
35 #############################################
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
36 # This code is licensed under the MIT #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
37 # License and is a copy of code publicly #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
38 # available in rev. #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
39 # e27332bc82f4e327aedaec17c9b656ae719322ed #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
40 # of https://github.com/tkem/cachetools/ #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
41 #############################################
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
42
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
43 class DefaultMapping(collections.MutableMapping):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
44
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
45 __slots__ = ()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
46
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
47 @abstractmethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
48 def __contains__(self, key): # pragma: nocover
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
49 return False
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
50
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
51 @abstractmethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
52 def __getitem__(self, key): # pragma: nocover
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
53 if hasattr(self.__class__, '__missing__'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
54 return self.__class__.__missing__(self, key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
55 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
56 raise KeyError(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
57
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
58 def get(self, key, default=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
59 if key in self:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
60 return self[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
61 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
62 return default
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
63
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
64 __marker = object()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
65
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
66 def pop(self, key, default=__marker):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
67 if key in self:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
68 value = self[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
69 del self[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
70 elif default is self.__marker:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
71 raise KeyError(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
72 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
73 value = default
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
74 return value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
75
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
76 def setdefault(self, key, default=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
77 if key in self:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
78 value = self[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
79 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
80 self[key] = value = default
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
81 return value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
82
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
83
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
84 DefaultMapping.register(dict)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
85
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
86
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
87 class _DefaultSize(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
88 def __getitem__(self, _):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
89 return 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
90
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
91 def __setitem__(self, _, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
92 assert value == 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
93
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
94 def pop(self, _):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
95 return 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
96
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
97
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
98 class Cache(DefaultMapping):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
99 """Mutable mapping to serve as a simple cache or cache base class."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
100
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
101 __size = _DefaultSize()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
102
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
103 def __init__(self, maxsize, missing=None, getsizeof=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
104 if missing:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
105 self.__missing = missing
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
106 if getsizeof:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
107 self.__getsizeof = getsizeof
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
108 self.__size = dict()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
109 self.__data = dict()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
110 self.__currsize = 0
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
111 self.__maxsize = maxsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
112
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
113 def __repr__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
114 return '%s(%r, maxsize=%r, currsize=%r)' % (
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
115 self.__class__.__name__,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
116 list(self.__data.items()),
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
117 self.__maxsize,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
118 self.__currsize,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
119 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
120
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
121 def __getitem__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
122 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
123 return self.__data[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
124 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
125 return self.__missing__(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
126
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
127 def __setitem__(self, key, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
128 maxsize = self.__maxsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
129 size = self.getsizeof(value)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
130 if size > maxsize:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
131 raise ValueError('value too large')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
132 if key not in self.__data or self.__size[key] < size:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
133 while self.__currsize + size > maxsize:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
134 self.popitem()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
135 if key in self.__data:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
136 diffsize = size - self.__size[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
137 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
138 diffsize = size
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
139 self.__data[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
140 self.__size[key] = size
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
141 self.__currsize += diffsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
142
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
143 def __delitem__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
144 size = self.__size.pop(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
145 del self.__data[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
146 self.__currsize -= size
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
147
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
148 def __contains__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
149 return key in self.__data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
150
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
151 def __missing__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
152 value = self.__missing(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
153 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
154 self.__setitem__(key, value)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
155 except ValueError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
156 pass # value too large
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
157 return value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
158
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
159 def __iter__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
160 return iter(self.__data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
161
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
162 def __len__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
163 return len(self.__data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
164
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
165 @staticmethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
166 def __getsizeof(value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
167 return 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
168
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
169 @staticmethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
170 def __missing(key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
171 raise KeyError(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
172
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
173 @property
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
174 def maxsize(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
175 """The maximum size of the cache."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
176 return self.__maxsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
177
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
178 @property
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
179 def currsize(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
180 """The current size of the cache."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
181 return self.__currsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
182
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
183 def getsizeof(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
184 """Return the size of a cache element's value."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
185 return self.__getsizeof(value)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
186
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
187
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
188 class _Link(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
189
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
190 __slots__ = ('key', 'expire', 'next', 'prev')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
191
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
192 def __init__(self, key=None, expire=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
193 self.key = key
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
194 self.expire = expire
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
195
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
196 def __reduce__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
197 return _Link, (self.key, self.expire)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
198
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
199 def unlink(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
200 next = self.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
201 prev = self.prev
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
202 prev.next = next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
203 next.prev = prev
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
204
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
205
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
206 class _Timer(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
207
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
208 def __init__(self, timer):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
209 self.__timer = timer
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
210 self.__nesting = 0
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
211
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
212 def __call__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
213 if self.__nesting == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
214 return self.__timer()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
215 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
216 return self.__time
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
217
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
218 def __enter__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
219 if self.__nesting == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
220 self.__time = time = self.__timer()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
221 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
222 time = self.__time
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
223 self.__nesting += 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
224 return time
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
225
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
226 def __exit__(self, *exc):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
227 self.__nesting -= 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
228
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
229 def __reduce__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
230 return _Timer, (self.__timer,)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
231
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
232 def __getattr__(self, name):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
233 return getattr(self.__timer, name)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
234
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
235
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
236 class TTLCache(Cache):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
237 """LRU Cache implementation with per-item time-to-live (TTL) value."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
238
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
239 def __init__(self, maxsize, ttl, timer=time.time, missing=None,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
240 getsizeof=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
241 Cache.__init__(self, maxsize, missing, getsizeof)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
242 self.__root = root = _Link()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
243 root.prev = root.next = root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
244 self.__links = collections.OrderedDict()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
245 self.__timer = _Timer(timer)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
246 self.__ttl = ttl
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
247
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
248 def __contains__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
249 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
250 link = self.__links[key] # no reordering
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
251 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
252 return False
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
253 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
254 return not (link.expire < self.__timer())
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
255
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
256 def __getitem__(self, key, cache_getitem=Cache.__getitem__):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
257 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
258 link = self.__getlink(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
259 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
260 expired = False
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
261 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
262 expired = link.expire < self.__timer()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
263 if expired:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
264 return self.__missing__(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
265 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
266 return cache_getitem(self, key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
267
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
268 def __setitem__(self, key, value, cache_setitem=Cache.__setitem__):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
269 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
270 self.expire(time)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
271 cache_setitem(self, key, value)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
272 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
273 link = self.__getlink(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
274 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
275 self.__links[key] = link = _Link(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
276 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
277 link.unlink()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
278 link.expire = time + self.__ttl
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
279 link.next = root = self.__root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
280 link.prev = prev = root.prev
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
281 prev.next = root.prev = link
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
282
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
283 def __delitem__(self, key, cache_delitem=Cache.__delitem__):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
284 cache_delitem(self, key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
285 link = self.__links.pop(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
286 link.unlink()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
287 if link.expire < self.__timer():
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
288 raise KeyError(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
289
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
290 def __iter__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
291 root = self.__root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
292 curr = root.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
293 while curr is not root:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
294 # "freeze" time for iterator access
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
295 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
296 if not (curr.expire < time):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
297 yield curr.key
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
298 curr = curr.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
299
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
300 def __len__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
301 root = self.__root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
302 curr = root.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
303 time = self.__timer()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
304 count = len(self.__links)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
305 while curr is not root and curr.expire < time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
306 count -= 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
307 curr = curr.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
308 return count
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
309
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
310 def __setstate__(self, state):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
311 self.__dict__.update(state)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
312 root = self.__root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
313 root.prev = root.next = root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
314 for link in sorted(self.__links.values(), key=lambda obj: obj.expire):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
315 link.next = root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
316 link.prev = prev = root.prev
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
317 prev.next = root.prev = link
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
318 self.expire(self.__timer())
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
319
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
320 def __repr__(self, cache_repr=Cache.__repr__):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
321 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
322 self.expire(time)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
323 return cache_repr(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
324
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
325 @property
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
326 def currsize(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
327 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
328 self.expire(time)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
329 return super(TTLCache, self).currsize
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
330
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
331 @property
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
332 def timer(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
333 """The timer function used by the cache."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
334 return self.__timer
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
335
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
336 @property
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
337 def ttl(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
338 """The time-to-live value of the cache's items."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
339 return self.__ttl
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
340
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
341 def expire(self, time=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
342 """Remove expired items from the cache."""
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
343 if time is None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
344 time = self.__timer()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
345 root = self.__root
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
346 curr = root.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
347 links = self.__links
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
348 cache_delitem = Cache.__delitem__
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
349 while curr is not root and curr.expire < time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
350 cache_delitem(self, curr.key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
351 del links[curr.key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
352 next = curr.next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
353 curr.unlink()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
354 curr = next
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
355
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
356 def clear(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
357 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
358 self.expire(time)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
359 Cache.clear(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
360
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
361 def get(self, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
362 with self.__timer:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
363 return Cache.get(self, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
364
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
365 def pop(self, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
366 with self.__timer:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
367 return Cache.pop(self, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
368
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
369 def setdefault(self, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
370 with self.__timer:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
371 return Cache.setdefault(self, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
372
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
373 def popitem(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
374 """Remove and return the `(key, value)` pair least recently used that
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
375 has not already expired.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
376
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
377 """
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
378 with self.__timer as time:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
379 self.expire(time)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
380 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
381 key = next(iter(self.__links))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
382 except StopIteration:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
383 raise KeyError('%s is empty' % self.__class__.__name__)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
384 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
385 return (key, self.pop(key))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
386
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
387 if hasattr(collections.OrderedDict, 'move_to_end'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
388 def __getlink(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
389 value = self.__links[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
390 self.__links.move_to_end(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
391 return value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
392 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
393 def __getlink(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
394 value = self.__links.pop(key)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
395 self.__links[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
396 return value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
397
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
398
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
399 #############################################
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
400 # END IMPORT OF CACHING LIBRARY #
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
401 #############################################
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
402
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
403
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
404 cache = TTLCache(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
405 100, # Up to 100 items
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
406 5 * 60 # 5 minute cache life
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
407 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
408 userCache = TTLCache(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
409 2, # Up to 2 items
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
410 60 # 1 minute cache life
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
411 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
412
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
413
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
414 class UnknownUserException(Exception):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
415 pass
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
416
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
417
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
418 def WAAuth(parser):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
419 parser.add_argument('apollo', help='Complete Apollo URL')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
420 parser.add_argument('username', help='WA Username')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
421 parser.add_argument('password', help='WA Password')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
422
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
423
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
424 def OrgOrGuess(parser):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
425 parser.add_argument('--org_json', type=argparse.FileType("r"), help='Apollo JSON output, source for common name')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
426 parser.add_argument('--org_raw', help='Common Name')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
427 parser.add_argument('--org_id', help='Organism ID')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
428
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
429
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
430 def CnOrGuess(parser):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
431 OrgOrGuess(parser)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
432 parser.add_argument('--seq_fasta', type=argparse.FileType("r"), help='Fasta file, IDs used as sequence sources')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
433 parser.add_argument('--seq_raw', nargs='*', help='Sequence Names')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
434
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
435
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
436 def GuessOrg(args, wa):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
437 if args.org_json:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
438 orgs = [x.get('commonName', None)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
439 for x in json.load(args.org_json)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
440 orgs = [x for x in orgs if x is not None]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
441 return orgs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
442 elif args.org_raw:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
443 org = args.org_raw.strip()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
444 if len(org) > 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
445 return [org]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
446 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
447 raise Exception("Organism Common Name not provided")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
448 elif args.org_id:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
449 return [wa.organisms.findOrganismById(args.org_id).get('commonName', None)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
450 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
451 raise Exception("Organism Common Name not provided")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
452
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
453
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
454 def GuessCn(args, wa):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
455 org = GuessOrg(args, wa)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
456 seqs = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
457 if args.seq_fasta:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
458 # If we have a fasta, pull all rec ids from that.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
459 for rec in SeqIO.parse(args.seq_fasta, 'fasta'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
460 seqs.append(rec.id)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
461 elif args.seq_raw:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
462 # Otherwise raw list.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
463 seqs = [x.strip() for x in args.seq_raw if len(x.strip()) > 0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
464
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
465 return org, seqs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
466
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
467
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
468 def AssertUser(user_list):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
469 if len(user_list) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
470 raise UnknownUserException()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
471 elif len(user_list) == 1:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
472 return user_list[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
473 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
474 raise Exception("Too many users!")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
475
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
476
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
477 def AssertAdmin(user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
478 if user.role == 'ADMIN':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
479 return True
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
480 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
481 raise Exception("User is not an administrator. Permission denied")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
482
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
483
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
484 class WebApolloInstance(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
485
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
486 def __init__(self, url, username, password):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
487 self.apollo_url = url
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
488 self.username = username
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
489 self.password = password
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
490
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
491 self.annotations = AnnotationsClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
492 self.groups = GroupsClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
493 self.io = IOClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
494 self.organisms = OrganismsClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
495 self.users = UsersClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
496 self.metrics = MetricsClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
497 self.bio = RemoteRecord(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
498 self.status = StatusClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
499 self.canned_comments = CannedCommentsClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
500 self.canned_keys = CannedKeysClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
501 self.canned_values = CannedValuesClient(self)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
502
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
503 def __str__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
504 return '<WebApolloInstance at %s>' % self.apollo_url
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
505
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
506 def requireUser(self, email):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
507 cacheKey = 'user-list'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
508 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
509 # Get the cached value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
510 data = userCache[cacheKey]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
511 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
512 # If we hit a key error above, indicating that
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
513 # we couldn't find the key, we'll simply re-request
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
514 # the data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
515 data = self.users.loadUsers()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
516 userCache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
517
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
518 return AssertUser([x for x in data if x.username == email])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
519
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
520
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
521 class GroupObj(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
522 def __init__(self, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
523 self.name = kwargs['name']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
524
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
525 if 'id' in kwargs:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
526 self.groupId = kwargs['id']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
527
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
528
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
529 class UserObj(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
530 ROLE_USER = 'USER'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
531 ROLE_ADMIN = 'ADMIN'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
532
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
533 def __init__(self, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
534 # Generally expect 'userId', 'firstName', 'lastName', 'username' (email)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
535 for attr in kwargs.keys():
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
536 setattr(self, attr, kwargs[attr])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
537
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
538 if 'groups' in kwargs:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
539 groups = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
540 for groupData in kwargs['groups']:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
541 groups.append(GroupObj(**groupData))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
542 self.groups = groups
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
543
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
544 self.__props = kwargs.keys()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
545
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
546 def isAdmin(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
547 if hasattr(self, 'role'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
548 return self.role == self.ROLE_ADMIN
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
549 return False
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
550
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
551 def refresh(self, wa):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
552 # This method requires some sleeping usually.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
553 newU = wa.users.loadUser(self).toDict()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
554 for prop in newU:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
555 setattr(self, prop, newU[prop])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
556
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
557 def toDict(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
558 data = {}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
559 for prop in self.__props:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
560 data[prop] = getattr(self, prop)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
561 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
562
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
563 def orgPerms(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
564 for orgPer in self.organismPermissions:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
565 if len(orgPer['permissions']) > 2:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
566 orgPer['permissions'] = json.loads(orgPer['permissions'])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
567 yield orgPer
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
568
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
569 def __str__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
570 return '<User %s: %s %s <%s>>' % (self.userId, self.firstName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
571 self.lastName, self.username)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
572
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
573
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
574 class Client(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
575
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
576 def __init__(self, webapolloinstance, **requestArgs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
577 self._wa = webapolloinstance
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
578
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
579 self.__verify = requestArgs.get('verify', True)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
580 self._requestArgs = requestArgs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
581
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
582 if 'verify' in self._requestArgs:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
583 del self._requestArgs['verify']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
584
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
585 def request(self, clientMethod, data, post_params={}, isJson=True):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
586 url = self._wa.apollo_url + self.CLIENT_BASE + clientMethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
587
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
588 headers = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
589 'Content-Type': 'application/json'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
590 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
591
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
592 data.update({
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
593 'username': self._wa.username,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
594 'password': self._wa.password,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
595 })
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
596
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
597 r = requests.post(url, data=json.dumps(data), headers=headers,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
598 verify=self.__verify, params=post_params, allow_redirects=False, **self._requestArgs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
599
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
600 if r.status_code == 200 or r.status_code == 302:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
601 if isJson:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
602 d = r.json()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
603 if 'username' in d:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
604 del d['username']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
605 if 'password' in d:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
606 del d['password']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
607 return d
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
608 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
609 return r.text
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
610
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
611 # @see self.body for HTTP response body
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
612 raise Exception("Unexpected response from apollo %s: %s" %
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
613 (r.status_code, r.text))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
614
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
615 def get(self, clientMethod, get_params):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
616 url = self._wa.apollo_url + self.CLIENT_BASE + clientMethod
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
617 headers = {}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
618
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
619 r = requests.get(url, headers=headers, verify=self.__verify,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
620 params=get_params, **self._requestArgs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
621 if r.status_code == 200:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
622 d = r.json()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
623 if 'username' in d:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
624 del d['username']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
625 if 'password' in d:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
626 del d['password']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
627 return d
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
628 # @see self.body for HTTP response body
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
629 raise Exception("Unexpected response from apollo %s: %s" %
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
630 (r.status_code, r.text))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
631
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
632
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
633 class MetricsClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
634 CLIENT_BASE = '/metrics/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
635
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
636 def getServerMetrics(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
637 return self.get('metrics', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
638
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
639
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
640 class AnnotationsClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
641 CLIENT_BASE = '/annotationEditor/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
642
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
643 def _update_data(self, data):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
644 if not hasattr(self, '_extra_data'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
645 raise Exception("Please call setSequence first")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
646
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
647 data.update(self._extra_data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
648 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
649
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
650 def setSequence(self, sequence, organism):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
651 self._extra_data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
652 'sequence': sequence,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
653 'organism': organism,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
654 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
655
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
656 def setDescription(self, featureDescriptions):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
657 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
658 'features': featureDescriptions,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
659 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
660 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
661 return self.request('setDescription', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
662
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
663 def setName(self, uniquename, name):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
664 # TODO
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
665 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
666 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
667 {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
668 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
669 'name': name,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
670 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
671 ],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
672 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
673 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
674 return self.request('setName', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
675
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
676 def setNames(self, features):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
677 # TODO
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
678 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
679 'features': features,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
680 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
681 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
682 return self.request('setName', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
683
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
684 def setStatus(self, statuses):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
685 # TODO
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
686 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
687 'features': statuses,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
688 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
689 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
690 return self.request('setStatus', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
691
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
692 def setSymbol(self, symbols):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
693 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
694 'features': symbols,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
695 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
696 data.update(self._extra_data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
697 return self.request('setSymbol', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
698
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
699 def getComments(self, feature_id):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
700 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
701 'features': [{'uniquename': feature_id}],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
702 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
703 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
704 return self.request('getComments', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
705
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
706 def addComments(self, feature_id, comments):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
707 # TODO: This is probably not great and will delete comments, if I had to guess...
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
708 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
709 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
710 {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
711 'uniquename': feature_id,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
712 'comments': comments
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
713 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
714 ],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
715 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
716 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
717 return self.request('addComments', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
718
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
719 def addAttributes(self, feature_id, attributes):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
720 nrps = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
721 for (key, values) in attributes.items():
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
722 for value in values:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
723 nrps.append({
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
724 'tag': key,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
725 'value': value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
726 })
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
727
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
728 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
729 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
730 {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
731 'uniquename': feature_id,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
732 'non_reserved_properties': nrps
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
733 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
734 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
735 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
736 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
737 return self.request('addAttribute', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
738
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
739 def deleteAttribute(self, feature_id, key, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
740 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
741 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
742 {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
743 'uniquename': feature_id,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
744 'non_reserved_properties': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
745 {'tag': key, 'value': value}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
746 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
747 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
748 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
749 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
750 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
751 return self.request('addAttribute', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
752
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
753 def getFeatures(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
754 data = self._update_data({})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
755 return self.request('getFeatures', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
756
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
757 def getSequence(self, uniquename):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
758 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
759 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
760 {'uniquename': uniquename}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
761 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
762 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
763 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
764 return self.request('getSequence', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
765
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
766 def addFeature(self, feature, trustme=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
767 if not trustme:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
768 raise NotImplementedError("Waiting on better docs from project. If you know what you are doing, pass trustme=True to this function.")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
769
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
770 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
771 'features': feature,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
772 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
773 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
774 return self.request('addFeature', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
775
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
776 def addTranscript(self, transcript, trustme=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
777 if not trustme:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
778 raise NotImplementedError("Waiting on better docs from project. If you know what you are doing, pass trustme=True to this function.")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
779
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
780 data = {}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
781 data.update(transcript)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
782 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
783 return self.request('addTranscript', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
784
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
785 # addExon, add/delete/updateComments, addTranscript skipped due to docs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
786
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
787 def duplicateTranscript(self, transcriptId):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
788 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
789 'features': [{'uniquename': transcriptId}]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
790 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
791
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
792 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
793 return self.request('duplicateTranscript', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
794
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
795 def setTranslationStart(self, uniquename, start):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
796 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
797 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
798 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
799 'location': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
800 'fmin': start
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
801 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
802 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
803 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
804 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
805 return self.request('setTranslationStart', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
806
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
807 def setTranslationEnd(self, uniquename, end):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
808 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
809 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
810 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
811 'location': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
812 'fmax': end
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
813 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
814 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
815 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
816 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
817 return self.request('setTranslationEnd', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
818
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
819 def setLongestOrf(self, uniquename):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
820 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
821 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
822 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
823 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
824 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
825 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
826 return self.request('setLongestOrf', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
827
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
828 def setBoundaries(self, uniquename, start, end):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
829 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
830 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
831 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
832 'location': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
833 'fmin': start,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
834 'fmax': end,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
835 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
836 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
837 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
838 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
839 return self.request('setBoundaries', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
840
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
841 def getSequenceAlterations(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
842 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
843 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
844 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
845 return self.request('getSequenceAlterations', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
846
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
847 def setReadthroughStopCodon(self, uniquename):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
848 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
849 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
850 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
851 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
852 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
853 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
854 return self.request('setReadthroughStopCodon', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
855
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
856 def deleteSequenceAlteration(self, uniquename):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
857 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
858 'features': [{
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
859 'uniquename': uniquename,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
860 }]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
861 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
862 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
863 return self.request('deleteSequenceAlteration', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
864
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
865 def flipStrand(self, uniquenames):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
866 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
867 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
868 {'uniquename': x} for x in uniquenames
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
869 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
870 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
871 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
872 return self.request('flipStrand', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
873
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
874 def mergeExons(self, exonA, exonB):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
875 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
876 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
877 {'uniquename': exonA},
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
878 {'uniquename': exonB},
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
879 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
880 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
881 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
882 return self.request('mergeExons', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
883
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
884 # def splitExon(): pass
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
885
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
886 def deleteFeatures(self, uniquenames):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
887 assert isinstance(uniquenames, collections.Iterable)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
888 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
889 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
890 {'uniquename': x} for x in uniquenames
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
891 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
892 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
893 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
894 return self.request('deleteFeature', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
895
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
896 # def deleteExon(): pass
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
897
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
898 # def makeIntron(self, uniquename, ): pass
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
899
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
900 def getSequenceSearchTools(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
901 return self.get('getSequenceSearchTools', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
902
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
903 def getCannedComments(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
904 return self.get('getCannedComments', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
905
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
906 def searchSequence(self, searchTool, sequence, database):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
907 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
908 'key': searchTool,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
909 'residues': sequence,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
910 'database_id': database,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
911 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
912 return self.request('searchSequences', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
913
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
914 def getGff3(self, uniquenames):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
915 assert isinstance(uniquenames, collections.Iterable)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
916 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
917 'features': [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
918 {'uniquename': x} for x in uniquenames
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
919 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
920 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
921 data = self._update_data(data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
922 return self.request('getGff3', data, isJson=False)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
923
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
924
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
925 class GroupsClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
926 CLIENT_BASE = '/group/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
927
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
928 def createGroup(self, name):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
929 data = {'name': name}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
930 return self.request('createGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
931
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
932 def getOrganismPermissionsForGroup(self, group):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
933 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
934 'id': group.groupId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
935 'name': group.name,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
936 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
937 return self.request('getOrganismPermissionsForGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
938
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
939 def loadGroup(self, group):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
940 return self.loadGroupById(group.groupId)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
941
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
942 def loadGroupById(self, groupId):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
943 res = self.request('loadGroups', {'groupId': groupId})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
944 if isinstance(res, list):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
945 # We can only match one, right?
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
946 return GroupObj(**res[0])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
947 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
948 return res
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
949
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
950 def loadGroupByName(self, name):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
951 res = self.request('loadGroups', {'name': name})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
952 if isinstance(res, list):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
953 # We can only match one, right?
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
954 return GroupObj(**res[0])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
955 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
956 return res
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
957
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
958 def loadGroups(self, group=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
959 res = self.request('loadGroups', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
960 data = [GroupObj(**x) for x in res]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
961 if group is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
962 data = [x for x in data if x.name == group]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
963
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
964 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
965
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
966 def deleteGroup(self, group):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
967 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
968 'id': group.groupId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
969 'name': group.name,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
970 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
971 return self.request('deleteGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
972
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
973 def updateGroup(self, group, newName):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
974 # TODO: Sure would be nice if modifying ``group.name`` would invoke
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
975 # this?
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
976 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
977 'id': group.groupId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
978 'name': newName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
979 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
980 return self.request('updateGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
981
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
982 def updateOrganismPermission(self, group, organismName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
983 administrate=False, write=False, read=False,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
984 export=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
985 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
986 'groupId': group.groupId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
987 'organism': organismName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
988 'ADMINISTRATE': administrate,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
989 'WRITE': write,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
990 'EXPORT': export,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
991 'READ': read,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
992 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
993 return self.request('updateOrganismPermission', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
994
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
995 def updateMembership(self, group, users):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
996 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
997 'groupId': group.groupId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
998 'user': [user.email for user in users]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
999 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1000 return self.request('updateMembership', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1001
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1002
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1003 class IOClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1004 CLIENT_BASE = '/IOService/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1005
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1006 def write(self, exportType='FASTA', seqType='peptide',
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1007 exportFormat='text', sequences=None, organism=None,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1008 output='text', exportAllSequences=False,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1009 exportGff3Fasta=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1010 if exportType not in ('FASTA', 'GFF3'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1011 raise Exception("exportType must be one of FASTA, GFF3")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1012
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1013 if seqType not in ('peptide', 'cds', 'cdna', 'genomic'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1014 raise Exception("seqType must be one of peptide, cds, dna, genomic")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1015
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1016 if exportFormat not in ('gzip', 'text'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1017 raise Exception("exportFormat must be one of gzip, text")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1018
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1019 if output not in ('file', 'text'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1020 raise Exception("output must be one of file, text")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1021
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1022 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1023 'type': exportType,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1024 'seqType': seqType,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1025 'format': exportFormat,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1026 'sequences': sequences,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1027 'organism': organism,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1028 'output': output,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1029 'exportAllSequences': exportAllSequences,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1030 'exportGff3Fasta': exportGff3Fasta,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1031 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1032
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1033 return self.request('write', data, isJson=output == 'file')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1034
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1035 def download(self, uuid, outputFormat='gzip'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1036
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1037 if outputFormat.lower() not in ('gzip', 'text'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1038 raise Exception("outputFormat must be one of file, text")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1039
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1040 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1041 'format': outputFormat,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1042 'uuid': uuid,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1043 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1044 return self.request('write', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1045
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1046
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1047 class StatusClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1048 CLIENT_BASE = '/availableStatus/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1049
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1050 def addStatus(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1051 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1052 'value': value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1053 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1054
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1055 return self.request('createStatus', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1056
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1057 def findAllStatuses(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1058 return self.request('showStatus', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1059
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1060 def findStatusByValue(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1061 statuses = self.findAllStatuses()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1062 statuses = [x for x in statuses if x['value'] == value]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1063 if len(statuses) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1064 raise Exception("Unknown status value")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1065 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1066 return statuses[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1067
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1068 def findStatusById(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1069 statuses = self.findAllStatuses()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1070 statuses = [x for x in statuses if str(x['id']) == str(id_number)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1071 if len(statuses) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1072 raise Exception("Unknown ID")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1073 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1074 return statuses[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1075
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1076 def updateStatus(self, id_number, new_value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1077 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1078 'id': id_number,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1079 'new_value': new_value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1080 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1081
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1082 return self.request('updateStatus', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1083
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1084 def deleteStatus(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1085 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1086 'id': id_number
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1087 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1088
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1089 return self.request('deleteStatus', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1090
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1091
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1092 class CannedCommentsClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1093 CLIENT_BASE = '/cannedComment/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1094
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1095 def addComment(self, comment, metadata=""):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1096 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1097 'comment': comment,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1098 'metadata': metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1099 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1100
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1101 return self.request('createComment', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1102
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1103 def findAllComments(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1104 return self.request('showComment', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1105
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1106 def findCommentByValue(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1107 comments = self.findAllComments()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1108 comments = [x for x in comments if x['comment'] == value]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1109 if len(comments) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1110 raise Exception("Unknown comment")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1111 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1112 return comments[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1113
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1114 def findCommentById(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1115 comments = self.findAllComments()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1116 comments = [x for x in comments if str(x['id']) == str(id_number)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1117 if len(comments) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1118 raise Exception("Unknown ID")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1119 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1120 return comments[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1121
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1122 def updateComment(self, id_number, new_value, metadata=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1123 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1124 'id': id_number,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1125 'new_comment': new_value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1126 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1127
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1128 if metadata is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1129 data['metadata'] = metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1130
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1131 return self.request('updateComment', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1132
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1133 def deleteComment(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1134 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1135 'id': id_number
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1136 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1137
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1138 return self.request('deleteComment', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1139
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1140
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1141 class CannedKeysClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1142 CLIENT_BASE = '/cannedKey/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1143
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1144 def addKey(self, key, metadata=""):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1145 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1146 'key': key,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1147 'metadata': metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1148 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1149
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1150 return self.request('createKey', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1151
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1152 def findAllKeys(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1153 return self.request('showKey', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1154
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1155 def findKeyByValue(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1156 keys = self.findAllKeys()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1157 keys = [x for x in keys if x['label'] == value]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1158 if len(keys) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1159 raise Exception("Unknown key")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1160 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1161 return keys[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1162
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1163 def findKeyById(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1164 keys = self.findAllKeys()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1165 keys = [x for x in keys if str(x['id']) == str(id_number)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1166 if len(keys) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1167 raise Exception("Unknown ID")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1168 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1169 return keys[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1170
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1171 def updateKey(self, id_number, new_key, metadata=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1172 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1173 'id': id_number,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1174 'new_key': new_key
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1175 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1176
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1177 if metadata is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1178 data['metadata'] = metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1179
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1180 return self.request('updateKey', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1181
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1182 def deleteKey(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1183 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1184 'id': id_number
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1185 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1186
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1187 return self.request('deleteKey', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1188
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1189
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1190 class CannedValuesClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1191 CLIENT_BASE = '/cannedValue/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1192
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1193 def addValue(self, value, metadata=""):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1194 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1195 'value': value,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1196 'metadata': metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1197 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1198
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1199 return self.request('createValue', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1200
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1201 def findAllValues(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1202 return self.request('showValue', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1203
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1204 def findValueByValue(self, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1205 values = self.findAllValues()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1206 values = [x for x in values if x['label'] == value]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1207 if len(values) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1208 raise Exception("Unknown value")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1209 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1210 return values[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1211
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1212 def findValueById(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1213 values = self.findAllValues()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1214 values = [x for x in values if str(x['id']) == str(id_number)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1215 if len(values) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1216 raise Exception("Unknown ID")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1217 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1218 return values[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1219
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1220 def updateValue(self, id_number, new_value, metadata=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1221 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1222 'id': id_number,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1223 'new_value': new_value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1224 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1225
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1226 if metadata is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1227 data['metadata'] = metadata
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1228
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1229 return self.request('updateValue', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1230
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1231 def deleteValue(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1232 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1233 'id': id_number
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1234 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1235
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1236 return self.request('deleteValue', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1237
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1238
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1239 class OrganismsClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1240 CLIENT_BASE = '/organism/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1241
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1242 def addOrganism(self, commonName, directory, blatdb=None, species=None,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1243 genus=None, public=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1244 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1245 'commonName': commonName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1246 'directory': directory,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1247 'publicMode': public,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1248 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1249
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1250 if blatdb is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1251 data['blatdb'] = blatdb
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1252 if genus is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1253 data['genus'] = genus
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1254 if species is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1255 data['species'] = species
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1256
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1257 return self.request('addOrganism', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1258
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1259 def findAllOrganisms(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1260 return self.request('findAllOrganisms', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1261
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1262 def findOrganismByCn(self, cn):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1263 orgs = self.findAllOrganisms()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1264 orgs = [x for x in orgs if x['commonName'] == cn]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1265 if len(orgs) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1266 raise Exception("Unknown common name")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1267 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1268 return orgs[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1269
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1270 def findOrganismById(self, id_number):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1271 orgs = self.findAllOrganisms()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1272 orgs = [x for x in orgs if str(x['id']) == str(id_number)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1273 if len(orgs) == 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1274 raise Exception("Unknown ID")
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1275 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1276 return orgs[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1277
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1278 def deleteOrganism(self, organismId):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1279 return self.request('deleteOrganism', {'id': organismId})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1280
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1281 def deleteOrganismFeatures(self, organismId):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1282 return self.request('deleteOrganismFeatures', {'id': organismId})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1283
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1284 def getSequencesForOrganism(self, commonName):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1285 return self.request('getSequencesForOrganism', {'organism': commonName})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1286
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1287 def updateOrganismInfo(self, organismId, commonName, directory, blatdb=None, species=None, genus=None, public=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1288 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1289 'id': organismId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1290 'name': commonName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1291 'directory': directory,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1292 'publicMode': public,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1293 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1294
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1295 if blatdb is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1296 data['blatdb'] = blatdb
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1297 if genus is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1298 data['genus'] = genus
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1299 if species is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1300 data['species'] = species
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1301
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1302 return self.request('updateOrganismInfo', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1303
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1304
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1305 class UsersClient(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1306 CLIENT_BASE = '/user/'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1307
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1308 # Real one
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1309 # def getOrganismPermissionsForUser(self, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1310 # data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1311 # 'userId': user.userId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1312 # }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1313 # return self.request('getOrganismPermissionsForUser', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1314
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1315 # Utter frigging hack
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1316 def getOrganismPermissionsForUser(self, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1317 return self.loadUser(user).organismPermissions
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1318
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1319 def updateOrganismPermission(self, user, organism, administrate=False,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1320 write=False, export=False, read=False):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1321 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1322 'userId': user.userId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1323 'organism': organism,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1324 'ADMINISTRATE': administrate,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1325 'WRITE': write,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1326 'EXPORT': export,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1327 'READ': read,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1328 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1329 return self.request('updateOrganismPermission', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1330
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1331 def loadUser(self, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1332 return self.loadUserById(user.userId)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1333
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1334 def loadUserById(self, userId):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1335 res = self.request('loadUsers', {'userId': userId})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1336 if isinstance(res, list):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1337 # We can only match one, right?
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1338 return UserObj(**res[0])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1339 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1340 return res
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1341
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1342 def loadUsers(self, email=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1343 res = self.request('loadUsers', {})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1344 data = [UserObj(**x) for x in res]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1345 if email is not None:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1346 data = [x for x in data if x.username == email]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1347
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1348 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1349
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1350 def addUserToGroup(self, group, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1351 data = {'group': group.name, 'userId': user.userId}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1352 return self.request('addUserToGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1353
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1354 def removeUserFromGroup(self, group, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1355 data = {'group': group.name, 'userId': user.userId}
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1356 return self.request('removeUserFromGroup', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1357
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1358 def createUser(self, email, firstName, lastName, newPassword, role="user", groups=None):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1359 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1360 'firstName': firstName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1361 'lastName': lastName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1362 'email': email,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1363 'role': role,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1364 'groups': [] if groups is None else groups,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1365 # 'availableGroups': [],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1366 'newPassword': newPassword,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1367 # 'organismPermissions': [],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1368 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1369 return self.request('createUser', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1370
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1371 def deleteUser(self, user):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1372 return self.request('deleteUser', {'userId': user.userId})
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1373
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1374 def updateUser(self, user, email, firstName, lastName, newPassword):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1375 data = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1376 'userId': user.userId,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1377 'email': email,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1378 'firstName': firstName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1379 'lastName': lastName,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1380 'newPassword': newPassword,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1381 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1382 return self.request('updateUser', data)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1383
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1384
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1385 class RemoteRecord(Client):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1386 CLIENT_BASE = None
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1387
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1388 def ParseRecord(self, cn):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1389 org = self._wa.organisms.findOrganismByCn(cn)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1390 self._wa.annotations.setSequence(org['commonName'], org['id'])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1391
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1392 data = io.StringIO(self._wa.io.write(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1393 exportType='GFF3',
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1394 seqType='genomic',
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1395 exportAllSequences=False,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1396 exportGff3Fasta=True,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1397 output="text",
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1398 exportFormat="text",
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1399 sequences=cn,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1400 ))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1401 data.seek(0)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1402
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1403 for record in GFF.parse(data):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1404 yield WebApolloSeqRecord(record, self._wa)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1405
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1406
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1407 class WebApolloSeqRecord(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1408 def __init__(self, sr, wa):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1409 self._sr = sr
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1410 self._wa = wa
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1411
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1412 def __dir__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1413 return dir(self._sr)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1414
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1415 def __getattr__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1416 if key in ('_sr', '_wa'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1417 return self.__dict__[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1418 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1419 if key == 'features':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1420 return (WebApolloSeqFeature(x, self._wa)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1421 for x in self._sr.__dict__[key])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1422 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1423 return self._sr.__dict__[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1424
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1425 def __setattr__(self, key, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1426 if key in ('_sd', '_wa'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1427 self.__dict__[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1428 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1429 self._sr.__dict__[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1430 # Methods acting on the SeqRecord object
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1431
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1432
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1433 class WebApolloSeqFeature(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1434 def __init__(self, sf, wa):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1435 self._sf = sf
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1436 self._wa = wa
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1437
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1438 def __dir__(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1439 return dir(self._sf)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1440
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1441 def __getattr__(self, key):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1442 if key in ('_sf', '_wa'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1443 return self.__dict__[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1444 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1445 return self._sf.__dict__[key]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1446
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1447 def __setattr__(self, key, value):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1448 if key in ('_sf', '_wa'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1449 self.__dict__[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1450 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1451 # Methods acting on the SeqFeature object
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1452 if key == 'location':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1453 if value.strand != self._sf.location.strand:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1454 self.wa.annotations.flipStrand(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1455 self._sf.qualifiers['ID'][0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1456 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1457
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1458 self.wa.annotations.setBoundaries(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1459 self._sf.qualifiers['ID'][0],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1460 value.start,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1461 value.end,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1462 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1463
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1464 self._sf.__dict__[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1465 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1466 self._sf.__dict__[key] = value
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1467
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1468
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1469 def _tnType(feature):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1470 if feature.type in ('gene', 'mRNA', 'exon', 'CDS', 'terminator', 'tRNA'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1471 return feature.type
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1472 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1473 return 'exon'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1474
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1475
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1476 def _yieldFeatData(features):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1477 for f in features:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1478 current = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1479 'location': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1480 'strand': f.strand,
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1481 'fmin': int(f.location.start),
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1482 'fmax': int(f.location.end),
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1483 },
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1484 'type': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1485 'name': _tnType(f),
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1486 'cv': {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1487 'name': 'sequence',
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1488 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1489 },
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1490 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1491 if f.type in ('gene', 'mRNA'):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1492 current['name'] = f.qualifiers.get('Name', [f.id])[0]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1493 if hasattr(f, 'sub_features') and len(f.sub_features) > 0:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1494 current['children'] = [x for x in _yieldFeatData(f.sub_features)]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1495
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1496 yield current
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1497
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1498
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1499 def featuresToFeatureSchema(features):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1500 compiled = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1501 for feature in features:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1502 # if feature.type != 'gene':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1503 # log.warn("Not able to handle %s features just yet...", feature.type)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1504 # continue
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1505
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1506 for x in _yieldFeatData([feature]):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1507 compiled.append(x)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1508 return compiled
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1509
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1510
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1511 def accessible_organisms(user, orgs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1512 permissionMap = {
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1513 x['organism']: x['permissions']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1514 for x in user.organismPermissions
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1515 if 'WRITE' in x['permissions'] or
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1516 'READ' in x['permissions'] or
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1517 'ADMINISTRATE' in x['permissions'] or
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1518 user.role == 'ADMIN'
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1519 }
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1520
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1521 if 'error' in orgs:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1522 raise Exception("Error received from Apollo server: \"%s\"" % orgs['error'])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1523
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1524 return [
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1525 (org['commonName'], org['id'], False)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1526 for org in sorted(orgs, key=lambda x: x['commonName'])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1527 if org['commonName'] in permissionMap
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1528 ]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1529
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1530
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1531 def galaxy_list_groups(trans, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1532 email = trans.get_user().email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1533 wa = WebApolloInstance(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1534 os.environ['GALAXY_WEBAPOLLO_URL'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1535 os.environ['GALAXY_WEBAPOLLO_USER'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1536 os.environ['GALAXY_WEBAPOLLO_PASSWORD']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1537 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1538 # Assert that the email exists in apollo
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1539 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1540 gx_user = wa.requireUser(email)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1541 except UnknownUserException:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1542 return []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1543
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1544 # Key for cached data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1545 cacheKey = 'groups-' + email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1546 # We don't want to trust "if key in cache" because between asking and fetch
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1547 # it might through key error.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1548 if cacheKey not in cache:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1549 # However if it ISN'T there, we know we're safe to fetch + put in
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1550 # there.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1551 data = _galaxy_list_groups(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1552 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1553 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1554 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1555 # The cache key may or may not be in the cache at this point, it
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1556 # /likely/ is. However we take no chances that it wasn't evicted between
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1557 # when we checked above and now, so we reference the object from the
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1558 # cache in preparation to return.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1559 data = cache[cacheKey]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1560 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1561 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1562 # If access fails due to eviction, we will fail over and can ensure that
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1563 # data is inserted.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1564 data = _galaxy_list_groups(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1565 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1566 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1567
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1568
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1569 def _galaxy_list_groups(wa, gx_user, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1570 # Fetch the groups.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1571 group_data = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1572 for group in wa.groups.loadGroups():
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1573 # Reformat
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1574 group_data.append((group.name, group.groupId, False))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1575 return group_data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1576
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1577
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1578 def galaxy_list_orgs(trans, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1579 email = trans.get_user().email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1580 wa = WebApolloInstance(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1581 os.environ['GALAXY_WEBAPOLLO_URL'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1582 os.environ['GALAXY_WEBAPOLLO_USER'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1583 os.environ['GALAXY_WEBAPOLLO_PASSWORD']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1584 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1585 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1586 gx_user = wa.requireUser(email)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1587 except UnknownUserException:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1588 return []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1589
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1590 # Key for cached data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1591 cacheKey = 'orgs-' + email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1592 if cacheKey not in cache:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1593 data = _galaxy_list_orgs(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1594 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1595 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1596 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1597 data = cache[cacheKey]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1598 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1599 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1600 data = _galaxy_list_orgs(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1601 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1602 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1603
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1604
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1605 def _galaxy_list_orgs(wa, gx_user, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1606 # Fetch all organisms
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1607 all_orgs = wa.organisms.findAllOrganisms()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1608 # Figure out which are accessible to the user
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1609 orgs = accessible_organisms(gx_user, all_orgs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1610 # Return org list
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1611 return orgs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1612
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1613
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1614 def galaxy_list_users(trans, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1615 email = trans.get_user().email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1616 wa = WebApolloInstance(
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1617 os.environ['GALAXY_WEBAPOLLO_URL'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1618 os.environ['GALAXY_WEBAPOLLO_USER'],
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1619 os.environ['GALAXY_WEBAPOLLO_PASSWORD']
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1620 )
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1621 # Assert that the email exists in apollo
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1622 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1623 gx_user = wa.requireUser(email)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1624 except UnknownUserException:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1625 return []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1626
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1627 # Key for cached data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1628 cacheKey = 'users-' + email
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1629 # We don't want to trust "if key in cache" because between asking and fetch
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1630 # it might through key error.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1631 if cacheKey not in cache:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1632 # However if it ISN'T there, we know we're safe to fetch + put in
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1633 # there.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1634 data = _galaxy_list_users(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1635 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1636 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1637 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1638 # The cache key may or may not be in the cache at this point, it
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1639 # /likely/ is. However we take no chances that it wasn't evicted between
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1640 # when we checked above and now, so we reference the object from the
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1641 # cache in preparation to return.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1642 data = cache[cacheKey]
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1643 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1644 except KeyError:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1645 # If access fails due to eviction, we will fail over and can ensure that
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1646 # data is inserted.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1647 data = _galaxy_list_users(wa, gx_user, *args, **kwargs)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1648 cache[cacheKey] = data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1649 return data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1650
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1651
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1652 def _galaxy_list_users(wa, gx_user, *args, **kwargs):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1653 # Fetch the users.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1654 user_data = []
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1655 for user in wa.users.loadUsers():
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1656 # Reformat
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1657 user_data.append((user.username, user.username, False))
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1658 return user_data
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1659
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1660
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1661 # This is all for implementing the command line interface for testing.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1662 class obj(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1663 pass
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1664
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1665
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1666 class fakeTrans(object):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1667
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1668 def __init__(self, username):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1669 self.un = username
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1670
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1671 def get_user(self):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1672 o = obj()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1673 o.email = self.un
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1674 return o
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1675
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1676
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1677 def retry(closure, sleep=1, limit=5):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1678 """
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1679 Apollo has the bad habit of returning 500 errors if you call APIs
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1680 too quickly, largely because of the unholy things that happen in
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1681 grails.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1682
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1683 To deal with the fact that we cannot send an addComments call too
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1684 quickly after a createFeature call, we have this function that will
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1685 keep calling a closure until it works.
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1686 """
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1687 count = 0
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1688 while True:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1689 count += 1
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1690
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1691 if count >= limit:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1692 return False
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1693 try:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1694 # Try calling it
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1695 closure()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1696 # If successful, exit
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1697 return True
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1698 except Exception as e:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1699 log.info(str(e)[0:100])
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1700 time.sleep(sleep)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1701
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1702
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1703 if __name__ == '__main__':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1704 parser = argparse.ArgumentParser(description='Test access to apollo server')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1705 parser.add_argument('email', help='Email of user to test')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1706 parser.add_argument('--action', choices=['org', 'group', 'users'], default='org', help='Data set to test, fetch a list of groups or users known to the requesting user.')
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1707 args = parser.parse_args()
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1708
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1709 trans = fakeTrans(args.email)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1710 if args.action == 'org':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1711 for f in galaxy_list_orgs(trans):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1712 print(f)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1713 elif args.action == 'group':
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1714 for f in galaxy_list_groups(trans):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1715 print(f)
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1716 else:
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1717 for f in galaxy_list_users(trans):
1f2e360f7554 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit f745b23c84a615bf434d717c8c0e553a012f0268
gga
parents:
diff changeset
1718 print(f)