code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
return ctx.gi.annotations.duplicate_transcript(transcript_id, organism=organism, sequence=sequence) | def cli(ctx, transcript_id, organism="", sequence="") | Duplicate a transcripte
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 4.21205 | 4.75919 | 0.885035 |
return ctx.gi.annotations.get_feature_sequence(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | [CURRENTLY BROKEN] Get the sequence of a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.121275 | 4.21309 | 0.740852 |
res = self.post('loadGroups', {'groupId': group_id})
if isinstance(res, list):
return _fix_group(res[0])
else:
return _fix_group(res) | def show_group(self, group_id) | Get information about a group
:type group_id: int
:param group_id: Group ID Number
:rtype: dict
:return: a dictionary containing group information | 4.274766 | 4.885874 | 0.874923 |
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 actually
# renaming the group.
... | def update_group(self, group_id, new_name) | 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 | 5.567718 | 6.955063 | 0.800527 |
data = {
'name': group,
}
response = _fix_group(self.post('getOrganismPermissionsForGroup', data))
return response | def get_organism_permissions(self, group) | Get the group's organism permissions
:type group: str
:param group: group name
:rtype: list
:return: a list containing organism permissions (if any) | 8.344478 | 9.686813 | 0.861426 |
data = {
'name': group,
'organism': organism_name,
'ADMINISTRATE': administrate,
'WRITE': write,
'EXPORT': export,
'READ': read,
}
response = self.post('updateOrganismPermission', data)
response['permissions... | def update_organism_permissions(self, group, organism_name,
administrate=False, write=False,
read=False, export=False) | Update the group's permissions on an organism
:type group: str
:param group: group name
:type organism_name: str
:param organism_name: Organism name
:type administrate: bool
:param administrate: Should the group have administrate privileges
:type read: bool
... | 2.603194 | 3.028918 | 0.859447 |
data = {
'groupId': group_id,
'users': users,
}
return _fix_group(self.post('updateMembership', data)) | def update_membership(self, group_id, users=[]) | Update the group's membership
:type group_id: int
:param group_id: Group ID Number
:type users: list of str
:param users: List of emails
:rtype: dict
:return: dictionary of group information | 5.249377 | 7.831807 | 0.670264 |
data = {
'groupId': group_id,
'users': users,
}
return _fix_group(self.post('updateGroupAdmin', data)) | def update_group_admin(self, group_id, users=[]) | Update the group's admins
:type group_id: int
:param group_id: Group ID Number
:type users: list of str
:param users: List of emails
:rtype: dict
:return: dictionary of group information | 4.883922 | 7.455985 | 0.655034 |
data = {
'name': group,
}
response = _fix_group(self.post('getGroupAdmin', data))
return response | def get_group_admin(self, group) | Get the group's admins
:type group: str
:param group: group name
:rtype: list
:return: a list containing group admins | 8.789573 | 11.037969 | 0.796303 |
data = {
'name': group,
}
response = _fix_group(self.post('getGroupCreator', data))
return response | def get_group_creator(self, group) | Get the group's creator
:type group: str
:param group: group name
:rtype: list
:return: creator userId | 9.24516 | 11.477067 | 0.805533 |
parameters = params or {}
for param, value in parameters.items():
param_value = str(value).lower() if isinstance(value, bool) else value
parameters[param] = param_value
return urlencode(parameters) | def _create_query_string(params) | Support Elasticsearch 5.X | 3.756729 | 3.256825 | 1.153494 |
parameters = parameters or {}
path = self.create_path('count', index=index, type=type, **parameters)
if source:
source = json_encode(source)
self.post_by_path(path=path, callback=callback, source=source) | def count(self, index="_all", type='', source='', parameters=None, callback=None) | The query can either be provided using a simple query string as a parameter 'q',
or using the Query DSL defined within the request body (source).
Notice there are additional query string parameters that could be added only with the first option. | 3.933303 | 4.278508 | 0.919316 |
return ctx.gi.annotations.delete_attribute(feature_id, attribute_key, attribute_value, organism=organism, sequence=sequence) | def cli(ctx, feature_id, attribute_key, attribute_value, organism="", sequence="") | Delete an attribute from a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.27509 | 3.146811 | 0.722983 |
statuses = self.get_statuses()
statuses = [x for x in statuses if x['value'] == status]
if len(statuses) == 0:
raise Exception("Unknown status value")
else:
return statuses[0] | def show_status(self, status) | Get a specific status
:type status: str
:param status: Status to show
:rtype: dict
:return: A dictionnary containing status description | 3.152681 | 3.441213 | 0.916154 |
data = {
'id': id_number,
'new_value': new_value
}
return self.post('updateStatus', data) | def update_status(self, id_number, new_value) | Update a status name
:type id_number: int
:param id_number: status ID number
:type new_value: str
:param new_value: The new status name
:rtype: dict
:return: an empty dictionary | 3.458005 | 4.984392 | 0.693767 |
return ctx.gi.cannedcomments.update_comment(id_number, new_value, metadata=metadata) | def cli(ctx, id_number, new_value, metadata="") | Update a canned comment
Output:
an empty dictionary | 5.632055 | 5.734009 | 0.982219 |
data = {
'features': [
{
'uniquename': feature_id,
'description': description,
}
]
}
data = self._update_data(data, sequence, organism)
return self.post('setDescription', data) | def set_description(self, feature_id, description, organism=None, sequence=None) | Set a feature's description
:type feature_id: str
:param feature_id: Feature UUID
:type description: str
:param description: Feature description
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Nam... | 3.656336 | 4.607587 | 0.793547 |
# TODO
data = {
'features': [
{
'uniquename': feature_id,
'name': name,
}
],
}
data = self._update_data(data, organism, sequence)
return self.post('setName', data) | def set_name(self, feature_id, name, organism=None, sequence=None) | Set a feature's name
:type feature_id: str
:param feature_id: Feature UUID
:type name: str
:param name: Feature name
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
... | 3.888617 | 4.598516 | 0.845624 |
data = {
'features': [
{
'uniquename': feature_id,
'status': status,
}
],
}
data = self._update_data(data, organism, sequence)
return self.post('setStatus', data) | def set_status(self, feature_id, status, organism=None, sequence=None) | Set a feature's description
:type feature_id: str
:param feature_id: Feature UUID
:type status: str
:param status: Feature status
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rty... | 3.249223 | 4.44101 | 0.731641 |
data = {
'features': [
{
'uniquename': feature_id,
'symbol': symbol,
}
],
}
data = self._update_data(data, organism, sequence)
return self.post('setSymbol', data) | def set_symbol(self, feature_id, symbol, organism=None, sequence=None) | Set a feature's description
:type feature_id: str
:param feature_id: Feature UUID
:type symbol: str
:param symbol: Feature symbol
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rty... | 3.221773 | 4.169587 | 0.772684 |
data = {
'features': [
{
'uniquename': feature_id,
}
],
}
data = self._update_data(data, organism, sequence)
return self.post('getComments', data) | def get_comments(self, feature_id, organism=None, sequence=None) | Get a feature's comments
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictionary ({"fe... | 4.037966 | 5.485144 | 0.736164 |
data = {
'features': [
{
'uniquename': feature_id,
'comments': comments
}
],
}
data = self._update_data(data, organism, sequence)
return self.post('addComments', data) | def add_comment(self, feature_id, comments=[], organism=None, sequence=None) | Set a feature's description
:type feature_id: str
:param feature_id: Feature UUID
:type comments: list
:param comments: Feature comments
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
... | 3.425352 | 4.76863 | 0.718309 |
data = {
'features': [
{
'uniquename': feature_id,
'non_reserved_properties': [
{
'tag': attribute_key,
'value': attribute_value,
}... | def add_attribute(self, feature_id, attribute_key, attribute_value, organism=None, sequence=None) | Add an attribute to a feature
:type feature_id: str
:param feature_id: Feature UUID
:type attribute_key: str
:param attribute_key: Attribute Key
:type attribute_value: str
:param attribute_value: Attribute Value
:type organism: str
:param organism: Org... | 3.487293 | 4.13875 | 0.842596 |
data = {
'features': [
{
'uniquename': feature_id,
'old_non_reserved_properties': [
{
'tag': attribute_key,
'value': old_value,
}
... | def update_attribute(self, feature_id, attribute_key, old_value, new_value, organism=None, sequence=None) | Delete an attribute from a feature
:type feature_id: str
:param feature_id: Feature UUID
:type attribute_key: str
:param attribute_key: Attribute Key
:type old_value: str
:param old_value: Old attribute value
:type new_value: str
:param new_value: New ... | 2.585392 | 2.92424 | 0.884124 |
data = {
'features': [
{
'uniquename': feature_id,
'dbxrefs': [
{
'db': db,
'accession': accession,
}
]
... | def add_dbxref(self, feature_id, db, accession, organism=None, sequence=None) | Add a dbxref to a feature
:type feature_id: str
:param feature_id: Feature UUID
:type db: str
:param db: DB Name (e.g. PMID)
:type accession: str
:param accession: Accession Value
:type organism: str
:param organism: Organism Common Name
:type... | 2.442054 | 2.997386 | 0.814728 |
data = {
'features': [
{
'uniquename': feature_id,
'old_dbxrefs': [
{
'db': old_db,
'accession': old_accession,
}
... | def update_dbxref(self, feature_id, old_db, old_accession, new_db, new_accession, organism=None, sequence=None) | Delete a dbxref from a feature
:type feature_id: str
:param feature_id: Feature UUID
:type old_db: str
:param old_db: Old DB Name (e.g. PMID)
:type old_accession: str
:param old_accession: Old accession Value
:type new_db: str
:param new_db: New DB Nam... | 1.999203 | 2.265095 | 0.882614 |
data = {}
data = self._update_data(data, organism, sequence)
return self.post('getFeatures', data) | def get_features(self, organism=None, sequence=None) | Get the features for an organism / sequence
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictionary ({"features": [{...}]}) | 6.487785 | 8.661544 | 0.749033 |
# Choices: peptide, cds, cdna, genomic
# { "track": "Miro.v2", "features": [ { "uniquename": "714dcda6-2358-467d-855e-f495a82aa154" } ], "operation": "get_sequence", "type": "peptide" }:
# { "track": "Miro.v2", "features": [ { "uniquename": "714dcda6-2358-467d-855e-f495a82aa154" } ... | def get_feature_sequence(self, feature_id, organism=None, sequence=None) | [CURRENTLY BROKEN] Get the sequence of a feature
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo ... | 4.634574 | 4.746593 | 0.9764 |
data = {
'features': feature,
}
data = self._update_data(data, organism, sequence)
return self.post('addFeature', data) | def add_feature(self, feature={}, organism=None, sequence=None) | Add a feature
:type feature: dict
:param feature: Feature information
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictionary ({"features": ... | 4.724228 | 6.115115 | 0.772549 |
data = {
'suppressHistory': suppress_history,
'suppressEvents': suppress_events,
'features': [
transcript
]
}
data = self._update_data(data, organism, sequence)
return self.post('addTranscript', data) | def add_transcript(self, transcript={}, suppress_history=False, suppress_events=False, organism=None, sequence=None) | [UNTESTED] Add a transcript to a feature
:type transcript: dict
:param transcript: Transcript data
:type suppress_history: bool
:param suppress_history: Suppress the history of this operation
:type suppress_events: bool
:param suppress_events: Suppress instant update o... | 3.388412 | 5.113358 | 0.662659 |
data = {
'features': [
{
'uniquename': transcript_id
}
]
}
data = self._update_data(data, organism, sequence)
return self.post('duplicateTranscript', data) | def duplicate_transcript(self, transcript_id, organism=None, sequence=None) | Duplicate a transcripte
:type transcript_id: str
:param transcript_id: Transcript UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictiona... | 3.783521 | 4.962532 | 0.762417 |
data = {
'features': [{
'uniquename': feature_id,
'location': {
'fmin': start
}
}]
}
data = self._update_data(data, organism, sequence)
return self.post('setTranslationStart', data) | def set_translation_start(self, feature_id, start, organism=None, sequence=None) | Set the translation start of a feature
:type feature_id: str
:param feature_id: Feature UUID
:type start: int
:param start: Feature start
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
... | 3.148133 | 4.090161 | 0.769684 |
data = {
'features': [{
'uniquename': feature_id,
'location': {
'fmax': end
}
}]
}
data = self._update_data(data, organism, sequence)
return self.post('setTranslationEnd', data) | def set_translation_end(self, feature_id, end, organism=None, sequence=None) | Set a feature's end
:type feature_id: str
:param feature_id: Feature UUID
:type end: int
:param end: Feature end
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
... | 3.32885 | 4.257677 | 0.781847 |
data = {
'features': [
{
'uniquename': feature_id,
}
]
}
data = self._update_data(data, organism, sequence)
return self.post('setLongestOrf', data) | def set_longest_orf(self, feature_id, organism=None, sequence=None) | Automatically pick the longest ORF in a feature
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo f... | 3.416285 | 4.559362 | 0.74929 |
data = {
'features': [{
'uniquename': feature_id,
'location': {
'fmin': start,
'fmax': end,
}
}]
}
data = self._update_data(data, organism, sequence)
return self.post(... | def set_boundaries(self, feature_id, start, end, organism=None, sequence=None) | Set the boundaries of a genomic feature
:type feature_id: str
:param feature_id: Feature UUID
:type start: int
:param start: Feature start
:type end: int
:param end: Feature end
:type organism: str
:param organism: Organism Common Name
:type s... | 2.860722 | 3.462523 | 0.826196 |
data = {
'features': [{
'uniquename': feature_id,
}]
}
data = self._update_data(data, organism, sequence)
return self.post('setReadthroughStopCodon', data) | def set_readthrough_stop_codon(self, feature_id, organism=None, sequence=None) | Set the feature to read through the first encountered stop codon
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A ... | 3.545618 | 4.802197 | 0.738333 |
data = {}
data = self._update_data(data, organism, sequence)
return self.post('getSequenceAlterations', data) | def get_sequence_alterations(self, organism=None, sequence=None) | [UNTESTED] Get all of the sequence's alterations
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: list
:return: A list of sequence alterations(?) | 5.701974 | 7.427147 | 0.767721 |
data = {
'features': [{
'uniquename': feature_id,
}]
}
data = self._update_data(data, organism, sequence)
return self.post('deleteSequenceAlteration', data) | def delete_sequence_alteration(self, feature_id, organism=None, sequence=None) | [UNTESTED] Delete a specific feature alteration
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: list
:return: A list of sequence ... | 3.485869 | 5.028484 | 0.693225 |
data = {
'features': [
{
'uniquename': feature_id,
}
]
}
data = self._update_data(data, organism, sequence)
return self.post('flipStrand', data) | def flip_strand(self, feature_id, organism=None, sequence=None) | Flip the strand of a feature
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictionary (... | 3.461486 | 4.795427 | 0.721831 |
data = {
'features': [
{'uniquename': exon_a},
{'uniquename': exon_b},
]
}
data = self._update_data(data, organism, sequence)
return self.post('mergeExons', data) | def merge_exons(self, exon_a, exon_b, organism=None, sequence=None) | Merge two exons
:type exon_a: str
:param exon_a: Feature UUID
:type exon_b: str
:param exon_b: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:retu... | 3.420423 | 3.80614 | 0.898659 |
data = {
'features': [
{
'uniquename': feature_id,
}
]
}
data = self._update_data(data, organism, sequence)
return self.post('deleteFeature', data) | def delete_feature(self, feature_id, organism=None, sequence=None) | Delete a feature
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: dict
:return: A standard apollo feature dictionary ({"features":... | 3.434898 | 4.648285 | 0.73896 |
data = {
'features': [
{
'uniquename': feature_id
}
]
}
data = self._update_data(data, organism, sequence)
return self.post('getGff3', data, is_json=False) | def get_gff3(self, feature_id, organism=None, sequence=None) | Get the GFF3 associated with a feature
:type feature_id: str
:param feature_id: Feature UUID
:type organism: str
:param organism: Organism Common Name
:type sequence: str
:param sequence: Sequence Name
:rtype: str
:return: GFF3 text content | 3.821348 | 4.934492 | 0.774416 |
if len(response.keys()) == 0:
response = self.show_user(user)
# And sometimes show_user can return nothing. Ask again...
if len(response) == 0:
response = self.show_user(user)
return response | def _handle_empty(self, user, response) | Apollo likes to return empty user arrays, even when you REALLY
want a user response back... like creating a user. | 5.899857 | 4.865153 | 1.212676 |
payload = {}
if omit_empty_organisms:
payload['omitEmptyOrganisms'] = omit_empty_organisms
res = self.post('loadUsers', payload)
data = [_fix_user(user) for user in res]
return data | def get_users(self, omit_empty_organisms=False) | Get all users known to this Apollo instance
:type omit_empty_organisms: bool
:param omit_empty_organisms: Will omit users having no access to any organism
:rtype: list of dicts
:return: list of user info dictionaries | 4.003703 | 5.028404 | 0.796217 |
res = self.post('loadUsers', {'userId': user})
if isinstance(res, list) and len(res) > 0:
res = res[0]
return _fix_user(res) | def show_user(self, user) | Get a specific user
:type user: str
:param user: User Email
:rtype: dict
:return: a dictionary containing user information | 5.118401 | 5.545456 | 0.92299 |
data = {
'user': user,
'organism': organism,
'ADMINISTRATE': administrate,
'WRITE': write,
'EXPORT': export,
'READ': read,
}
response = self.post('updateOrganismPermission', data)
if 'permissions' in respons... | def update_organism_permissions(self, user, organism, administrate=False,
write=False, export=False, read=False) | Update the permissions of a user on a specified organism
:type user: str
:param user: User's email
:type organism: str
:param organism: organism common name
:type administrate: bool
:param administrate: Grants administrative privileges
:type write: bool
... | 2.254445 | 2.678943 | 0.841543 |
data = {'group': group, 'user': user}
return self.post('addUserToGroup', data) | def add_to_group(self, group, user) | Add a user to a group
:type user: str
:param user: User's email
:type group: str
:param group: Group name
:rtype: dict
:return: an empty dictionary | 4.39264 | 5.837295 | 0.752513 |
data = {'group': group, 'user': user}
return self.post('removeUserFromGroup', data) | def remove_from_group(self, group, user) | Remove a user from a group
:type user: str
:param user: User's email
:type group: str
:param group: Group name
:rtype: dict
:return: an empty dictionary | 4.13964 | 6.061523 | 0.682937 |
data = {
'firstName': first_name,
'lastName': last_name,
'email': email,
'metadata': metadata,
'role': role.upper() if role else role,
'newPassword': password,
}
response = self.post('createUser', data)
retu... | def create_user(self, email, first_name, last_name, password, role="user", metadata={}) | Create a new user
:type email: str
:param email: User's email
:type first_name: str
:param first_name: User's first name
:type last_name: str
:param last_name: User's last name
:type password: str
:param password: User's password
:type role: s... | 3.250471 | 3.940079 | 0.824976 |
data = {
'email': email,
'firstName': first_name,
'lastName': last_name,
'newPassword': password,
'metadata': metadata,
}
response = self.post('updateUser', data)
return self._handle_empty(email, response) | def update_user(self, email, first_name, last_name, password, metadata={}) | Update an existing user
:type email: str
:param email: User's email
:type first_name: str
:param first_name: User's first name
:type last_name: str
:param last_name: User's last name
:type password: str
:param password: User's password
:type m... | 2.675991 | 3.468906 | 0.771422 |
cache_key = 'user-list'
try:
# Get the cached value
data = userCache[cache_key]
except KeyError:
# If we hit a key error above, indicating that
# we couldn't find the key, we'll simply re-request
# the data
data = wa.users.loadUsers()
userCache[ca... | def require_user(wa, email) | Require that the user has an account | 6.972456 | 7.249631 | 0.961767 |
permission_map = {
x['organism']: x['permissions']
for x in user.organismPermissions
if 'WRITE' in x['permissions'] or
'READ' in x['permissions'] or
'ADMINISTRATE' in x['permissions'] or
user.role == 'ADMIN'
}
if 'error' in orgs:
raise Exception(... | def accessible_organisms(user, orgs) | Get the list of organisms accessible to a user, filtered by `orgs` | 4.259753 | 4.238694 | 1.004968 |
return ctx.gi.annotations.get_comments(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Get a feature's comments
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.864573 | 4.167704 | 0.927267 |
return ctx.gi.annotations.set_longest_orf(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Automatically pick the longest ORF in a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 4.932427 | 5.723595 | 0.861771 |
return ctx.gi.io.download(uuid, output_format=output_format) | def cli(ctx, uuid, output_format="gzip") | Download pre-prepared data by UUID
Output:
The downloaded content | 6.410563 | 11.198252 | 0.572461 |
return ctx.gi.groups.update_membership(group_id, users=users) | def cli(ctx, group_id, users=None) | Update the group's membership
Output:
dictionary of group information | 4.89978 | 7.271857 | 0.6738 |
return ctx.gi.cannedkeys.add_key(key, metadata=metadata) | def cli(ctx, key, metadata="") | Add a canned key
Output:
A dictionnary containing canned key description | 9.364997 | 7.571057 | 1.236947 |
return ctx.gi.annotations.set_status(feature_id, status, organism=organism, sequence=sequence) | def cli(ctx, feature_id, status, organism="", sequence="") | Set a feature's description
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.77374 | 5.04529 | 0.549768 |
synonyms = [
["host", "cytomine_host"],
["public_key", "publicKey", "cytomine_public_key"],
["private_key", "privateKey", "cytomine_private_key"],
["base_path", "basePath", "cytomine_base_path"],
["id_software", "cytomine_software_id", "cytomine_id_software", "idSoftware... | def _cytomine_parameter_name_synonyms(name, prefix="--") | For a given parameter name, returns all the possible usual synonym (and the parameter itself). Optionally, the
function can prepend a string to the found names.
If a parameters has no known synonyms, the function returns only the prefixed $name.
Parameters
----------
name: str
Parameter ba... | 2.217123 | 2.298887 | 0.964433 |
return cls(host, public_key, private_key, verbose, use_cache) | def connect(cls, host, public_key, private_key, verbose=0, use_cache=True) | Connect the client with the given host and the provided credentials.
Parameters
----------
host : str
The Cytomine host (without protocol).
public_key : str
The Cytomine public key.
private_key : str
The Cytomine private key.
verbose :... | 2.517056 | 5.408763 | 0.465366 |
argparse = cls._add_cytomine_cli_args(ArgumentParser())
params, _ = argparse.parse_known_args(args=argv)
log_level = params.verbose
if params.log_level is not None:
log_level = logging.getLevelName(params.log_level)
return cls.connect(params.host, params.publ... | def connect_from_cli(cls, argv, use_cache=True) | Connect with data taken from a command line interface.
Parameters
----------
argv: list
Command line parameters (executable name excluded)
use_cache : bool
True to use HTTP cache, False otherwise.
Returns
-------
client : Cytomine
... | 3.384913 | 3.234195 | 1.046601 |
argparse.add_argument(*_cytomine_parameter_name_synonyms("host"),
dest="host", help="The Cytomine host (without protocol).", required=True)
argparse.add_argument(*_cytomine_parameter_name_synonyms("public_key"),
dest="public_key", help... | def _add_cytomine_cli_args(argparse) | Add cytomine CLI args to the ArgumentParser object: cytomine_host, cytomine_public_key, cytomine_private_key and
cytomine_verbose.
Parameters
----------
argparse: ArgumentParser
The argument parser
Return
------
argparse: ArgumentParser
T... | 2.212832 | 2.268366 | 0.975518 |
protocol = "http" # default protocol
if host.startswith("http://"):
protocol = "http"
elif host.startswith("https://"):
protocol = "https"
elif provided_protocol is not None:
provided_protocol = provided_protocol.replace("://", "")
... | def _parse_url(host, provided_protocol=None) | Process the provided host and protocol to return them in a standardized
way that can be subsequently used by Cytomine methods.
If the protocol is not specified, HTTP is the default.
Only HTTP and HTTPS schemes are supported.
Parameters
----------
host: str
Th... | 2.262681 | 2.712975 | 0.834022 |
if not protocol:
protocol = self._protocol
ims_host, protocol = self._parse_url(ims_host, protocol)
ims_host = "{}://{}".format(protocol, ims_host)
query_parameters = {
"annotation" : id_annot,
"storage": id_storage,
... | def upload_crop(self, ims_host, filename, id_annot, id_storage,
id_project=None, sync=False, protocol=None) | Upload the crop associated with an annotation as a new image.
Parameters
----------
ims_host: str
Cytomine IMS host, with or without the protocol
filename: str
Filename to give to the newly created image
id_annot: int
Identifier of the annotat... | 3.242271 | 3.034683 | 1.068405 |
if max:
self.max = max
n_pages = 0
while not self._total_pages or n_pages < self._total_pages:
self.fetch_next_page(True)
n_pages += 1
return self
else:
return self._fetch() | def fetch(self, max=None) | Fetch all collection by pages of `max` items.
Parameters
----------
max : int, None (optional)
The number of item per page. If None, retrieve all collection.
Returns
-------
self Collection, the fetched collection | 4.274355 | 4.921505 | 0.868506 |
return ctx.gi.users.update_user(email, first_name, last_name, password, metadata=metadata) | def cli(ctx, email, first_name, last_name, password, metadata={}) | Update an existing user
Output:
a dictionary containing user information | 2.754677 | 3.814524 | 0.722155 |
return ctx.gi.users.get_users(omit_empty_organisms=omit_empty_organisms) | def cli(ctx, omit_empty_organisms=False) | Get all users known to this Apollo instance
Output:
list of user info dictionaries | 4.518726 | 4.382428 | 1.031101 |
return ctx.gi.organisms.update_organism(organism_id, common_name, directory, blatdb=blatdb, species=species, genus=genus, public=public) | def cli(ctx, organism_id, common_name, directory, blatdb="", species="", genus="", public=False) | Update an organism
Output:
a dictionary with information about the new organism | 2.06418 | 2.396601 | 0.861295 |
return ctx.gi.annotations.update_attribute(feature_id, attribute_key, old_value, new_value, organism=organism, sequence=sequence) | def cli(ctx, feature_id, attribute_key, old_value, new_value, organism="", sequence="") | Delete an attribute from a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.030635 | 3.074807 | 0.660411 |
data = {
'comment': comment,
'metadata': metadata
}
return self.post('createComment', data) | def add_comment(self, comment, metadata="") | Add a canned comment
:type comment: str
:param comment: New canned comment
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: A dictionnary containing canned comment description | 4.61647 | 8.147313 | 0.566625 |
comments = self.get_comments()
comments = [x for x in comments if x['comment'] == value]
if len(comments) == 0:
raise Exception("Unknown comment")
else:
return comments[0] | def show_comment(self, value) | Get a specific canned comment
:type value: str
:param value: Canned comment to show
:rtype: dict
:return: A dictionnary containing canned comment description | 3.047099 | 3.456729 | 0.881498 |
data = {
'id': id_number,
'new_comment': new_value
}
if metadata is not None:
data['metadata'] = metadata
return self.post('updateComment', data) | def update_comment(self, id_number, new_value, metadata=None) | Update a canned comment
:type id_number: int
:param id_number: canned comment ID number
:type new_value: str
:param new_value: New canned comment value
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: an empty dictionary | 2.727696 | 3.754119 | 0.726588 |
return ctx.gi.cannedvalues.add_value(value, metadata=metadata) | def cli(ctx, value, metadata="") | Add a canned value
Output:
A dictionnary containing canned value description | 12.054338 | 8.445825 | 1.427254 |
return ctx.gi.annotations.add_comment(feature_id, comments=comments, organism=organism, sequence=sequence) | def cli(ctx, feature_id, comments=None, organism="", sequence="") | Set a feature's description
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.837077 | 4.462868 | 0.635707 |
return ctx.gi.users.create_user(email, first_name, last_name, password, role=role, metadata=metadata) | def cli(ctx, email, first_name, last_name, password, role="user", metadata={}) | Create a new user
Output:
an empty dictionary | 2.285421 | 3.310091 | 0.690441 |
return ctx.gi.groups.update_organism_permissions(group, organism_name, administrate=administrate, write=write, read=read, export=export) | def cli(ctx, group, organism_name, administrate=False, write=False, read=False, export=False) | Update the group's permissions on an organism
Output:
list of group organism permissions | 2.507392 | 2.529156 | 0.991395 |
return ctx.gi.annotations.delete_feature(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Delete a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.145314 | 4.369463 | 0.71984 |
return ctx.gi.annotations.get_gff3(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Get the GFF3 associated with a feature
Output:
GFF3 text content | 3.845779 | 4.588345 | 0.838163 |
return ctx.gi.users.add_to_group(group, user) | def cli(ctx, group, user) | Add a user to a group
Output:
an empty dictionary | 4.595094 | 8.198166 | 0.560503 |
set_logging_level(log_level)
# We abuse this, knowing that calls to one will fail.
try:
ctx.gi = get_apollo_instance(apollo_instance)
except TypeError:
pass
# ctx.log("Could not access Galaxy instance configuration")
ctx.verbose = verbose | def arrow(ctx, apollo_instance, verbose, log_level) | Command line wrappers around Apollo functions. While this sounds
unexciting, with arrow and jq you can easily build powerful command line
scripts. | 11.886242 | 13.990389 | 0.849601 |
if data is None:
return ""
if data == "-":
return json.load(sys.stdin)
elif os.path.exists(data):
with open(data, 'r') as handle:
return json.load(handle)
else:
return json.loads(data) | def json_loads(data) | Load json data, allowing - to represent stdin. | 2.723111 | 2.248309 | 1.211182 |
days = options.get('days')
queryset = TimelineLog.objects.order_by('-timestamp')
if days:
try:
start = timezone.now() - timedelta(days=days)
except TypeError:
raise CommandError("Incorrect 'days' parameter. 'days' must be a number ... | def get_queryset(self, **options) | Filters the list of log objects to display | 3.5801 | 3.295377 | 1.0864 |
if options['recipients_from_setting']:
return settings.TIMELINE_DIGEST_EMAIL_RECIPIENTS
users = get_user_model()._default_manager.all()
if options['staff']:
users = users.filter(is_staff=True)
elif not options['all']:
users = users.filter(is_... | def get_recipients(self, **options) | Figures out the recipients | 3.493244 | 3.418215 | 1.02195 |
if export_format.lower() not in ('gzip', 'text'):
raise Exception("export_format must be one of file, text")
if export_type.lower() not in ('fasta', 'gff3', 'vcf'):
raise Exception("export_type must be one of FASTA, GFF3, VCF")
data = {
'type': exp... | def write_downloadable(self, organism, export_type='FASTA',
seq_type='peptide', export_format='text',
export_gff3_fasta=False, sequences=[], region=None) | Prepare a download for an organism
:type organism: str
:param organism: organism common name
:type sequences: str
:param sequences: Names of references sequences to add (default is all)
:type export_type: str
:param export_type: Export type. Choices: FASTA, GFF3, VCF
... | 2.676626 | 2.521934 | 1.061339 |
return self.write_downloadable(organism, export_type, seq_type,
export_format, export_gff3_fasta,
sequences, region) | def write_text(self, organism, export_type='FASTA', seq_type='peptide',
export_format='text', export_gff3_fasta=False,
sequences=[], region=None) | [DEPRECATED, use write_downloadable] Download or prepare a download for an organism
:type organism: str
:param organism: organism common name
:type sequences: str
:param sequences: Names of references sequences to add (default is all)
:type export_type: str
:param expo... | 2.550321 | 2.650143 | 0.962333 |
if output_format.lower() not in ('gzip', 'text'):
raise Exception("output_format must be one of file, text")
data = {
'format': output_format,
'uuid': uuid,
}
return self.get('download', get_params=data, is_json=False) | def download(self, uuid, output_format='gzip') | Download pre-prepared data by UUID
:type uuid: str
:param uuid: Data UUID
:type output_format: str
:param output_format: Output format of the data, either "gzip" or "text"
:rtype: str
:return: The downloaded content | 4.208379 | 4.498996 | 0.935404 |
return ctx.gi.annotations.get_sequence_alterations(organism=organism, sequence=sequence) | def cli(ctx, organism="", sequence="") | [UNTESTED] Get all of the sequence's alterations
Output:
A list of sequence alterations(?) | 6.210763 | 4.998138 | 1.242615 |
results = list()
for action in actions:
if action in self.aliased_actions:
results.append(action)
for item in self.expand_actions(self.aliased_actions[action]):
results.append(item)
else:
results.append... | def expand_actions(self, actions) | Accepts an array of actions and returns an array of actions which match.
This should be called before "matches?" and other checking methods since they
rely on the actions to be expanded. | 2.804963 | 2.65134 | 1.057942 |
# Check software parameters
argparse = ArgumentParser()
boolean_defaults = {}
for parameter in parameters:
arg_desc = {"dest": parameter.name, "required": parameter.required, "help": ""} # TODO add help
if parameter.type == "Boolean":
default = _to_bool(parameter.defaul... | def _software_params_to_argparse(parameters) | Converts a SoftwareParameterCollection into an ArgumentParser object.
Parameters
----------
parameters: SoftwareParameterCollection
The software parameters
Returns
-------
argparse: ArgumentParser
An initialized argument parser | 3.142918 | 3.207204 | 0.979956 |
run_by_ui = False
if not self.current_user.algo:
# If user connects as a human (CLI execution)
self._job = Job(self._project.id, self._software.id).save()
user_job = User().fetch(self._job.userJob)
self.set_credentials(user_job.publicKey, user_jo... | def start(self) | Connect to the Cytomine server and switch to job connection
Incurs dataflows | 4.923203 | 4.17273 | 1.179852 |
if value is None:
status = Job.TERMINATED
status_comment = "Job successfully terminated"
else:
status = Job.FAILED
status_comment = str(value)[:255]
self._job.status = status
self._job.statusComment = status_comment
self.... | def close(self, value) | Notify the Cytomine server of the job's end
Incurs a dataflows | 4.394243 | 3.691005 | 1.190527 |
parser = argparse.ArgumentParser(description="Generate Python classes from an Ecore model.")
parser.add_argument(
'--ecore-model',
'-e',
help="Path to Ecore XMI file.",
required=True
)
parser.add_argument(
'--out-folder',
'-o',
help="Path to d... | def generate_from_cli(args) | CLI entry point. | 2.942944 | 2.88561 | 1.019869 |
if URL_PATTERN.match(ecore_model_path):
return pyecore.resources.resource.HttpURI
return pyecore.resources.URI | def select_uri_implementation(ecore_model_path) | Select the right URI implementation regarding the Ecore model path schema. | 8.107164 | 7.181064 | 1.128964 |
rset = pyecore.resources.ResourceSet()
uri_implementation = select_uri_implementation(ecore_model_path)
resource = rset.get_resource(uri_implementation(ecore_model_path))
return resource.contents[0] | def load_model(ecore_model_path) | Load a single Ecore model and return the root package. | 4.524359 | 4.19224 | 1.079222 |
return ctx.gi.annotations.set_boundaries(feature_id, start, end, organism=organism, sequence=sequence) | def cli(ctx, feature_id, start, end, organism="", sequence="") | Set the boundaries of a genomic feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.821504 | 4.022802 | 0.949961 |
return ctx.gi.annotations.flip_strand(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Flip the strand of a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 4.297407 | 4.559967 | 0.942421 |
return ctx.gi.groups.update_group_admin(group_id, users=users) | def cli(ctx, group_id, users=None) | Update the group's admins
Output:
dictionary of group information | 4.768712 | 6.448503 | 0.739507 |
return ctx.gi.groups.update_group(group_id, new_name) | def cli(ctx, group_id, new_name) | Update the name of a group
Output:
a dictionary containing group information | 3.509037 | 5.564537 | 0.630607 |
url = self._wa.apollo_url + self.CLIENT_BASE + client_method
if post_params is None:
post_params = {}
headers = {
'Content-Type': 'application/json'
}
data.update({
'username': self._wa.username,
'password': self._wa.pas... | def post(self, client_method, data, post_params=None, is_json=True) | Make a POST request | 2.94527 | 2.945625 | 0.99988 |
url = self._wa.apollo_url + self.CLIENT_BASE + client_method
headers = {}
response = requests.get(url, headers=headers,
verify=self.__verify, params=get_params,
**self._request_args)
if response.status_code == 200:... | def get(self, client_method, get_params, is_json=True) | Make a GET request | 4.412979 | 4.414397 | 0.999679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.