code
stringlengths
52
7.75k
docs
stringlengths
1
5.85k
def subscribe_notice(self, access_token): url = 'https://openapi.youku.com/v2/users/subscribe/notice.json' params = { 'client_id': self.client_id, 'access_token': access_token } r = requests.get(url, params=params) check_error(r) return r....
doc: http://open.youku.com/docs/doc?id=31
def find_show_by_id(self, show_id): url = 'https://openapi.youku.com/v2/shows/show.json' params = { 'client_id': self.client_id, 'show_id': show_id } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=59
def find_shows_by_ids(self, show_ids): url = 'https://openapi.youku.com/v2/shows/show_batch.json' params = { 'client_id': self.client_id, 'show_ids': show_ids } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=60
def find_show_premium_by_ids(self, show_ids, page=1, count=20): url = 'https://openapi.youku.com/v2/shows/show_premium.json' params = { 'client_id': self.client_id, 'show_ids': show_ids, 'page': page, 'count': count } r = requests....
doc: http://open.youku.com/docs/doc?id=61
def find_shows_by_category(self, category, genre=None, area=None, release_year=None, paid=None, orderby='view-today-count', streamtypes=None, person=None, page=1, count=20): url =...
doc: http://open.youku.com/docs/doc?id=62
def find_shows_by_related(self, show_id, count=20): url = 'https://openapi.youku.com/v2/shows/by_related.json' params = { 'client_id': self.client_id, 'show_id': show_id, 'count': count } r = requests.get(url, par...
doc: http://open.youku.com/docs/doc?id=63
def find_videos_by_show(self, show_id, show_videotype=None, show_videostage=None, orderby='videoseq-asc', page=1, count=20): url = 'https://openapi.youku.com/v2/shows/videos.json' params = { 'client_id': self.client_id, ...
doc: http://open.youku.com/docs/doc?id=64
def prepare_video_params(self, title=None, tags='Others', description='', copyright_type='original', public_type='all', category=None, watch_password=None, latitude=None, longitude=None, shoot_time=None )...
util method for create video params to upload. Only need to provide a minimum of two essential parameters: title and tags, other video params are optional. All params spec see: http://cloud.youku.com/docs?id=110#create . Args: title: string, 2-50 characters. tag...
def _save_upload_state_to_file(self): if os.access(self.file_dir, os.W_OK | os.R_OK | os.X_OK): save_file = self.file + '.upload' data = { 'upload_token': self.upload_token, 'upload_server_ip': self.upload_server_ip } with ...
if create and create_file has execute, save upload state to file for next resume upload if current upload process is interrupted.
def upload(self, params={}): if self.upload_token is not None: # resume upload status = self.check() if status['status'] != 4: return self.commit() else: self.new_slice() while self.slice_task_id != 0: ...
start uploading the file until upload is complete or error. This is the main method to used, If you do not care about state of process. Args: params: a dict object describe video info, eg title, tags, description, category. all video para...
def sync_groups(self): if self.settings.GROUP_FILTER: ldap_groups = self.ldap.search(self.settings.GROUP_FILTER, self.settings.GROUP_ATTRIBUTES.keys()) self._sync_ldap_groups(ldap_groups) logger.info("Groups are synchronized")
Synchronize LDAP groups with local group model.
def sync_users(self): if self.settings.USER_FILTER: user_attributes = self.settings.USER_ATTRIBUTES.keys() + self.settings.USER_EXTRA_ATTRIBUTES ldap_users = self.ldap.search(self.settings.USER_FILTER, user_attributes) self._sync_ldap_users(ldap_users) lo...
Synchronize LDAP users with local user model.
def search_videos_by_tag(self, tag, category=None, period='today', orderby='relevance', page=1, count=20): url = 'https://openapi.youku.com/v2/searches/video/by_tag.json' params = { 'client_id': s...
doc: http://open.youku.com/docs/doc?id=80
def search_videos_by_keyword(self, keyword, category=None, period='week', orderby='relevance', public_type='all', paid=None, timeless=None, timemore=None, streamtypes=None, ...
doc: http://open.youku.com/docs/doc?id=81
def search_shows_by_keyword(self, keyword, unite=0, source_site=None, category=None, release_year=None, area=None, orderby='view-count', paid=None, hasvideotype=None, page=1, count=20): ...
doc: http://open.youku.com/docs/doc?id=82
def search_keyword_complete(self, keyword): url = 'https://openapi.youku.com/v2/searches/keyword/complete.json' params = { 'client_id': self.client_id, 'keyword': keyword } r = requests.get(url, params=params) check_error(r) return r.json(...
doc: http://open.youku.com/docs/doc?id=83
def search_keyword_top(self, category=None, count=20, period='today'): url = 'https://openapi.youku.com/v2/searches/keyword/top.json' params = { 'client_id': self.client_id, 'count': count, 'period': period } if category: params['c...
doc: http://open.youku.com/docs/doc?id=84
def search_show_address_unite(self, progammeId, source_site=None, type=None): url = 'https://openapi.youku.com/v2/searches/show/address_unite.json' params = { 'client_id': self.client_id, 'progammeId': progammeId, 'source_sit...
doc: http://open.youku.com/docs/doc?id=85
def search_show_top_unite(self, category, genre=None, area=None, year=None, orderby=None, headnum=1, tailnum=1, onesiteflag=None, page=1, count=20): url = 'https://openapi.youku.com/v2/searches/show/top_unite.json...
doc: http://open.youku.com/docs/doc?id=86
def find_playlist_by_id(self, playlist_id): url = 'https://openapi.youku.com/v2/playlists/show.json' params = { 'client_id': self.client_id, 'playlist_id': playlist_id } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=66
def find_playlists_by_ids(self, playlist_ids): url = 'https://openapi.youku.com/v2/playlists/show_batch.json' params = { 'client_id': self.client_id, 'playlist_ids': playlist_ids } r = requests.get(url, params=params) check_error(r) return...
doc: http://open.youku.com/docs/doc?id=67
def find_videos_by_playlist(self, playlist_id, page=1, count=20): url = 'https://openapi.youku.com/v2/playlists/videos.json' params = { 'client_id': self.client_id, 'playlist_id': playlist_id, 'page': page, 'count': count } r = req...
doc: http://open.youku.com/docs/doc?id=71
def update_playlist(self, access_token, playlist_id, title, tags=None, category=None, description=None): url = 'https://openapi.youku.com/v2/playlists/update.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'pl...
doc: http://open.youku.com/docs/doc?id=73
def destroy_playlist(self, access_token, playlist_id): url = 'https://openapi.youku.com/v2/playlists/destroy.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'playlist_id': playlist_id } r = requests.post(url, data=dat...
doc: http://open.youku.com/docs/doc?id=74
def add_videos_to_playlist(self, access_token, playlist_id, video_ids): url = 'https://openapi.youku.com/v2/playlists/video/add.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'playlist_id': playlist_id, 'video_ids': vide...
doc: http://open.youku.com/docs/doc?id=75
def set_cover_video_for_playlist(self, access_token, playlist_id, video_id): url = 'https://openapi.youku.com/v2/playlists/video/setcover.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'playlist_...
doc: http://open.youku.com/docs/doc?id=77
def find_next_video_in_playlist(self, playlist_id, cur_video_id): url = 'https://openapi.youku.com/v2/playlists/video/next.json' params = { 'client_id': self.client_id, 'playlist_id': playlist_id, 'video_id': cur_video_id } r = requests.get(ur...
doc: http://open.youku.com/docs/doc?id=78
def from_geo(geo, level): pixel = TileSystem.geo_to_pixel(geo, level) tile = TileSystem.pixel_to_tile(pixel) key = TileSystem.tile_to_quadkey(tile, level) return QuadKey(key)
Constucts a quadkey representation from geo and level geo => (lat, lon) If lat or lon are outside of bounds, they will be clipped If level is outside of bounds, an AssertionError is raised
def is_ancestor(self, node): if self.level <= node.level or self.key[:len(node.key)] != node.key: return None return self.level - node.level
If node is ancestor of self Get the difference in level If not, None
def xdifference(self, to): x,y = 0,1 assert self.level == to.level self_tile = list(self.to_tile()[0]) to_tile = list(to.to_tile()[0]) if self_tile[x] >= to_tile[x] and self_tile[y] <= self_tile[y]: ne_tile, sw_tile = self_tile, to_tile else: ...
Generator Gives the difference of quadkeys between self and to Generator in case done on a low level Only works with quadkeys of same level
def unwind(self): return [ QuadKey(self.key[:l+1]) for l in reversed(range(len(self.key))) ]
Get a list of all ancestors in descending order of level, including a new instance of self
def find_comment_by_id(self, comment_id): url = 'https://openapi.youku.com/v2/comments/show.json' params = { 'client_id': self.client_id, 'comment_id': comment_id } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=32
def find_comments_by_ids(self, comment_ids): url = 'https://openapi.youku.com/v2/comments/show_batch.json' params = { 'client_id': self.client_id, 'comment_ids': comment_ids } r = requests.get(url, params=params) check_error(r) return r.js...
doc: http://open.youku.com/docs/doc?id=34
def find_comments_by_video(self, video_id, page=1, count=20): url = 'https://openapi.youku.com/v2/comments/by_video.json' params = { 'client_id': self.client_id, 'video_id': video_id, 'page': page, 'count': count } r = requests.get...
doc: http://open.youku.com/docs/doc?id=35
def find_comments_by_me(self, access_token, page=1, count=20): url = 'https://openapi.youku.com/v2/comments/by_me.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'page': page, 'count': count } r = requests...
doc: http://open.youku.com/docs/doc?id=37
def create_comment(self, access_token, video_id, content, reply_id=None, captcha_key=None, captcha_text=None): url = 'https://openapi.youku.com/v2/comments/create.json' data = { 'client_id': self.client_id, 'access_token': access_token, ...
doc: http://open.youku.com/docs/doc?id=41
def destroy_comment(self, access_token, comment_id): url = 'https://openapi.youku.com/v2/comments/destroy.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'comment_id': comment_id } r = requests.post(url, data=data) ...
doc: http://open.youku.com/docs/doc?id=42
def validate(self): if self.GROUP_ATTRIBUTES and self.GROUPNAME_FIELD not in self.GROUP_ATTRIBUTES.values(): raise ImproperlyConfigured("LDAP_SYNC_GROUP_ATTRIBUTES must contain '%s'" % self.GROUPNAME_FIELD) if not self.model._meta.get_field(self.USERNAME_FIELD).unique: ...
Apply validation rules for loaded settings.
def user_active_directory_enabled(user, attributes, created, updated): try: user_account_control = int(attributes['userAccountControl'][0]) if user_account_control & 2: user.is_active = False else: user.is_active = True except KeyError: pass
Activate/deactivate user accounts based on Active Directory's userAccountControl flags. Requires 'userAccountControl' to be included in LDAP_SYNC_USER_EXTRA_ATTRIBUTES.
def find_video_by_id(self, video_id): url = 'https://openapi.youku.com/v2/videos/show_basic.json' params = { 'client_id': self.client_id, 'video_id': video_id } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=44
def find_video_by_url(self, video_url): url = 'https://openapi.youku.com/v2/videos/show_basic.json' params = { 'client_id': self.client_id, 'video_url': video_url } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=44
def find_videos_by_ids(self, video_ids): url = 'https://openapi.youku.com/v2/videos/show_basic_batch.json' params = { 'client_id': self.client_id, 'video_ids': video_ids } r = requests.get(url, params=params) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=45
def find_video_detail_by_id(self, video_id, ext=None): url = 'https://api.youku.com/videos/show.json' params = { 'client_id': self.client_id, 'video_id': video_id } if ext: params['ext'] = ext r = requests.get(url, params=params) ...
doc: http://cloud.youku.com/docs?id=46
def find_video_details_by_ids(self, video_ids, ext=None): url = 'https://openapi.youku.com/v2/videos/show_batch.json' params = { 'client_id': self.client_id, 'video_ids': video_ids } if ext: params['ext'] = ext r = requests.get(url, pa...
doc: http://open.youku.com/docs/doc?id=47
def update_video(self, access_token, video_id, title=None, tags=None, category=None, copyright_type=None, public_type=None, watch_password=None, description=None, thumbnail_seq=None): url = 'https://openapi.youku.com/v2/videos/update.json' ...
doc: http://open.youku.com/docs/doc?id=50
def find_videos_by_related(self, video_id, count=20): url = 'https://openapi.youku.com/v2/videos/by_related.json' params = { 'client_id': self.client_id, 'video_id': video_id, 'count': count } r = requests.get(url, params=params) check...
doc: http://open.youku.com/docs/doc?id=52
def find_favorite_videos_by_userid(self, user_id, orderby='favorite-time', page=1, count=20): url = 'https://openapi.youku.com/v2/videos/favorite/by_user.json' params = { 'client_id': self.client_id, ...
doc: http://open.youku.com/docs/doc?id=54
def find_favorite_videos_by_username(self, user_name, orderby='favorite-time', page=1, count=20): url = 'https://openapi.youku.com/v2/videos/favorite/by_user.json' params = { 'client_id': self.client_i...
doc: http://open.youku.com/docs/doc?id=54
def create_favorite_video(self, access_token, video_id): url = 'https://openapi.youku.com/v2/videos/favorite/create.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'video_id': video_id } r = requests.post(url, data=da...
doc: http://open.youku.com/docs/doc?id=55
def search(self, filterstr, attrlist): return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr, attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
Query the configured LDAP server.
def _paged_search_ext_s(self, base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0, serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0, page_size=10): request_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='') results = [] ...
Behaves similarly to LDAPObject.search_ext_s() but internally uses the simple paged results control to retrieve search results in chunks. Taken from the python-ldap paged_search_ext_s.py demo, showing how to use the paged results control: https://bitbucket.org/jaraco/python-ldap/
def video_category(self): url = 'https://openapi.youku.com/v2/schemas/video/category.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=90
def upload_spec(self): url = 'https://openapi.youku.com/v2/schemas/upload/spec.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=91
def comment_expression(self): url = 'https://openapi.youku.com/v2/schemas/comment/expression.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=92
def show_category(self): url = 'https://openapi.youku.com/v2/schemas/show/category.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=93
def playlist_category(self): url = 'https://openapi.youku.com/v2/schemas/playlist/category.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=94
def searche_top_category(self): url = 'https://openapi.youku.com/v2/schemas/searche/top/category.json' r = requests.get(url) check_error(r) return r.json()
doc: http://open.youku.com/docs/doc?id=95
def cli(ctx, feature_id, name, organism="", sequence=""): return ctx.gi.annotations.set_name(feature_id, name, organism=organism, sequence=sequence)
Set a feature's name Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, feature_id, organism="", sequence=""): return ctx.gi.annotations.delete_sequence_alteration(feature_id, organism=organism, sequence=sequence)
[UNTESTED] Delete a specific feature alteration Output: A list of sequence alterations(?)
def fetch_lid(self, woeid): rss = self._fetch_xml(LID_LOOKUP_URL.format(woeid, "f")) # We are pulling the LID from the permalink tag in the XML file # returned by Yahoo. try: link = rss.find("channel/link").text except AttributeError: return Non...
Fetch a location's corresponding LID. Args: woeid: (string) the location's WOEID. Returns: a string containing the requested LID or None if the LID could not be found. Raises: urllib.error.URLError: urllib.request could not open the URL ...
def fetch_woeid(self, location): rss = self._fetch_xml( WOEID_LOOKUP_URL.format(quote(location))) try: woeid = rss.find("results/Result/woeid").text except AttributeError: return None return woeid
Fetch a location's corresponding WOEID. Args: location: (string) a location (e.g. 23454 or Berlin, Germany). Returns: a string containing the location's corresponding WOEID or None if the WOEID could not be found. Raises: urllib.error.URLErr...
def _degrees_to_direction(self, degrees): try: degrees = float(degrees) except ValueError: return None if degrees < 0 or degrees > 360: return None if degrees <= 11.25 or degrees >= 348.76: return "N" elif degrees <= 33.75:...
Convert wind direction from degrees to compass direction.
def _fetch_xml(self, url): with contextlib.closing(urlopen(url)) as f: return xml.etree.ElementTree.parse(f).getroot()
Fetch a url and parse the document's XML.
def cli(ctx, feature_id, symbol, organism="", sequence=""): return ctx.gi.annotations.set_symbol(feature_id, symbol, organism=organism, sequence=sequence)
Set a feature's description Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, feature={}, organism="", sequence=""): return ctx.gi.annotations.add_feature(feature=feature, organism=organism, sequence=sequence)
Add a feature Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, common_name, directory, blatdb="", genus="", species="", public=False): return ctx.gi.organisms.add_organism(common_name, directory, blatdb=blatdb, genus=genus, species=species, public=public)
Add an organism Output: a dictionary with information about the new organism
def cli(ctx, url=None, api_key=None, admin=False, **kwds): # TODO: prompt for values someday. click.echo("""Welcome to Apollo's Arrow!""") if os.path.exists(config.global_config_path()): info("Your arrow configuration already exists. Please edit it instead: %s" % config.global_config_path()) ...
Help initialize global configuration (in home directory)
def cli(ctx, id_number, new_key, metadata=""): return ctx.gi.cannedkeys.update_key(id_number, new_key, metadata=metadata)
Update a canned key Output: an empty dictionary
def cli(ctx, organism, export_type="FASTA", seq_type="peptide", export_format="text", export_gff3_fasta=False, sequences=None, region=""): return ctx.gi.io.write_downloadable(organism, export_type=export_type, seq_type=seq_type, export_format=export_format, export_gff3_fasta=export_gff3_fasta, sequences=sequen...
Prepare a download for an organism Output: a dictionary containing download information
def cli(ctx, transcript={}, suppress_history=False, suppress_events=False, organism="", sequence=""): return ctx.gi.annotations.add_transcript(transcript=transcript, suppress_history=suppress_history, suppress_events=suppress_events, organism=organism, sequence=sequence)
[UNTESTED] Add a transcript to a feature Output: A standard apollo feature dictionary ({"features": [{...}]})
def add_value(self, value, metadata=""): data = { 'value': value, 'metadata': metadata } return self.post('createValue', data)
Add a canned value :type value: str :param value: New canned value :type metadata: str :param metadata: Optional metadata :rtype: dict :return: A dictionnary containing canned value description
def show_value(self, value): values = self.get_values() values = [x for x in values if x['label'] == value] if len(values) == 0: raise Exception("Unknown value") else: return values[0]
Get a specific canned value :type value: str :param value: Canned value to show :rtype: dict :return: A dictionnary containing canned value description
def update_value(self, id_number, new_value, metadata=None): data = { 'id': id_number, 'new_value': new_value } if metadata is not None: data['metadata'] = metadata return self.post('updateValue', data)
Update a canned value :type id_number: int :param id_number: canned value ID number :type new_value: str :param new_value: New canned value value :type metadata: str :param metadata: Optional metadata :rtype: dict :return: an empty dictionary
def add_key(self, key, metadata=""): data = { 'key': key, 'metadata': metadata } return self.post('createKey', data)
Add a canned key :type key: str :param key: New canned key :type metadata: str :param metadata: Optional metadata :rtype: dict :return: A dictionnary containing canned key description
def show_key(self, value): keys = self.get_keys() keys = [x for x in keys if x['label'] == value] if len(keys) == 0: raise Exception("Unknown key") else: return keys[0]
Get a specific canned key :type value: str :param value: Canned key to show :rtype: dict :return: A dictionnary containing canned key description
def update_key(self, id_number, new_key, metadata=None): data = { 'id': id_number, 'new_key': new_key } if metadata is not None: data['metadata'] = metadata return self.post('updateKey', data)
Update a canned key :type id_number: int :param id_number: canned key ID number :type new_key: str :param new_key: New canned key value :type metadata: str :param metadata: Optional metadata :rtype: dict :return: an empty dictionary
def cli(ctx, id_number, new_value, metadata=""): return ctx.gi.cannedvalues.update_value(id_number, new_value, metadata=metadata)
Update a canned value Output: an empty dictionary
def download(self, dest_pattern="{originalFilename}", override=True, parent=False): if self.id is None: raise ValueError("Cannot download image with no ID.") pattern = re.compile("{(.*?)}") dest_pattern = re.sub(pattern, lambda m: str(getattr(self, str(m.group(0))[1:-1], "_...
Download the original image. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute if it exists. override : bool, optional True if a file with same name ca...
def filtered_elements(self, model): if isinstance(model, self.element_type): yield model yield from (e for e in model.eAllContents() if isinstance(e, self.element_type))
Return iterator based on `element_type`.
def folder_path_for_package(cls, package: ecore.EPackage): parent = package.eContainer() if parent: return os.path.join(cls.folder_path_for_package(parent), package.name) return package.name
Returns path to folder holding generated artifact for given element.
def imported_classifiers_package(p: ecore.EPackage): classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} references = itertools.chain(*(c.eAllReferences() for c in classes)) references_types = (r.eType for r in references) imported = {c for c in references_type...
Determines which classifiers have to be imported into given package.
def imported_classifiers(p: ecore.EPackage): classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} supertypes = itertools.chain(*(c.eAllSuperTypes() for c in classes)) imported = {c for c in supertypes if c.ePackage is not p} attributes = itertools.chain(*(c.eAt...
Determines which classifiers have to be imported into given module.
def classes(p: ecore.EPackage): classes = (c for c in p.eClassifiers if isinstance(c, ecore.EClass)) return sorted(classes, key=lambda c: len(set(c.eAllSuperTypes())))
Returns classes in package in ordered by number of bases.
def filter_all_contents(value: ecore.EPackage, type_): return (c for c in value.eAllContents() if isinstance(c, type_))
Returns `eAllContents(type_)`.
def filter_pyfqn(cls, value, relative_to=0): def collect_packages(element, packages): parent = element.eContainer() if parent: collect_packages(parent, packages) packages.append(element.name) packages = [] collect_packages(value, pac...
Returns Python form of fully qualified name. Args: relative_to: If greater 0, the returned path is relative to the first n directories.
def create_environment(self, **kwargs): environment = super().create_environment(**kwargs) environment.tests.update({ 'type': self.test_type, 'kind': self.test_kind, 'opposite_before_self': self.test_opposite_before_self, }) environment.filter...
Return a new Jinja environment. Derived classes may override method to pass additional parameters or to change the template loader type.
def generate(self, model, outfolder, *, exclude=None): with pythonic_names(): super().generate(model, outfolder) check_dependency = self.with_dependencies and model.eResource if check_dependency: if exclude is None: exclude = set(...
Generate model code. Args: model: The meta-model to generate code for. outfolder: Path to the directoty that will contain the generated code. exclude: List of referenced resources for which code was already generated (to prevent regeneration).
def cli(ctx, feature_id, db, accession, organism="", sequence=""): return ctx.gi.annotations.delete_dbxref(feature_id, db, accession, organism=organism, sequence=sequence)
Delete a dbxref from a feature Output: A standard apollo feature dictionary ({"features": [{...}]})
def add_organism(self, common_name, directory, blatdb=None, genus=None, species=None, public=False): data = { 'commonName': common_name, 'directory': directory, 'publicMode': public, } if blatdb is not None: data['bla...
Add an organism :type common_name: str :param common_name: Organism common name :type directory: str :param directory: Server-side directory :type blatdb: str :param blatdb: Server-side Blat directory for the organism :type genus: str :param genus: Gen...
def update_organism(self, organism_id, common_name, directory, blatdb=None, species=None, genus=None, public=False): data = { 'id': organism_id, 'name': common_name, 'directory': directory, 'publicMode': public, } if blatdb is not None: ...
Update an organism :type organism_id: str :param organism_id: Organism ID Number :type common_name: str :param common_name: Organism common name :type directory: str :param directory: Server-side directory :type blatdb: str :param blatdb: Server-side B...
def cli(ctx, feature_id, organism="", sequence=""): return ctx.gi.annotations.set_readthrough_stop_codon(feature_id, organism=organism, sequence=sequence)
Set the feature to read through the first encountered stop codon Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, exon_a, exon_b, organism="", sequence=""): return ctx.gi.annotations.merge_exons(exon_a, exon_b, organism=organism, sequence=sequence)
Merge two exons Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, id_number, new_value): return ctx.gi.status.update_status(id_number, new_value)
Update a status name Output: an empty dictionary
def cli(ctx, feature_id, description, organism="", sequence=""): return ctx.gi.annotations.set_description(feature_id, description, organism=organism, sequence=sequence)
Set a feature's description Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, group, user): return ctx.gi.users.remove_from_group(group, user)
Remove a user from a group Output: an empty dictionary
def cli(ctx, feature_id, end, organism="", sequence=""): return ctx.gi.annotations.set_translation_end(feature_id, end, organism=organism, sequence=sequence)
Set a feature's end Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, transcript_id, organism="", sequence=""): return ctx.gi.annotations.duplicate_transcript(transcript_id, organism=organism, sequence=sequence)
Duplicate a transcripte Output: A standard apollo feature dictionary ({"features": [{...}]})
def cli(ctx, feature_id, organism="", sequence=""): return ctx.gi.annotations.get_feature_sequence(feature_id, organism=organism, sequence=sequence)
[CURRENTLY BROKEN] Get the sequence of a feature Output: A standard apollo feature dictionary ({"features": [{...}]})
def show_group(self, group_id): res = self.post('loadGroups', {'groupId': group_id}) if isinstance(res, list): return _fix_group(res[0]) else: return _fix_group(res)
Get information about a group :type group_id: int :param group_id: Group ID Number :rtype: dict :return: a dictionary containing group information
def update_group(self, group_id, new_name): data = { 'id': group_id, 'name': new_name, } try: response = self.post('updateGroup', data) except Exception: pass # Apollo returns a 404 here for some unholy reason, despite act...
Update the name of a group :type group_id: int :param group_id: group ID number :type new_name: str :param new_name: New name for the group :rtype: dict :return: a dictionary containing group information