id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
18,300
tonycpsu/panwid
panwid/scroll.py
Scrollable._adjust_trim_top
def _adjust_trim_top(self, canv, size): """Adjust self._trim_top according to self._scroll_action""" action = self._scroll_action self._scroll_action = None maxcol, maxrow = size trim_top = self._trim_top canv_rows = canv.rows() if trim_top < 0: # Ne...
python
def _adjust_trim_top(self, canv, size): """Adjust self._trim_top according to self._scroll_action""" action = self._scroll_action self._scroll_action = None maxcol, maxrow = size trim_top = self._trim_top canv_rows = canv.rows() if trim_top < 0: # Ne...
[ "def", "_adjust_trim_top", "(", "self", ",", "canv", ",", "size", ")", ":", "action", "=", "self", ".", "_scroll_action", "self", ".", "_scroll_action", "=", "None", "maxcol", ",", "maxrow", "=", "size", "trim_top", "=", "self", ".", "_trim_top", "canv_row...
Adjust self._trim_top according to self._scroll_action
[ "Adjust", "self", ".", "_trim_top", "according", "to", "self", ".", "_scroll_action" ]
e83a1f612cf5c53de88a7180c1b84b3b7b85460a
https://github.com/tonycpsu/panwid/blob/e83a1f612cf5c53de88a7180c1b84b3b7b85460a/panwid/scroll.py#L177-L224
18,301
tonycpsu/panwid
panwid/scroll.py
Scrollable.rows_max
def rows_max(self, size=None, focus=False): """Return the number of rows for `size` If `size` is not given, the currently rendered number of rows is returned. """ if size is not None: ow = self._original_widget ow_size = self._get_original_widget_size(size) ...
python
def rows_max(self, size=None, focus=False): """Return the number of rows for `size` If `size` is not given, the currently rendered number of rows is returned. """ if size is not None: ow = self._original_widget ow_size = self._get_original_widget_size(size) ...
[ "def", "rows_max", "(", "self", ",", "size", "=", "None", ",", "focus", "=", "False", ")", ":", "if", "size", "is", "not", "None", ":", "ow", "=", "self", ".", "_original_widget", "ow_size", "=", "self", ".", "_get_original_widget_size", "(", "size", "...
Return the number of rows for `size` If `size` is not given, the currently rendered number of rows is returned.
[ "Return", "the", "number", "of", "rows", "for", "size" ]
e83a1f612cf5c53de88a7180c1b84b3b7b85460a
https://github.com/tonycpsu/panwid/blob/e83a1f612cf5c53de88a7180c1b84b3b7b85460a/panwid/scroll.py#L257-L272
18,302
tonycpsu/panwid
panwid/scroll.py
ScrollBar.scrolling_base_widget
def scrolling_base_widget(self): """Nearest `original_widget` that is compatible with the scrolling API""" def orig_iter(w): while hasattr(w, 'original_widget'): w = w.original_widget yield w yield w def is_scrolling_widget(w): ...
python
def scrolling_base_widget(self): """Nearest `original_widget` that is compatible with the scrolling API""" def orig_iter(w): while hasattr(w, 'original_widget'): w = w.original_widget yield w yield w def is_scrolling_widget(w): ...
[ "def", "scrolling_base_widget", "(", "self", ")", ":", "def", "orig_iter", "(", "w", ")", ":", "while", "hasattr", "(", "w", ",", "'original_widget'", ")", ":", "w", "=", "w", ".", "original_widget", "yield", "w", "yield", "w", "def", "is_scrolling_widget"...
Nearest `original_widget` that is compatible with the scrolling API
[ "Nearest", "original_widget", "that", "is", "compatible", "with", "the", "scrolling", "API" ]
e83a1f612cf5c53de88a7180c1b84b3b7b85460a
https://github.com/tonycpsu/panwid/blob/e83a1f612cf5c53de88a7180c1b84b3b7b85460a/panwid/scroll.py#L389-L403
18,303
kyuupichan/aiorpcX
aiorpcx/curio.py
ignore_after
def ignore_after(seconds, coro=None, *args, timeout_result=None): '''Execute the specified coroutine and return its result. Issue a cancellation request after seconds have elapsed. When a timeout occurs, no exception is raised. Instead, timeout_result is returned. If coro is None, the result is an ...
python
def ignore_after(seconds, coro=None, *args, timeout_result=None): '''Execute the specified coroutine and return its result. Issue a cancellation request after seconds have elapsed. When a timeout occurs, no exception is raised. Instead, timeout_result is returned. If coro is None, the result is an ...
[ "def", "ignore_after", "(", "seconds", ",", "coro", "=", "None", ",", "*", "args", ",", "timeout_result", "=", "None", ")", ":", "if", "coro", ":", "return", "_ignore_after_func", "(", "seconds", ",", "False", ",", "coro", ",", "args", ",", "timeout_resu...
Execute the specified coroutine and return its result. Issue a cancellation request after seconds have elapsed. When a timeout occurs, no exception is raised. Instead, timeout_result is returned. If coro is None, the result is an asynchronous context manager that applies a timeout to a block of sta...
[ "Execute", "the", "specified", "coroutine", "and", "return", "its", "result", ".", "Issue", "a", "cancellation", "request", "after", "seconds", "have", "elapsed", ".", "When", "a", "timeout", "occurs", "no", "exception", "is", "raised", ".", "Instead", "timeou...
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/curio.py#L392-L411
18,304
kyuupichan/aiorpcX
aiorpcx/curio.py
TaskGroup._add_task
def _add_task(self, task): '''Add an already existing task to the task group.''' if hasattr(task, '_task_group'): raise RuntimeError('task is already part of a group') if self._closed: raise RuntimeError('task group is closed') task._task_group = self if t...
python
def _add_task(self, task): '''Add an already existing task to the task group.''' if hasattr(task, '_task_group'): raise RuntimeError('task is already part of a group') if self._closed: raise RuntimeError('task group is closed') task._task_group = self if t...
[ "def", "_add_task", "(", "self", ",", "task", ")", ":", "if", "hasattr", "(", "task", ",", "'_task_group'", ")", ":", "raise", "RuntimeError", "(", "'task is already part of a group'", ")", "if", "self", ".", "_closed", ":", "raise", "RuntimeError", "(", "'t...
Add an already existing task to the task group.
[ "Add", "an", "already", "existing", "task", "to", "the", "task", "group", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/curio.py#L118-L129
18,305
kyuupichan/aiorpcX
aiorpcx/curio.py
TaskGroup.next_done
async def next_done(self): '''Returns the next completed task. Returns None if no more tasks remain. A TaskGroup may also be used as an asynchronous iterator. ''' if not self._done and self._pending: self._done_event.clear() await self._done_event.wait() ...
python
async def next_done(self): '''Returns the next completed task. Returns None if no more tasks remain. A TaskGroup may also be used as an asynchronous iterator. ''' if not self._done and self._pending: self._done_event.clear() await self._done_event.wait() ...
[ "async", "def", "next_done", "(", "self", ")", ":", "if", "not", "self", ".", "_done", "and", "self", ".", "_pending", ":", "self", ".", "_done_event", ".", "clear", "(", ")", "await", "self", ".", "_done_event", ".", "wait", "(", ")", "if", "self", ...
Returns the next completed task. Returns None if no more tasks remain. A TaskGroup may also be used as an asynchronous iterator.
[ "Returns", "the", "next", "completed", "task", ".", "Returns", "None", "if", "no", "more", "tasks", "remain", ".", "A", "TaskGroup", "may", "also", "be", "used", "as", "an", "asynchronous", "iterator", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/curio.py#L155-L164
18,306
kyuupichan/aiorpcX
aiorpcx/curio.py
TaskGroup.join
async def join(self): '''Wait for tasks in the group to terminate according to the wait policy for the group. If the join() operation itself is cancelled, all remaining tasks in the group are also cancelled. If a TaskGroup is used as a context manager, the join() method ...
python
async def join(self): '''Wait for tasks in the group to terminate according to the wait policy for the group. If the join() operation itself is cancelled, all remaining tasks in the group are also cancelled. If a TaskGroup is used as a context manager, the join() method ...
[ "async", "def", "join", "(", "self", ")", ":", "def", "errored", "(", "task", ")", ":", "return", "not", "task", ".", "cancelled", "(", ")", "and", "task", ".", "exception", "(", ")", "try", ":", "if", "self", ".", "_wait", "in", "(", "all", ",",...
Wait for tasks in the group to terminate according to the wait policy for the group. If the join() operation itself is cancelled, all remaining tasks in the group are also cancelled. If a TaskGroup is used as a context manager, the join() method is called on context-exit. ...
[ "Wait", "for", "tasks", "in", "the", "group", "to", "terminate", "according", "to", "the", "wait", "policy", "for", "the", "group", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/curio.py#L176-L211
18,307
kyuupichan/aiorpcX
aiorpcx/curio.py
TaskGroup.cancel_remaining
async def cancel_remaining(self): '''Cancel all remaining tasks.''' self._closed = True task_list = list(self._pending) for task in task_list: task.cancel() for task in task_list: with suppress(CancelledError): await task
python
async def cancel_remaining(self): '''Cancel all remaining tasks.''' self._closed = True task_list = list(self._pending) for task in task_list: task.cancel() for task in task_list: with suppress(CancelledError): await task
[ "async", "def", "cancel_remaining", "(", "self", ")", ":", "self", ".", "_closed", "=", "True", "task_list", "=", "list", "(", "self", ".", "_pending", ")", "for", "task", "in", "task_list", ":", "task", ".", "cancel", "(", ")", "for", "task", "in", ...
Cancel all remaining tasks.
[ "Cancel", "all", "remaining", "tasks", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/curio.py#L213-L221
18,308
kyuupichan/aiorpcX
aiorpcx/socks.py
SOCKSProxy._connect_one
async def _connect_one(self, remote_address): '''Connect to the proxy and perform a handshake requesting a connection. Return the open socket on success, or the exception on failure. ''' loop = asyncio.get_event_loop() for info in await loop.getaddrinfo(str(self.address.host), ...
python
async def _connect_one(self, remote_address): '''Connect to the proxy and perform a handshake requesting a connection. Return the open socket on success, or the exception on failure. ''' loop = asyncio.get_event_loop() for info in await loop.getaddrinfo(str(self.address.host), ...
[ "async", "def", "_connect_one", "(", "self", ",", "remote_address", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "for", "info", "in", "await", "loop", ".", "getaddrinfo", "(", "str", "(", "self", ".", "address", ".", "host", ")", ...
Connect to the proxy and perform a handshake requesting a connection. Return the open socket on success, or the exception on failure.
[ "Connect", "to", "the", "proxy", "and", "perform", "a", "handshake", "requesting", "a", "connection", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/socks.py#L300-L323
18,309
kyuupichan/aiorpcX
aiorpcx/socks.py
SOCKSProxy._connect
async def _connect(self, remote_addresses): '''Connect to the proxy and perform a handshake requesting a connection to each address in addresses. Return an (open_socket, remote_address) pair on success. ''' assert remote_addresses exceptions = [] for remote_addr...
python
async def _connect(self, remote_addresses): '''Connect to the proxy and perform a handshake requesting a connection to each address in addresses. Return an (open_socket, remote_address) pair on success. ''' assert remote_addresses exceptions = [] for remote_addr...
[ "async", "def", "_connect", "(", "self", ",", "remote_addresses", ")", ":", "assert", "remote_addresses", "exceptions", "=", "[", "]", "for", "remote_address", "in", "remote_addresses", ":", "sock", "=", "await", "self", ".", "_connect_one", "(", "remote_address...
Connect to the proxy and perform a handshake requesting a connection to each address in addresses. Return an (open_socket, remote_address) pair on success.
[ "Connect", "to", "the", "proxy", "and", "perform", "a", "handshake", "requesting", "a", "connection", "to", "each", "address", "in", "addresses", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/socks.py#L325-L342
18,310
kyuupichan/aiorpcX
aiorpcx/socks.py
SOCKSProxy._detect_proxy
async def _detect_proxy(self): '''Return True if it appears we can connect to a SOCKS proxy, otherwise False. ''' if self.protocol is SOCKS4a: remote_address = NetAddress('www.apple.com', 80) else: remote_address = NetAddress('8.8.8.8', 53) sock =...
python
async def _detect_proxy(self): '''Return True if it appears we can connect to a SOCKS proxy, otherwise False. ''' if self.protocol is SOCKS4a: remote_address = NetAddress('www.apple.com', 80) else: remote_address = NetAddress('8.8.8.8', 53) sock =...
[ "async", "def", "_detect_proxy", "(", "self", ")", ":", "if", "self", ".", "protocol", "is", "SOCKS4a", ":", "remote_address", "=", "NetAddress", "(", "'www.apple.com'", ",", "80", ")", "else", ":", "remote_address", "=", "NetAddress", "(", "'8.8.8.8'", ",",...
Return True if it appears we can connect to a SOCKS proxy, otherwise False.
[ "Return", "True", "if", "it", "appears", "we", "can", "connect", "to", "a", "SOCKS", "proxy", "otherwise", "False", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/socks.py#L344-L360
18,311
kyuupichan/aiorpcX
aiorpcx/socks.py
SOCKSProxy.auto_detect_at_host
async def auto_detect_at_host(cls, host, ports, auth): '''Try to detect a SOCKS proxy on a host on one of the ports. Calls auto_detect_address for the ports in order. Returning a SOCKSProxy does not mean it is functioning - for example, it may have no network connectivity. If no proxy...
python
async def auto_detect_at_host(cls, host, ports, auth): '''Try to detect a SOCKS proxy on a host on one of the ports. Calls auto_detect_address for the ports in order. Returning a SOCKSProxy does not mean it is functioning - for example, it may have no network connectivity. If no proxy...
[ "async", "def", "auto_detect_at_host", "(", "cls", ",", "host", ",", "ports", ",", "auth", ")", ":", "for", "port", "in", "ports", ":", "proxy", "=", "await", "cls", ".", "auto_detect_at_address", "(", "NetAddress", "(", "host", ",", "port", ")", ",", ...
Try to detect a SOCKS proxy on a host on one of the ports. Calls auto_detect_address for the ports in order. Returning a SOCKSProxy does not mean it is functioning - for example, it may have no network connectivity. If no proxy is detected return None.
[ "Try", "to", "detect", "a", "SOCKS", "proxy", "on", "a", "host", "on", "one", "of", "the", "ports", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/socks.py#L380-L393
18,312
kyuupichan/aiorpcX
aiorpcx/session.py
Connector.create_connection
async def create_connection(self): '''Initiate a connection.''' connector = self.proxy or self.loop return await connector.create_connection( self.session_factory, self.host, self.port, **self.kwargs)
python
async def create_connection(self): '''Initiate a connection.''' connector = self.proxy or self.loop return await connector.create_connection( self.session_factory, self.host, self.port, **self.kwargs)
[ "async", "def", "create_connection", "(", "self", ")", ":", "connector", "=", "self", ".", "proxy", "or", "self", ".", "loop", "return", "await", "connector", ".", "create_connection", "(", "self", ".", "session_factory", ",", "self", ".", "host", ",", "se...
Initiate a connection.
[ "Initiate", "a", "connection", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L73-L77
18,313
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.data_received
def data_received(self, framed_message): '''Called by asyncio when a message comes in.''' if self.verbosity >= 4: self.logger.debug(f'Received framed message {framed_message}') self.recv_size += len(framed_message) self.bump_cost(len(framed_message) * self.bw_cost_per_byte) ...
python
def data_received(self, framed_message): '''Called by asyncio when a message comes in.''' if self.verbosity >= 4: self.logger.debug(f'Received framed message {framed_message}') self.recv_size += len(framed_message) self.bump_cost(len(framed_message) * self.bw_cost_per_byte) ...
[ "def", "data_received", "(", "self", ",", "framed_message", ")", ":", "if", "self", ".", "verbosity", ">=", "4", ":", "self", ".", "logger", ".", "debug", "(", "f'Received framed message {framed_message}'", ")", "self", ".", "recv_size", "+=", "len", "(", "f...
Called by asyncio when a message comes in.
[ "Called", "by", "asyncio", "when", "a", "message", "comes", "in", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L224-L230
18,314
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.pause_writing
def pause_writing(self): '''Transport calls when the send buffer is full.''' if not self.is_closing(): self._can_send.clear() self.transport.pause_reading()
python
def pause_writing(self): '''Transport calls when the send buffer is full.''' if not self.is_closing(): self._can_send.clear() self.transport.pause_reading()
[ "def", "pause_writing", "(", "self", ")", ":", "if", "not", "self", ".", "is_closing", "(", ")", ":", "self", ".", "_can_send", ".", "clear", "(", ")", "self", ".", "transport", ".", "pause_reading", "(", ")" ]
Transport calls when the send buffer is full.
[ "Transport", "calls", "when", "the", "send", "buffer", "is", "full", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L232-L236
18,315
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.resume_writing
def resume_writing(self): '''Transport calls when the send buffer has room.''' if not self._can_send.is_set(): self._can_send.set() self.transport.resume_reading()
python
def resume_writing(self): '''Transport calls when the send buffer has room.''' if not self._can_send.is_set(): self._can_send.set() self.transport.resume_reading()
[ "def", "resume_writing", "(", "self", ")", ":", "if", "not", "self", ".", "_can_send", ".", "is_set", "(", ")", ":", "self", ".", "_can_send", ".", "set", "(", ")", "self", ".", "transport", ".", "resume_reading", "(", ")" ]
Transport calls when the send buffer has room.
[ "Transport", "calls", "when", "the", "send", "buffer", "has", "room", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L238-L242
18,316
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.connection_made
def connection_made(self, transport): '''Called by asyncio when a connection is established. Derived classes overriding this method must call this first.''' self.transport = transport # If the Socks proxy was used then _proxy and _remote_address are already set if self._proxy is...
python
def connection_made(self, transport): '''Called by asyncio when a connection is established. Derived classes overriding this method must call this first.''' self.transport = transport # If the Socks proxy was used then _proxy and _remote_address are already set if self._proxy is...
[ "def", "connection_made", "(", "self", ",", "transport", ")", ":", "self", ".", "transport", "=", "transport", "# If the Socks proxy was used then _proxy and _remote_address are already set", "if", "self", ".", "_proxy", "is", "None", ":", "# This would throw if called on a...
Called by asyncio when a connection is established. Derived classes overriding this method must call this first.
[ "Called", "by", "asyncio", "when", "a", "connection", "is", "established", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L244-L255
18,317
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.connection_lost
def connection_lost(self, exc): '''Called by asyncio when the connection closes. Tear down things done in connection_made.''' # Work around uvloop bug; see https://github.com/MagicStack/uvloop/issues/246 if self.transport: self.transport = None self.closed_event....
python
def connection_lost(self, exc): '''Called by asyncio when the connection closes. Tear down things done in connection_made.''' # Work around uvloop bug; see https://github.com/MagicStack/uvloop/issues/246 if self.transport: self.transport = None self.closed_event....
[ "def", "connection_lost", "(", "self", ",", "exc", ")", ":", "# Work around uvloop bug; see https://github.com/MagicStack/uvloop/issues/246", "if", "self", ".", "transport", ":", "self", ".", "transport", "=", "None", "self", ".", "closed_event", ".", "set", "(", ")...
Called by asyncio when the connection closes. Tear down things done in connection_made.
[ "Called", "by", "asyncio", "when", "the", "connection", "closes", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L257-L269
18,318
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.recalc_concurrency
def recalc_concurrency(self): '''Call to recalculate sleeps and concurrency for the session. Called automatically if cost has drifted significantly. Otherwise can be called at regular intervals if desired. ''' # Refund resource usage proportionally to elapsed time; the bump pas...
python
def recalc_concurrency(self): '''Call to recalculate sleeps and concurrency for the session. Called automatically if cost has drifted significantly. Otherwise can be called at regular intervals if desired. ''' # Refund resource usage proportionally to elapsed time; the bump pas...
[ "def", "recalc_concurrency", "(", "self", ")", ":", "# Refund resource usage proportionally to elapsed time; the bump passed is negative", "now", "=", "time", ".", "time", "(", ")", "self", ".", "cost", "=", "max", "(", "0", ",", "self", ".", "cost", "-", "(", "...
Call to recalculate sleeps and concurrency for the session. Called automatically if cost has drifted significantly. Otherwise can be called at regular intervals if desired.
[ "Call", "to", "recalculate", "sleeps", "and", "concurrency", "for", "the", "session", ".", "Called", "automatically", "if", "cost", "has", "drifted", "significantly", ".", "Otherwise", "can", "be", "called", "at", "regular", "intervals", "if", "desired", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L282-L305
18,319
kyuupichan/aiorpcX
aiorpcx/session.py
SessionBase.close
async def close(self, *, force_after=30): '''Close the connection and return when closed.''' if self.transport: self.transport.close() try: async with timeout_after(force_after): await self.closed_event.wait() except TaskTimeout: ...
python
async def close(self, *, force_after=30): '''Close the connection and return when closed.''' if self.transport: self.transport.close() try: async with timeout_after(force_after): await self.closed_event.wait() except TaskTimeout: ...
[ "async", "def", "close", "(", "self", ",", "*", ",", "force_after", "=", "30", ")", ":", "if", "self", ".", "transport", ":", "self", ".", "transport", ".", "close", "(", ")", "try", ":", "async", "with", "timeout_after", "(", "force_after", ")", ":"...
Close the connection and return when closed.
[ "Close", "the", "connection", "and", "return", "when", "closed", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L342-L351
18,320
kyuupichan/aiorpcX
aiorpcx/session.py
RPCSession.send_request
async def send_request(self, method, args=()): '''Send an RPC request over the network.''' message, event = self.connection.send_request(Request(method, args)) return await self._send_concurrent(message, event, 1)
python
async def send_request(self, method, args=()): '''Send an RPC request over the network.''' message, event = self.connection.send_request(Request(method, args)) return await self._send_concurrent(message, event, 1)
[ "async", "def", "send_request", "(", "self", ",", "method", ",", "args", "=", "(", ")", ")", ":", "message", ",", "event", "=", "self", ".", "connection", ".", "send_request", "(", "Request", "(", "method", ",", "args", ")", ")", "return", "await", "...
Send an RPC request over the network.
[ "Send", "an", "RPC", "request", "over", "the", "network", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L631-L634
18,321
kyuupichan/aiorpcX
aiorpcx/session.py
RPCSession.send_notification
async def send_notification(self, method, args=()): '''Send an RPC notification over the network.''' message = self.connection.send_notification(Notification(method, args)) await self._send_message(message)
python
async def send_notification(self, method, args=()): '''Send an RPC notification over the network.''' message = self.connection.send_notification(Notification(method, args)) await self._send_message(message)
[ "async", "def", "send_notification", "(", "self", ",", "method", ",", "args", "=", "(", ")", ")", ":", "message", "=", "self", ".", "connection", ".", "send_notification", "(", "Notification", "(", "method", ",", "args", ")", ")", "await", "self", ".", ...
Send an RPC notification over the network.
[ "Send", "an", "RPC", "notification", "over", "the", "network", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L636-L639
18,322
kyuupichan/aiorpcX
aiorpcx/session.py
Server.close
async def close(self): '''Close the listening socket. This does not close any ServerSession objects created to handle incoming connections. ''' if self.server: self.server.close() await self.server.wait_closed() self.server = None
python
async def close(self): '''Close the listening socket. This does not close any ServerSession objects created to handle incoming connections. ''' if self.server: self.server.close() await self.server.wait_closed() self.server = None
[ "async", "def", "close", "(", "self", ")", ":", "if", "self", ".", "server", ":", "self", ".", "server", ".", "close", "(", ")", "await", "self", ".", "server", ".", "wait_closed", "(", ")", "self", ".", "server", "=", "None" ]
Close the listening socket. This does not close any ServerSession objects created to handle incoming connections.
[ "Close", "the", "listening", "socket", ".", "This", "does", "not", "close", "any", "ServerSession", "objects", "created", "to", "handle", "incoming", "connections", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/session.py#L674-L681
18,323
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPC._message_to_payload
def _message_to_payload(cls, message): '''Returns a Python object or a ProtocolError.''' try: return json.loads(message.decode()) except UnicodeDecodeError: message = 'messages must be encoded in UTF-8' except json.JSONDecodeError: message = 'invalid J...
python
def _message_to_payload(cls, message): '''Returns a Python object or a ProtocolError.''' try: return json.loads(message.decode()) except UnicodeDecodeError: message = 'messages must be encoded in UTF-8' except json.JSONDecodeError: message = 'invalid J...
[ "def", "_message_to_payload", "(", "cls", ",", "message", ")", ":", "try", ":", "return", "json", ".", "loads", "(", "message", ".", "decode", "(", ")", ")", "except", "UnicodeDecodeError", ":", "message", "=", "'messages must be encoded in UTF-8'", "except", ...
Returns a Python object or a ProtocolError.
[ "Returns", "a", "Python", "object", "or", "a", "ProtocolError", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L223-L231
18,324
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPC.batch_message
def batch_message(cls, batch, request_ids): '''Convert a request Batch to a message.''' assert isinstance(batch, Batch) if not cls.allow_batches: raise ProtocolError.invalid_request( 'protocol does not permit batches') id_iter = iter(request_ids) rm = ...
python
def batch_message(cls, batch, request_ids): '''Convert a request Batch to a message.''' assert isinstance(batch, Batch) if not cls.allow_batches: raise ProtocolError.invalid_request( 'protocol does not permit batches') id_iter = iter(request_ids) rm = ...
[ "def", "batch_message", "(", "cls", ",", "batch", ",", "request_ids", ")", ":", "assert", "isinstance", "(", "batch", ",", "Batch", ")", "if", "not", "cls", ".", "allow_batches", ":", "raise", "ProtocolError", ".", "invalid_request", "(", "'protocol does not p...
Convert a request Batch to a message.
[ "Convert", "a", "request", "Batch", "to", "a", "message", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L305-L316
18,325
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPC.batch_message_from_parts
def batch_message_from_parts(cls, messages): '''Convert messages, one per batch item, into a batch message. At least one message must be passed. ''' # Comma-separate the messages and wrap the lot in square brackets middle = b', '.join(messages) if not middle: ...
python
def batch_message_from_parts(cls, messages): '''Convert messages, one per batch item, into a batch message. At least one message must be passed. ''' # Comma-separate the messages and wrap the lot in square brackets middle = b', '.join(messages) if not middle: ...
[ "def", "batch_message_from_parts", "(", "cls", ",", "messages", ")", ":", "# Comma-separate the messages and wrap the lot in square brackets", "middle", "=", "b', '", ".", "join", "(", "messages", ")", "if", "not", "middle", ":", "raise", "ProtocolError", ".", "empty_...
Convert messages, one per batch item, into a batch message. At least one message must be passed.
[ "Convert", "messages", "one", "per", "batch", "item", "into", "a", "batch", "message", ".", "At", "least", "one", "message", "must", "be", "passed", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L319-L327
18,326
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPC.encode_payload
def encode_payload(cls, payload): '''Encode a Python object as JSON and convert it to bytes.''' try: return json.dumps(payload).encode() except TypeError: msg = f'JSON payload encoding error: {payload}' raise ProtocolError(cls.INTERNAL_ERROR, msg) from None
python
def encode_payload(cls, payload): '''Encode a Python object as JSON and convert it to bytes.''' try: return json.dumps(payload).encode() except TypeError: msg = f'JSON payload encoding error: {payload}' raise ProtocolError(cls.INTERNAL_ERROR, msg) from None
[ "def", "encode_payload", "(", "cls", ",", "payload", ")", ":", "try", ":", "return", "json", ".", "dumps", "(", "payload", ")", ".", "encode", "(", ")", "except", "TypeError", ":", "msg", "=", "f'JSON payload encoding error: {payload}'", "raise", "ProtocolErro...
Encode a Python object as JSON and convert it to bytes.
[ "Encode", "a", "Python", "object", "as", "JSON", "and", "convert", "it", "to", "bytes", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L330-L336
18,327
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPCAutoDetect.detect_protocol
def detect_protocol(cls, message): '''Attempt to detect the protocol from the message.''' main = cls._message_to_payload(message) def protocol_for_payload(payload): if not isinstance(payload, dict): return JSONRPCLoose # Will error # Obey an explicit "j...
python
def detect_protocol(cls, message): '''Attempt to detect the protocol from the message.''' main = cls._message_to_payload(message) def protocol_for_payload(payload): if not isinstance(payload, dict): return JSONRPCLoose # Will error # Obey an explicit "j...
[ "def", "detect_protocol", "(", "cls", ",", "message", ")", ":", "main", "=", "cls", ".", "_message_to_payload", "(", "message", ")", "def", "protocol_for_payload", "(", "payload", ")", ":", "if", "not", "isinstance", "(", "payload", ",", "dict", ")", ":", ...
Attempt to detect the protocol from the message.
[ "Attempt", "to", "detect", "the", "protocol", "from", "the", "message", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L544-L576
18,328
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPCConnection.receive_message
def receive_message(self, message): '''Call with an unframed message received from the network. Raises: ProtocolError if the message violates the protocol in some way. However, if it happened in a response that can be paired with a request, the ProtocolError is instead set in the ...
python
def receive_message(self, message): '''Call with an unframed message received from the network. Raises: ProtocolError if the message violates the protocol in some way. However, if it happened in a response that can be paired with a request, the ProtocolError is instead set in the ...
[ "def", "receive_message", "(", "self", ",", "message", ")", ":", "if", "self", ".", "_protocol", "is", "JSONRPCAutoDetect", ":", "self", ".", "_protocol", "=", "JSONRPCAutoDetect", ".", "detect_protocol", "(", "message", ")", "try", ":", "item", ",", "reques...
Call with an unframed message received from the network. Raises: ProtocolError if the message violates the protocol in some way. However, if it happened in a response that can be paired with a request, the ProtocolError is instead set in the result attribute of the send_request() that ...
[ "Call", "with", "an", "unframed", "message", "received", "from", "the", "network", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L706-L737
18,329
kyuupichan/aiorpcX
aiorpcx/jsonrpc.py
JSONRPCConnection.cancel_pending_requests
def cancel_pending_requests(self): '''Cancel all pending requests.''' exception = CancelledError() for _request, event in self._requests.values(): event.result = exception event.set() self._requests.clear()
python
def cancel_pending_requests(self): '''Cancel all pending requests.''' exception = CancelledError() for _request, event in self._requests.values(): event.result = exception event.set() self._requests.clear()
[ "def", "cancel_pending_requests", "(", "self", ")", ":", "exception", "=", "CancelledError", "(", ")", "for", "_request", ",", "event", "in", "self", ".", "_requests", ".", "values", "(", ")", ":", "event", ".", "result", "=", "exception", "event", ".", ...
Cancel all pending requests.
[ "Cancel", "all", "pending", "requests", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/jsonrpc.py#L739-L745
18,330
kyuupichan/aiorpcX
aiorpcx/util.py
is_valid_hostname
def is_valid_hostname(hostname): '''Return True if hostname is valid, otherwise False.''' if not isinstance(hostname, str): raise TypeError('hostname must be a string') # strip exactly one dot from the right, if present if hostname and hostname[-1] == ".": hostname = hostname[:-1] if...
python
def is_valid_hostname(hostname): '''Return True if hostname is valid, otherwise False.''' if not isinstance(hostname, str): raise TypeError('hostname must be a string') # strip exactly one dot from the right, if present if hostname and hostname[-1] == ".": hostname = hostname[:-1] if...
[ "def", "is_valid_hostname", "(", "hostname", ")", ":", "if", "not", "isinstance", "(", "hostname", ",", "str", ")", ":", "raise", "TypeError", "(", "'hostname must be a string'", ")", "# strip exactly one dot from the right, if present", "if", "hostname", "and", "host...
Return True if hostname is valid, otherwise False.
[ "Return", "True", "if", "hostname", "is", "valid", "otherwise", "False", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L47-L60
18,331
kyuupichan/aiorpcX
aiorpcx/util.py
classify_host
def classify_host(host): '''Host is an IPv4Address, IPv6Address or a string. If an IPv4Address or IPv6Address return it. Otherwise convert the string to an IPv4Address or IPv6Address object if possible and return it. Otherwise return the original string if it is a valid hostname. Raise ValueErro...
python
def classify_host(host): '''Host is an IPv4Address, IPv6Address or a string. If an IPv4Address or IPv6Address return it. Otherwise convert the string to an IPv4Address or IPv6Address object if possible and return it. Otherwise return the original string if it is a valid hostname. Raise ValueErro...
[ "def", "classify_host", "(", "host", ")", ":", "if", "isinstance", "(", "host", ",", "(", "IPv4Address", ",", "IPv6Address", ")", ")", ":", "return", "host", "if", "is_valid_hostname", "(", "host", ")", ":", "return", "host", "return", "ip_address", "(", ...
Host is an IPv4Address, IPv6Address or a string. If an IPv4Address or IPv6Address return it. Otherwise convert the string to an IPv4Address or IPv6Address object if possible and return it. Otherwise return the original string if it is a valid hostname. Raise ValueError if a string cannot be interpre...
[ "Host", "is", "an", "IPv4Address", "IPv6Address", "or", "a", "string", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L63-L77
18,332
kyuupichan/aiorpcX
aiorpcx/util.py
validate_port
def validate_port(port): '''Validate port and return it as an integer. A string, or its representation as an integer, is accepted.''' if not isinstance(port, (str, int)): raise TypeError(f'port must be an integer or string: {port}') if isinstance(port, str) and port.isdigit(): port = in...
python
def validate_port(port): '''Validate port and return it as an integer. A string, or its representation as an integer, is accepted.''' if not isinstance(port, (str, int)): raise TypeError(f'port must be an integer or string: {port}') if isinstance(port, str) and port.isdigit(): port = in...
[ "def", "validate_port", "(", "port", ")", ":", "if", "not", "isinstance", "(", "port", ",", "(", "str", ",", "int", ")", ")", ":", "raise", "TypeError", "(", "f'port must be an integer or string: {port}'", ")", "if", "isinstance", "(", "port", ",", "str", ...
Validate port and return it as an integer. A string, or its representation as an integer, is accepted.
[ "Validate", "port", "and", "return", "it", "as", "an", "integer", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L80-L90
18,333
kyuupichan/aiorpcX
aiorpcx/util.py
validate_protocol
def validate_protocol(protocol): '''Validate a protocol, a string, and return it.''' if not re.match(PROTOCOL_REGEX, protocol): raise ValueError(f'invalid protocol: {protocol}') return protocol.lower()
python
def validate_protocol(protocol): '''Validate a protocol, a string, and return it.''' if not re.match(PROTOCOL_REGEX, protocol): raise ValueError(f'invalid protocol: {protocol}') return protocol.lower()
[ "def", "validate_protocol", "(", "protocol", ")", ":", "if", "not", "re", ".", "match", "(", "PROTOCOL_REGEX", ",", "protocol", ")", ":", "raise", "ValueError", "(", "f'invalid protocol: {protocol}'", ")", "return", "protocol", ".", "lower", "(", ")" ]
Validate a protocol, a string, and return it.
[ "Validate", "a", "protocol", "a", "string", "and", "return", "it", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L93-L97
18,334
kyuupichan/aiorpcX
aiorpcx/util.py
is_async_call
def is_async_call(func): '''inspect.iscoroutinefunction that looks through partials.''' while isinstance(func, partial): func = func.func return inspect.iscoroutinefunction(func)
python
def is_async_call(func): '''inspect.iscoroutinefunction that looks through partials.''' while isinstance(func, partial): func = func.func return inspect.iscoroutinefunction(func)
[ "def", "is_async_call", "(", "func", ")", ":", "while", "isinstance", "(", "func", ",", "partial", ")", ":", "func", "=", "func", ".", "func", "return", "inspect", ".", "iscoroutinefunction", "(", "func", ")" ]
inspect.iscoroutinefunction that looks through partials.
[ "inspect", ".", "iscoroutinefunction", "that", "looks", "through", "partials", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L261-L265
18,335
kyuupichan/aiorpcX
aiorpcx/util.py
Service.from_string
def from_string(cls, string, *, default_func=None): '''Construct a Service from a string. If default_func is provided and any ServicePart is missing, it is called with default_func(protocol, part) to obtain the missing part. ''' if not isinstance(string, str): raise ...
python
def from_string(cls, string, *, default_func=None): '''Construct a Service from a string. If default_func is provided and any ServicePart is missing, it is called with default_func(protocol, part) to obtain the missing part. ''' if not isinstance(string, str): raise ...
[ "def", "from_string", "(", "cls", ",", "string", ",", "*", ",", "default_func", "=", "None", ")", ":", "if", "not", "isinstance", "(", "string", ",", "str", ")", ":", "raise", "TypeError", "(", "f'service must be a string: {string}'", ")", "parts", "=", "s...
Construct a Service from a string. If default_func is provided and any ServicePart is missing, it is called with default_func(protocol, part) to obtain the missing part.
[ "Construct", "a", "Service", "from", "a", "string", "." ]
707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L218-L244
18,336
monarch-initiative/dipper
dipper/sources/OMIA.py
OMIA.scrub
def scrub(self): """ The XML file seems to have mixed-encoding; we scrub out the control characters from the file for processing. i.e.?i omia.xml:1555328.28: PCDATA invalid Char value 2 <field name="journal">Bulletin et Memoires de la Societe Centrale de Medi...
python
def scrub(self): """ The XML file seems to have mixed-encoding; we scrub out the control characters from the file for processing. i.e.?i omia.xml:1555328.28: PCDATA invalid Char value 2 <field name="journal">Bulletin et Memoires de la Societe Centrale de Medi...
[ "def", "scrub", "(", "self", ")", ":", "LOG", ".", "info", "(", "\"Scrubbing out the nasty characters that break our parser.\"", ")", "myfile", "=", "'/'", ".", "join", "(", "(", "self", ".", "rawdir", ",", "self", ".", "files", "[", "'data'", "]", "[", "'...
The XML file seems to have mixed-encoding; we scrub out the control characters from the file for processing. i.e.?i omia.xml:1555328.28: PCDATA invalid Char value 2 <field name="journal">Bulletin et Memoires de la Societe Centrale de Medic :return:
[ "The", "XML", "file", "seems", "to", "have", "mixed", "-", "encoding", ";", "we", "scrub", "out", "the", "control", "characters", "from", "the", "file", "for", "processing", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/OMIA.py#L202-L234
18,337
monarch-initiative/dipper
dipper/sources/OMIA.py
OMIA.process_associations
def process_associations(self, limit): """ Loop through the xml file and process the article-breed, article-phene, breed-phene, phene-gene associations, and the external links to LIDA. :param limit: :return: """ myfile = '/'.join((self.rawdir, self.files['data'...
python
def process_associations(self, limit): """ Loop through the xml file and process the article-breed, article-phene, breed-phene, phene-gene associations, and the external links to LIDA. :param limit: :return: """ myfile = '/'.join((self.rawdir, self.files['data'...
[ "def", "process_associations", "(", "self", ",", "limit", ")", ":", "myfile", "=", "'/'", ".", "join", "(", "(", "self", ".", "rawdir", ",", "self", ".", "files", "[", "'data'", "]", "[", "'file'", "]", ")", ")", "f", "=", "gzip", ".", "open", "(...
Loop through the xml file and process the article-breed, article-phene, breed-phene, phene-gene associations, and the external links to LIDA. :param limit: :return:
[ "Loop", "through", "the", "xml", "file", "and", "process", "the", "article", "-", "breed", "article", "-", "phene", "breed", "-", "phene", "phene", "-", "gene", "associations", "and", "the", "external", "links", "to", "LIDA", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/OMIA.py#L362-L390
18,338
monarch-initiative/dipper
dipper/sources/OMIA.py
OMIA._process_article_phene_row
def _process_article_phene_row(self, row): """ Linking articles to species-specific phenes. :param row: :return: """ # article_id, phene_id, added_by # look up the article in the hashmap phenotype_id = self.id_hash['phene'].get(row['phene_id']) ar...
python
def _process_article_phene_row(self, row): """ Linking articles to species-specific phenes. :param row: :return: """ # article_id, phene_id, added_by # look up the article in the hashmap phenotype_id = self.id_hash['phene'].get(row['phene_id']) ar...
[ "def", "_process_article_phene_row", "(", "self", ",", "row", ")", ":", "# article_id, phene_id, added_by", "# look up the article in the hashmap", "phenotype_id", "=", "self", ".", "id_hash", "[", "'phene'", "]", ".", "get", "(", "row", "[", "'phene_id'", "]", ")",...
Linking articles to species-specific phenes. :param row: :return:
[ "Linking", "articles", "to", "species", "-", "specific", "phenes", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/OMIA.py#L645-L667
18,339
monarch-initiative/dipper
dipper/sources/OMIA.py
OMIA.filter_keep_phenotype_entry_ids
def filter_keep_phenotype_entry_ids(self, entry): ''' doubt this should be kept ''' omim_id = str(entry['mimNumber']) otype = self.globaltt['obsolete'] if omim_id in self.omim_type: otype = self.omim_type[omim_id] if otype == self.globaltt['obs...
python
def filter_keep_phenotype_entry_ids(self, entry): ''' doubt this should be kept ''' omim_id = str(entry['mimNumber']) otype = self.globaltt['obsolete'] if omim_id in self.omim_type: otype = self.omim_type[omim_id] if otype == self.globaltt['obs...
[ "def", "filter_keep_phenotype_entry_ids", "(", "self", ",", "entry", ")", ":", "omim_id", "=", "str", "(", "entry", "[", "'mimNumber'", "]", ")", "otype", "=", "self", ".", "globaltt", "[", "'obsolete'", "]", "if", "omim_id", "in", "self", ".", "omim_type"...
doubt this should be kept
[ "doubt", "this", "should", "be", "kept" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/OMIA.py#L825-L841
18,340
monarch-initiative/dipper
dipper/sources/ClinVarXML_alpha.py
make_spo
def make_spo(sub, prd, obj): ''' Decorates the three given strings as a line of ntriples ''' # To establish string as a curie and expand, # we use a global curie_map(.yaml) # sub are allways uri (unless a bnode) # prd are allways uri (unless prd is 'a') # should fail loudly if curie do...
python
def make_spo(sub, prd, obj): ''' Decorates the three given strings as a line of ntriples ''' # To establish string as a curie and expand, # we use a global curie_map(.yaml) # sub are allways uri (unless a bnode) # prd are allways uri (unless prd is 'a') # should fail loudly if curie do...
[ "def", "make_spo", "(", "sub", ",", "prd", ",", "obj", ")", ":", "# To establish string as a curie and expand,", "# we use a global curie_map(.yaml)", "# sub are allways uri (unless a bnode)", "# prd are allways uri (unless prd is 'a')", "# should fail loudly if curie does not exist", ...
Decorates the three given strings as a line of ntriples
[ "Decorates", "the", "three", "given", "strings", "as", "a", "line", "of", "ntriples" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ClinVarXML_alpha.py#L183-L244
18,341
monarch-initiative/dipper
dipper/sources/ClinVarXML_alpha.py
write_spo
def write_spo(sub, prd, obj): ''' write triples to a buffer incase we decide to drop them ''' rcvtriples.append(make_spo(sub, prd, obj))
python
def write_spo(sub, prd, obj): ''' write triples to a buffer incase we decide to drop them ''' rcvtriples.append(make_spo(sub, prd, obj))
[ "def", "write_spo", "(", "sub", ",", "prd", ",", "obj", ")", ":", "rcvtriples", ".", "append", "(", "make_spo", "(", "sub", ",", "prd", ",", "obj", ")", ")" ]
write triples to a buffer incase we decide to drop them
[ "write", "triples", "to", "a", "buffer", "incase", "we", "decide", "to", "drop", "them" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ClinVarXML_alpha.py#L247-L251
18,342
monarch-initiative/dipper
dipper/sources/Decipher.py
Decipher.make_allele_by_consequence
def make_allele_by_consequence(self, consequence, gene_id, gene_symbol): """ Given a "consequence" label that describes a variation type, create an anonymous variant of the specified gene as an instance of that consequence type. :param consequence: :param gene_id: ...
python
def make_allele_by_consequence(self, consequence, gene_id, gene_symbol): """ Given a "consequence" label that describes a variation type, create an anonymous variant of the specified gene as an instance of that consequence type. :param consequence: :param gene_id: ...
[ "def", "make_allele_by_consequence", "(", "self", ",", "consequence", ",", "gene_id", ",", "gene_symbol", ")", ":", "allele_id", "=", "None", "# Loss of function : Nonsense, frame-shifting indel,", "# essential splice site mutation, whole gene deletion or any other", "# mutatio...
Given a "consequence" label that describes a variation type, create an anonymous variant of the specified gene as an instance of that consequence type. :param consequence: :param gene_id: :param gene_symbol: :return: allele_id
[ "Given", "a", "consequence", "label", "that", "describes", "a", "variation", "type", "create", "an", "anonymous", "variant", "of", "the", "specified", "gene", "as", "an", "instance", "of", "that", "consequence", "type", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Decipher.py#L228-L277
18,343
monarch-initiative/dipper
dipper/sources/EBIGene2Phen.py
EBIGene2Phen.parse
def parse(self, limit: Optional[int]=None): """ Here we parse each row of the gene to phenotype file We create anonymous variants along with their attributes (allelic requirement, functional consequence) and connect these to genes and diseases genes are connected to var...
python
def parse(self, limit: Optional[int]=None): """ Here we parse each row of the gene to phenotype file We create anonymous variants along with their attributes (allelic requirement, functional consequence) and connect these to genes and diseases genes are connected to var...
[ "def", "parse", "(", "self", ",", "limit", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "if", "limit", "is", "not", "None", ":", "LOG", ".", "info", "(", "\"Only parsing first %d rows\"", ",", "limit", ")", "LOG", ".", "info", "(", "\"Par...
Here we parse each row of the gene to phenotype file We create anonymous variants along with their attributes (allelic requirement, functional consequence) and connect these to genes and diseases genes are connected to variants via global_terms['has_affected_locus'] va...
[ "Here", "we", "parse", "each", "row", "of", "the", "gene", "to", "phenotype", "file" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/EBIGene2Phen.py#L104-L147
18,344
monarch-initiative/dipper
dipper/sources/EBIGene2Phen.py
EBIGene2Phen._add_gene_disease
def _add_gene_disease(self, row): # ::List getting syntax error here """ Parse and add gene variant disease model Model building happens in _build_gene_disease_model :param row {List}: single row from DDG2P.csv :return: None """ col = self.files['developmental_...
python
def _add_gene_disease(self, row): # ::List getting syntax error here """ Parse and add gene variant disease model Model building happens in _build_gene_disease_model :param row {List}: single row from DDG2P.csv :return: None """ col = self.files['developmental_...
[ "def", "_add_gene_disease", "(", "self", ",", "row", ")", ":", "# ::List getting syntax error here", "col", "=", "self", ".", "files", "[", "'developmental_disorders'", "]", "[", "'columns'", "]", "if", "len", "(", "row", ")", "!=", "len", "(", "col", ")", ...
Parse and add gene variant disease model Model building happens in _build_gene_disease_model :param row {List}: single row from DDG2P.csv :return: None
[ "Parse", "and", "add", "gene", "variant", "disease", "model", "Model", "building", "happens", "in", "_build_gene_disease_model" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/EBIGene2Phen.py#L149-L211
18,345
monarch-initiative/dipper
dipper/sources/EBIGene2Phen.py
EBIGene2Phen._build_gene_disease_model
def _build_gene_disease_model( self, gene_id, relation_id, disease_id, variant_label, consequence_predicate=None, consequence_id=None, allelic_requirement=None, pmids=None): """ Builds gene varian...
python
def _build_gene_disease_model( self, gene_id, relation_id, disease_id, variant_label, consequence_predicate=None, consequence_id=None, allelic_requirement=None, pmids=None): """ Builds gene varian...
[ "def", "_build_gene_disease_model", "(", "self", ",", "gene_id", ",", "relation_id", ",", "disease_id", ",", "variant_label", ",", "consequence_predicate", "=", "None", ",", "consequence_id", "=", "None", ",", "allelic_requirement", "=", "None", ",", "pmids", "=",...
Builds gene variant disease model :return: None
[ "Builds", "gene", "variant", "disease", "model" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/EBIGene2Phen.py#L213-L274
18,346
monarch-initiative/dipper
dipper/sources/BioGrid.py
BioGrid._get_identifiers
def _get_identifiers(self, limit): """ This will process the id mapping file provided by Biogrid. The file has a very large header, which we scan past, then pull the identifiers, and make equivalence axioms :param limit: :return: """ LOG.info("getting i...
python
def _get_identifiers(self, limit): """ This will process the id mapping file provided by Biogrid. The file has a very large header, which we scan past, then pull the identifiers, and make equivalence axioms :param limit: :return: """ LOG.info("getting i...
[ "def", "_get_identifiers", "(", "self", ",", "limit", ")", ":", "LOG", ".", "info", "(", "\"getting identifier mapping\"", ")", "line_counter", "=", "0", "f", "=", "'/'", ".", "join", "(", "(", "self", ".", "rawdir", ",", "self", ".", "files", "[", "'i...
This will process the id mapping file provided by Biogrid. The file has a very large header, which we scan past, then pull the identifiers, and make equivalence axioms :param limit: :return:
[ "This", "will", "process", "the", "id", "mapping", "file", "provided", "by", "Biogrid", ".", "The", "file", "has", "a", "very", "large", "header", "which", "we", "scan", "past", "then", "pull", "the", "identifiers", "and", "make", "equivalence", "axioms" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/BioGrid.py#L201-L281
18,347
monarch-initiative/dipper
dipper/models/Evidence.py
Evidence.add_supporting_evidence
def add_supporting_evidence(self, evidence_line, evidence_type=None, label=None): """ Add supporting line of evidence node to association id :param evidence_line: curie or iri, evidence line :param evidence_type: curie or iri, evidence type if available :return: None """...
python
def add_supporting_evidence(self, evidence_line, evidence_type=None, label=None): """ Add supporting line of evidence node to association id :param evidence_line: curie or iri, evidence line :param evidence_type: curie or iri, evidence type if available :return: None """...
[ "def", "add_supporting_evidence", "(", "self", ",", "evidence_line", ",", "evidence_type", "=", "None", ",", "label", "=", "None", ")", ":", "self", ".", "graph", ".", "addTriple", "(", "self", ".", "association", ",", "self", ".", "globaltt", "[", "'has_s...
Add supporting line of evidence node to association id :param evidence_line: curie or iri, evidence line :param evidence_type: curie or iri, evidence type if available :return: None
[ "Add", "supporting", "line", "of", "evidence", "node", "to", "association", "id" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/Evidence.py#L34-L47
18,348
monarch-initiative/dipper
dipper/models/assoc/G2PAssoc.py
G2PAssoc.add_association_to_graph
def add_association_to_graph(self): """ Overrides Association by including bnode support The reified relationship between a genotype (or any genotype part) and a phenotype is decorated with some provenance information. This makes the assumption that both the genotype an...
python
def add_association_to_graph(self): """ Overrides Association by including bnode support The reified relationship between a genotype (or any genotype part) and a phenotype is decorated with some provenance information. This makes the assumption that both the genotype an...
[ "def", "add_association_to_graph", "(", "self", ")", ":", "Assoc", ".", "add_association_to_graph", "(", "self", ")", "# make a blank stage", "if", "self", ".", "start_stage_id", "or", "self", ".", "end_stage_id", "is", "not", "None", ":", "stage_process_id", "=",...
Overrides Association by including bnode support The reified relationship between a genotype (or any genotype part) and a phenotype is decorated with some provenance information. This makes the assumption that both the genotype and phenotype are classes. currently hardcoded to...
[ "Overrides", "Association", "by", "including", "bnode", "support" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/assoc/G2PAssoc.py#L66-L103
18,349
monarch-initiative/dipper
dipper/sources/MPD.py
MPD.parse
def parse(self, limit=None): """ MPD data is delivered in four separate csv files and one xml file, which we process iteratively and write out as one large graph. :param limit: :return: """ if limit is not None: LOG.info("Only parsing first %s...
python
def parse(self, limit=None): """ MPD data is delivered in four separate csv files and one xml file, which we process iteratively and write out as one large graph. :param limit: :return: """ if limit is not None: LOG.info("Only parsing first %s...
[ "def", "parse", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "not", "None", ":", "LOG", ".", "info", "(", "\"Only parsing first %s rows fo each file\"", ",", "str", "(", "limit", ")", ")", "LOG", ".", "info", "(", "\"Parsing fil...
MPD data is delivered in four separate csv files and one xml file, which we process iteratively and write out as one large graph. :param limit: :return:
[ "MPD", "data", "is", "delivered", "in", "four", "separate", "csv", "files", "and", "one", "xml", "file", "which", "we", "process", "iteratively", "and", "write", "out", "as", "one", "large", "graph", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MPD.py#L112-L142
18,350
monarch-initiative/dipper
dipper/sources/MPD.py
MPD._add_g2p_assoc
def _add_g2p_assoc(self, graph, strain_id, sex, assay_id, phenotypes, comment): """ Create an association between a sex-specific strain id and each of the phenotypes. Here, we create a genotype from the strain, and a sex-specific genotype. Each of those genotypes are crea...
python
def _add_g2p_assoc(self, graph, strain_id, sex, assay_id, phenotypes, comment): """ Create an association between a sex-specific strain id and each of the phenotypes. Here, we create a genotype from the strain, and a sex-specific genotype. Each of those genotypes are crea...
[ "def", "_add_g2p_assoc", "(", "self", ",", "graph", ",", "strain_id", ",", "sex", ",", "assay_id", ",", "phenotypes", ",", "comment", ")", ":", "geno", "=", "Genotype", "(", "graph", ")", "model", "=", "Model", "(", "graph", ")", "eco_id", "=", "self",...
Create an association between a sex-specific strain id and each of the phenotypes. Here, we create a genotype from the strain, and a sex-specific genotype. Each of those genotypes are created as anonymous nodes. The evidence code is hardcoded to be: ECO:experimental_...
[ "Create", "an", "association", "between", "a", "sex", "-", "specific", "strain", "id", "and", "each", "of", "the", "phenotypes", ".", "Here", "we", "create", "a", "genotype", "from", "the", "strain", "and", "a", "sex", "-", "specific", "genotype", ".", "...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MPD.py#L385-L457
18,351
monarch-initiative/dipper
dipper/sources/IMPC.py
IMPC.parse
def parse(self, limit=None): """ IMPC data is delivered in three separate csv files OR in one integrated file, each with the same file format. :param limit: :return: """ if limit is not None: LOG.info("Only parsing first %s rows fo each file", str(li...
python
def parse(self, limit=None): """ IMPC data is delivered in three separate csv files OR in one integrated file, each with the same file format. :param limit: :return: """ if limit is not None: LOG.info("Only parsing first %s rows fo each file", str(li...
[ "def", "parse", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "not", "None", ":", "LOG", ".", "info", "(", "\"Only parsing first %s rows fo each file\"", ",", "str", "(", "limit", ")", ")", "LOG", ".", "info", "(", "\"Parsing fil...
IMPC data is delivered in three separate csv files OR in one integrated file, each with the same file format. :param limit: :return:
[ "IMPC", "data", "is", "delivered", "in", "three", "separate", "csv", "files", "OR", "in", "one", "integrated", "file", "each", "with", "the", "same", "file", "format", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/IMPC.py#L119-L143
18,352
monarch-initiative/dipper
dipper/models/Pathway.py
Pathway.addGeneToPathway
def addGeneToPathway(self, gene_id, pathway_id): """ When adding a gene to a pathway, we create an intermediate 'gene product' that is involved in the pathway, through a blank node. gene_id RO:has_gene_product _gene_product _gene_product RO:involved_in pathway_id ...
python
def addGeneToPathway(self, gene_id, pathway_id): """ When adding a gene to a pathway, we create an intermediate 'gene product' that is involved in the pathway, through a blank node. gene_id RO:has_gene_product _gene_product _gene_product RO:involved_in pathway_id ...
[ "def", "addGeneToPathway", "(", "self", ",", "gene_id", ",", "pathway_id", ")", ":", "gene_product", "=", "'_:'", "+", "re", ".", "sub", "(", "r':'", ",", "''", ",", "gene_id", ")", "+", "'product'", "self", ".", "model", ".", "addIndividualToGraph", "("...
When adding a gene to a pathway, we create an intermediate 'gene product' that is involved in the pathway, through a blank node. gene_id RO:has_gene_product _gene_product _gene_product RO:involved_in pathway_id :param pathway_id: :param gene_id: :return:
[ "When", "adding", "a", "gene", "to", "a", "pathway", "we", "create", "an", "intermediate", "gene", "product", "that", "is", "involved", "in", "the", "pathway", "through", "a", "blank", "node", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/Pathway.py#L50-L71
18,353
monarch-initiative/dipper
dipper/models/Pathway.py
Pathway.addComponentToPathway
def addComponentToPathway(self, component_id, pathway_id): """ This can be used directly when the component is directly involved in the pathway. If a transforming event is performed on the component first, then the addGeneToPathway should be used instead. :param pathway_id: ...
python
def addComponentToPathway(self, component_id, pathway_id): """ This can be used directly when the component is directly involved in the pathway. If a transforming event is performed on the component first, then the addGeneToPathway should be used instead. :param pathway_id: ...
[ "def", "addComponentToPathway", "(", "self", ",", "component_id", ",", "pathway_id", ")", ":", "self", ".", "graph", ".", "addTriple", "(", "component_id", ",", "self", ".", "globaltt", "[", "'involved in'", "]", ",", "pathway_id", ")", "return" ]
This can be used directly when the component is directly involved in the pathway. If a transforming event is performed on the component first, then the addGeneToPathway should be used instead. :param pathway_id: :param component_id: :return:
[ "This", "can", "be", "used", "directly", "when", "the", "component", "is", "directly", "involved", "in", "the", "pathway", ".", "If", "a", "transforming", "event", "is", "performed", "on", "the", "component", "first", "then", "the", "addGeneToPathway", "should...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/Pathway.py#L73-L85
18,354
monarch-initiative/dipper
dipper/sources/Source.py
Source.write
def write(self, fmt='turtle', stream=None): """ This convenience method will write out all of the graphs associated with the source. Right now these are hardcoded to be a single "graph" and a "src_dataset.ttl" and a "src_test.ttl" If you do not supply stream='stdout' ...
python
def write(self, fmt='turtle', stream=None): """ This convenience method will write out all of the graphs associated with the source. Right now these are hardcoded to be a single "graph" and a "src_dataset.ttl" and a "src_test.ttl" If you do not supply stream='stdout' ...
[ "def", "write", "(", "self", ",", "fmt", "=", "'turtle'", ",", "stream", "=", "None", ")", ":", "fmt_ext", "=", "{", "'rdfxml'", ":", "'xml'", ",", "'turtle'", ":", "'ttl'", ",", "'nt'", ":", "'nt'", ",", "# ntriples", "'nquads'", ":", "'nq'", ",", ...
This convenience method will write out all of the graphs associated with the source. Right now these are hardcoded to be a single "graph" and a "src_dataset.ttl" and a "src_test.ttl" If you do not supply stream='stdout' it will default write these to files. In addition, ...
[ "This", "convenience", "method", "will", "write", "out", "all", "of", "the", "graphs", "associated", "with", "the", "source", ".", "Right", "now", "these", "are", "hardcoded", "to", "be", "a", "single", "graph", "and", "a", "src_dataset", ".", "ttl", "and"...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Source.py#L161-L223
18,355
monarch-initiative/dipper
dipper/sources/Source.py
Source.declareAsOntology
def declareAsOntology(self, graph): """ The file we output needs to be declared as an ontology, including it's version information. TEC: I am not convinced dipper reformating external data as RDF triples makes an OWL ontology (nor that it should be considered a goal). P...
python
def declareAsOntology(self, graph): """ The file we output needs to be declared as an ontology, including it's version information. TEC: I am not convinced dipper reformating external data as RDF triples makes an OWL ontology (nor that it should be considered a goal). P...
[ "def", "declareAsOntology", "(", "self", ",", "graph", ")", ":", "# <http://data.monarchinitiative.org/ttl/biogrid.ttl> a owl:Ontology ;", "# owl:versionInfo", "# <https://archive.monarchinitiative.org/YYYYMM/ttl/biogrid.ttl>", "model", "=", "Model", "(", "graph", ")", "# is self.o...
The file we output needs to be declared as an ontology, including it's version information. TEC: I am not convinced dipper reformating external data as RDF triples makes an OWL ontology (nor that it should be considered a goal). Proper ontologies are built by ontologists. Dipper reform...
[ "The", "file", "we", "output", "needs", "to", "be", "declared", "as", "an", "ontology", "including", "it", "s", "version", "information", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Source.py#L614-L660
18,356
monarch-initiative/dipper
dipper/sources/Source.py
Source.remove_backslash_r
def remove_backslash_r(filename, encoding): """ A helpful utility to remove Carriage Return from any file. This will read a file into memory, and overwrite the contents of the original file. TODO: This function may be a liability :param filename: :return: ...
python
def remove_backslash_r(filename, encoding): """ A helpful utility to remove Carriage Return from any file. This will read a file into memory, and overwrite the contents of the original file. TODO: This function may be a liability :param filename: :return: ...
[ "def", "remove_backslash_r", "(", "filename", ",", "encoding", ")", ":", "with", "open", "(", "filename", ",", "'r'", ",", "encoding", "=", "encoding", ",", "newline", "=", "r'\\n'", ")", "as", "filereader", ":", "contents", "=", "filereader", ".", "read",...
A helpful utility to remove Carriage Return from any file. This will read a file into memory, and overwrite the contents of the original file. TODO: This function may be a liability :param filename: :return:
[ "A", "helpful", "utility", "to", "remove", "Carriage", "Return", "from", "any", "file", ".", "This", "will", "read", "a", "file", "into", "memory", "and", "overwrite", "the", "contents", "of", "the", "original", "file", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Source.py#L664-L683
18,357
monarch-initiative/dipper
dipper/sources/Source.py
Source.load_local_translationtable
def load_local_translationtable(self, name): ''' Load "ingest specific" translation from whatever they called something to the ontology label we need to map it to. To facilitate seeing more ontology lables in dipper ingests a reverse mapping from ontology lables to external strin...
python
def load_local_translationtable(self, name): ''' Load "ingest specific" translation from whatever they called something to the ontology label we need to map it to. To facilitate seeing more ontology lables in dipper ingests a reverse mapping from ontology lables to external strin...
[ "def", "load_local_translationtable", "(", "self", ",", "name", ")", ":", "localtt_file", "=", "'translationtable/'", "+", "name", "+", "'.yaml'", "try", ":", "with", "open", "(", "localtt_file", ")", ":", "pass", "except", "IOError", ":", "# write a stub file a...
Load "ingest specific" translation from whatever they called something to the ontology label we need to map it to. To facilitate seeing more ontology lables in dipper ingests a reverse mapping from ontology lables to external strings is also generated and available as a dict localtcid
[ "Load", "ingest", "specific", "translation", "from", "whatever", "they", "called", "something", "to", "the", "ontology", "label", "we", "need", "to", "map", "it", "to", ".", "To", "facilitate", "seeing", "more", "ontology", "lables", "in", "dipper", "ingests",...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Source.py#L739-L767
18,358
monarch-initiative/dipper
dipper/models/Genotype.py
Genotype.addGene
def addGene( self, gene_id, gene_label, gene_type=None, gene_description=None ): ''' genes are classes ''' if gene_type is None: gene_type = self.globaltt['gene'] self.model.addClassToGraph(gene_id, gene_label, gene_type, gene_description) return
python
def addGene( self, gene_id, gene_label, gene_type=None, gene_description=None ): ''' genes are classes ''' if gene_type is None: gene_type = self.globaltt['gene'] self.model.addClassToGraph(gene_id, gene_label, gene_type, gene_description) return
[ "def", "addGene", "(", "self", ",", "gene_id", ",", "gene_label", ",", "gene_type", "=", "None", ",", "gene_description", "=", "None", ")", ":", "if", "gene_type", "is", "None", ":", "gene_type", "=", "self", ".", "globaltt", "[", "'gene'", "]", "self", ...
genes are classes
[ "genes", "are", "classes" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/Genotype.py#L79-L87
18,359
monarch-initiative/dipper
dipper/utils/DipperUtil.py
DipperUtil.get_ncbi_taxon_num_by_label
def get_ncbi_taxon_num_by_label(label): """ Here we want to look up the NCBI Taxon id using some kind of label. It will only return a result if there is a unique hit. :return: """ req = {'db': 'taxonomy', 'retmode': 'json', 'term': label} req.update(EREQ) ...
python
def get_ncbi_taxon_num_by_label(label): """ Here we want to look up the NCBI Taxon id using some kind of label. It will only return a result if there is a unique hit. :return: """ req = {'db': 'taxonomy', 'retmode': 'json', 'term': label} req.update(EREQ) ...
[ "def", "get_ncbi_taxon_num_by_label", "(", "label", ")", ":", "req", "=", "{", "'db'", ":", "'taxonomy'", ",", "'retmode'", ":", "'json'", ",", "'term'", ":", "label", "}", "req", ".", "update", "(", "EREQ", ")", "request", "=", "SESSION", ".", "get", ...
Here we want to look up the NCBI Taxon id using some kind of label. It will only return a result if there is a unique hit. :return:
[ "Here", "we", "want", "to", "look", "up", "the", "NCBI", "Taxon", "id", "using", "some", "kind", "of", "label", ".", "It", "will", "only", "return", "a", "result", "if", "there", "is", "a", "unique", "hit", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/DipperUtil.py#L47-L78
18,360
monarch-initiative/dipper
dipper/models/assoc/Association.py
Assoc.set_association_id
def set_association_id(self, assoc_id=None): """ This will set the association ID based on the internal parts of the association. To be used in cases where an external association identifier should be used. :param assoc_id: :return: """ if assoc...
python
def set_association_id(self, assoc_id=None): """ This will set the association ID based on the internal parts of the association. To be used in cases where an external association identifier should be used. :param assoc_id: :return: """ if assoc...
[ "def", "set_association_id", "(", "self", ",", "assoc_id", "=", "None", ")", ":", "if", "assoc_id", "is", "None", ":", "self", ".", "assoc_id", "=", "self", ".", "make_association_id", "(", "self", ".", "definedby", ",", "self", ".", "sub", ",", "self", ...
This will set the association ID based on the internal parts of the association. To be used in cases where an external association identifier should be used. :param assoc_id: :return:
[ "This", "will", "set", "the", "association", "ID", "based", "on", "the", "internal", "parts", "of", "the", "association", ".", "To", "be", "used", "in", "cases", "where", "an", "external", "association", "identifier", "should", "be", "used", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/assoc/Association.py#L166-L184
18,361
monarch-initiative/dipper
dipper/models/assoc/Association.py
Assoc.make_association_id
def make_association_id(definedby, sub, pred, obj, attributes=None): """ A method to create unique identifiers for OBAN-style associations, based on all the parts of the association If any of the items is empty or None, it will convert it to blank. It effectively digests the str...
python
def make_association_id(definedby, sub, pred, obj, attributes=None): """ A method to create unique identifiers for OBAN-style associations, based on all the parts of the association If any of the items is empty or None, it will convert it to blank. It effectively digests the str...
[ "def", "make_association_id", "(", "definedby", ",", "sub", ",", "pred", ",", "obj", ",", "attributes", "=", "None", ")", ":", "items_to_hash", "=", "[", "definedby", ",", "sub", ",", "pred", ",", "obj", "]", "if", "attributes", "is", "not", "None", "a...
A method to create unique identifiers for OBAN-style associations, based on all the parts of the association If any of the items is empty or None, it will convert it to blank. It effectively digests the string of concatonated values. Subclasses of Assoc can submit an additional array of...
[ "A", "method", "to", "create", "unique", "identifiers", "for", "OBAN", "-", "style", "associations", "based", "on", "all", "the", "parts", "of", "the", "association", "If", "any", "of", "the", "items", "is", "empty", "or", "None", "it", "will", "convert", ...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/assoc/Association.py#L250-L279
18,362
monarch-initiative/dipper
dipper/utils/romanplus.py
toRoman
def toRoman(num): """convert integer to Roman numeral""" if not 0 < num < 5000: raise ValueError("number %n out of range (must be 1..4999)", num) if int(num) != num: raise TypeError("decimals %n can not be converted", num) result = "" for numeral, integer in romanNumeralMap: ...
python
def toRoman(num): """convert integer to Roman numeral""" if not 0 < num < 5000: raise ValueError("number %n out of range (must be 1..4999)", num) if int(num) != num: raise TypeError("decimals %n can not be converted", num) result = "" for numeral, integer in romanNumeralMap: ...
[ "def", "toRoman", "(", "num", ")", ":", "if", "not", "0", "<", "num", "<", "5000", ":", "raise", "ValueError", "(", "\"number %n out of range (must be 1..4999)\"", ",", "num", ")", "if", "int", "(", "num", ")", "!=", "num", ":", "raise", "TypeError", "("...
convert integer to Roman numeral
[ "convert", "integer", "to", "Roman", "numeral" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/romanplus.py#L38-L50
18,363
monarch-initiative/dipper
dipper/utils/romanplus.py
fromRoman
def fromRoman(strng): """convert Roman numeral to integer""" if not strng: raise TypeError('Input can not be blank') if not romanNumeralPattern.search(strng): raise ValueError('Invalid Roman numeral: %s', strng) result = 0 index = 0 for numeral, integer in romanNumeralMap: ...
python
def fromRoman(strng): """convert Roman numeral to integer""" if not strng: raise TypeError('Input can not be blank') if not romanNumeralPattern.search(strng): raise ValueError('Invalid Roman numeral: %s', strng) result = 0 index = 0 for numeral, integer in romanNumeralMap: ...
[ "def", "fromRoman", "(", "strng", ")", ":", "if", "not", "strng", ":", "raise", "TypeError", "(", "'Input can not be blank'", ")", "if", "not", "romanNumeralPattern", ".", "search", "(", "strng", ")", ":", "raise", "ValueError", "(", "'Invalid Roman numeral: %s'...
convert Roman numeral to integer
[ "convert", "Roman", "numeral", "to", "integer" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/romanplus.py#L70-L83
18,364
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_genotype_backgrounds
def _process_genotype_backgrounds(self, limit=None): """ This table provides a mapping of genotypes to background genotypes Note that the background_id is also a genotype_id. Makes these triples: <ZFIN:genotype_id> GENO:has_reference_part <ZFIN:background_id> <ZFIN:backg...
python
def _process_genotype_backgrounds(self, limit=None): """ This table provides a mapping of genotypes to background genotypes Note that the background_id is also a genotype_id. Makes these triples: <ZFIN:genotype_id> GENO:has_reference_part <ZFIN:background_id> <ZFIN:backg...
[ "def", "_process_genotype_backgrounds", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "graph", ...
This table provides a mapping of genotypes to background genotypes Note that the background_id is also a genotype_id. Makes these triples: <ZFIN:genotype_id> GENO:has_reference_part <ZFIN:background_id> <ZFIN:background_id> a GENO:genomic_background <ZFIN:background_id> in_taxon...
[ "This", "table", "provides", "a", "mapping", "of", "genotypes", "to", "background", "genotypes", "Note", "that", "the", "background_id", "is", "also", "a", "genotype_id", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1048-L1113
18,365
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_stages
def _process_stages(self, limit=None): """ This table provides mappings between ZFIN stage IDs and ZFS terms, and includes the starting and ending hours for the developmental stage. Currently only processing the mapping from the ZFIN stage ID to the ZFS ID. :param limit:...
python
def _process_stages(self, limit=None): """ This table provides mappings between ZFIN stage IDs and ZFS terms, and includes the starting and ending hours for the developmental stage. Currently only processing the mapping from the ZFIN stage ID to the ZFS ID. :param limit:...
[ "def", "_process_stages", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "graph", ")", "LOG",...
This table provides mappings between ZFIN stage IDs and ZFS terms, and includes the starting and ending hours for the developmental stage. Currently only processing the mapping from the ZFIN stage ID to the ZFS ID. :param limit: :return:
[ "This", "table", "provides", "mappings", "between", "ZFIN", "stage", "IDs", "and", "ZFS", "terms", "and", "includes", "the", "starting", "and", "ending", "hours", "for", "the", "developmental", "stage", ".", "Currently", "only", "processing", "the", "mapping", ...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1174-L1211
18,366
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_genes
def _process_genes(self, limit=None): """ This table provides the ZFIN gene id, the SO type of the gene, the gene symbol, and the NCBI Gene ID. Triples created: <gene id> a class <gene id> rdfs:label gene_symbol <gene id> equivalent class <ncbi_gene_id> :...
python
def _process_genes(self, limit=None): """ This table provides the ZFIN gene id, the SO type of the gene, the gene symbol, and the NCBI Gene ID. Triples created: <gene id> a class <gene id> rdfs:label gene_symbol <gene id> equivalent class <ncbi_gene_id> :...
[ "def", "_process_genes", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing genes\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph...
This table provides the ZFIN gene id, the SO type of the gene, the gene symbol, and the NCBI Gene ID. Triples created: <gene id> a class <gene id> rdfs:label gene_symbol <gene id> equivalent class <ncbi_gene_id> :param limit: :return:
[ "This", "table", "provides", "the", "ZFIN", "gene", "id", "the", "SO", "type", "of", "the", "gene", "the", "gene", "symbol", "and", "the", "NCBI", "Gene", "ID", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1390-L1437
18,367
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_features
def _process_features(self, limit=None): """ This module provides information for the intrinsic and extrinsic genotype features of zebrafish. All items here are 'alterations', and are therefore instances. sequence alteration ID, SO type, abbreviation, and relationship to ...
python
def _process_features(self, limit=None): """ This module provides information for the intrinsic and extrinsic genotype features of zebrafish. All items here are 'alterations', and are therefore instances. sequence alteration ID, SO type, abbreviation, and relationship to ...
[ "def", "_process_features", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "graph", ")", "LOG...
This module provides information for the intrinsic and extrinsic genotype features of zebrafish. All items here are 'alterations', and are therefore instances. sequence alteration ID, SO type, abbreviation, and relationship to the affected gene, with the gene's ID, symbol, and S...
[ "This", "module", "provides", "information", "for", "the", "intrinsic", "and", "extrinsic", "genotype", "features", "of", "zebrafish", ".", "All", "items", "here", "are", "alterations", "and", "are", "therefore", "instances", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1439-L1505
18,368
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_pubinfo
def _process_pubinfo(self, limit=None): """ This will pull the zfin internal publication information, and map them to their equivalent pmid, and make labels. Triples created: <pub_id> is an individual <pub_id> rdfs:label <pub_label> <pubmed_id> is an individual ...
python
def _process_pubinfo(self, limit=None): """ This will pull the zfin internal publication information, and map them to their equivalent pmid, and make labels. Triples created: <pub_id> is an individual <pub_id> rdfs:label <pub_label> <pubmed_id> is an individual ...
[ "def", "_process_pubinfo", "(", "self", ",", "limit", "=", "None", ")", ":", "line_counter", "=", "0", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", ...
This will pull the zfin internal publication information, and map them to their equivalent pmid, and make labels. Triples created: <pub_id> is an individual <pub_id> rdfs:label <pub_label> <pubmed_id> is an individual <pubmed_id> rdfs:label <pub_label> <pub_id> ...
[ "This", "will", "pull", "the", "zfin", "internal", "publication", "information", "and", "map", "them", "to", "their", "equivalent", "pmid", "and", "make", "labels", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1775-L1851
18,369
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_pub2pubmed
def _process_pub2pubmed(self, limit=None): """ This will pull the zfin internal publication to pubmed mappings. Somewhat redundant with the process_pubinfo method, but this includes additional mappings. <pub_id> is an individual <pub_id> rdfs:label <pub_label> <p...
python
def _process_pub2pubmed(self, limit=None): """ This will pull the zfin internal publication to pubmed mappings. Somewhat redundant with the process_pubinfo method, but this includes additional mappings. <pub_id> is an individual <pub_id> rdfs:label <pub_label> <p...
[ "def", "_process_pub2pubmed", "(", "self", ",", "limit", "=", "None", ")", ":", "line_counter", "=", "0", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model...
This will pull the zfin internal publication to pubmed mappings. Somewhat redundant with the process_pubinfo method, but this includes additional mappings. <pub_id> is an individual <pub_id> rdfs:label <pub_label> <pubmed_id> is an individual <pubmed_id> rdfs:label <pub_...
[ "This", "will", "pull", "the", "zfin", "internal", "publication", "to", "pubmed", "mappings", ".", "Somewhat", "redundant", "with", "the", "process_pubinfo", "method", "but", "this", "includes", "additional", "mappings", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1853-L1901
18,370
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_targeting_reagents
def _process_targeting_reagents(self, reagent_type, limit=None): """ This method processes the gene targeting knockdown reagents, such as morpholinos, talens, and crisprs. We create triples for the reagents and pass the data into a hash map for use in the pheno_enviro method. ...
python
def _process_targeting_reagents(self, reagent_type, limit=None): """ This method processes the gene targeting knockdown reagents, such as morpholinos, talens, and crisprs. We create triples for the reagents and pass the data into a hash map for use in the pheno_enviro method. ...
[ "def", "_process_targeting_reagents", "(", "self", ",", "reagent_type", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing Gene Targeting Reagents\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "e...
This method processes the gene targeting knockdown reagents, such as morpholinos, talens, and crisprs. We create triples for the reagents and pass the data into a hash map for use in the pheno_enviro method. Morpholinos work similar to RNAi. TALENs are artificial restriction enz...
[ "This", "method", "processes", "the", "gene", "targeting", "knockdown", "reagents", "such", "as", "morpholinos", "talens", "and", "crisprs", ".", "We", "create", "triples", "for", "the", "reagents", "and", "pass", "the", "data", "into", "a", "hash", "map", "...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L1903-L2014
18,371
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN._process_uniprot_ids
def _process_uniprot_ids(self, limit=None): """ This method processes the mappings from ZFIN gene IDs to UniProtKB IDs. Triples created: <zfin_gene_id> a class <zfin_gene_id> rdfs:label gene_symbol <uniprot_id> is an Individual <uniprot_id> has type <polypeptide...
python
def _process_uniprot_ids(self, limit=None): """ This method processes the mappings from ZFIN gene IDs to UniProtKB IDs. Triples created: <zfin_gene_id> a class <zfin_gene_id> rdfs:label gene_symbol <uniprot_id> is an Individual <uniprot_id> has type <polypeptide...
[ "def", "_process_uniprot_ids", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing UniProt IDs\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", "...
This method processes the mappings from ZFIN gene IDs to UniProtKB IDs. Triples created: <zfin_gene_id> a class <zfin_gene_id> rdfs:label gene_symbol <uniprot_id> is an Individual <uniprot_id> has type <polypeptide> <zfin_gene_id> has_gene_product <uniprot_id> ...
[ "This", "method", "processes", "the", "mappings", "from", "ZFIN", "gene", "IDs", "to", "UniProtKB", "IDs", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L2235-L2287
18,372
monarch-initiative/dipper
dipper/sources/ZFIN.py
ZFIN.get_orthology_evidence_code
def get_orthology_evidence_code(self, abbrev): ''' move to localtt & globltt ''' # AA Amino acid sequence comparison. # CE Coincident expression. # CL Conserved genome location (synteny). # FC Functional complementation. # FH Formation of functional he...
python
def get_orthology_evidence_code(self, abbrev): ''' move to localtt & globltt ''' # AA Amino acid sequence comparison. # CE Coincident expression. # CL Conserved genome location (synteny). # FC Functional complementation. # FH Formation of functional he...
[ "def", "get_orthology_evidence_code", "(", "self", ",", "abbrev", ")", ":", "# AA\tAmino acid sequence comparison.", "# CE\tCoincident expression.", "# CL\tConserved genome location (synteny).", "# FC\tFunctional complementation.", "# FH\tFormation of functional heteropolymers.", "# IX\tIm...
move to localtt & globltt
[ "move", "to", "localtt", "&", "globltt" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/ZFIN.py#L2798-L2840
18,373
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_diseases
def _process_diseases(self, limit=None): """ This method processes the KEGG disease IDs. Triples created: <disease_id> is a class <disease_id> rdfs:label <disease_name> :param limit: :return: """ LOG.info("Processing diseases") if self.t...
python
def _process_diseases(self, limit=None): """ This method processes the KEGG disease IDs. Triples created: <disease_id> is a class <disease_id> rdfs:label <disease_name> :param limit: :return: """ LOG.info("Processing diseases") if self.t...
[ "def", "_process_diseases", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing diseases\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", ...
This method processes the KEGG disease IDs. Triples created: <disease_id> is a class <disease_id> rdfs:label <disease_name> :param limit: :return:
[ "This", "method", "processes", "the", "KEGG", "disease", "IDs", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L224-L269
18,374
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_genes
def _process_genes(self, limit=None): """ This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definition. This is ha...
python
def _process_genes(self, limit=None): """ This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definition. This is ha...
[ "def", "_process_genes", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing genes\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph...
This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definition. This is hardcoded to just processes human genes. Triples cr...
[ "This", "method", "processes", "the", "KEGG", "gene", "IDs", ".", "The", "label", "for", "the", "gene", "is", "pulled", "as", "the", "first", "symbol", "in", "the", "list", "of", "gene", "symbols", ";", "the", "rest", "are", "added", "as", "synonyms", ...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L271-L352
18,375
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_ortholog_classes
def _process_ortholog_classes(self, limit=None): """ This method add the KEGG orthology classes to the graph. If there's an embedded enzyme commission number, that is added as an xref. Triples created: <orthology_class_id> is a class <orthology_class_id> has lab...
python
def _process_ortholog_classes(self, limit=None): """ This method add the KEGG orthology classes to the graph. If there's an embedded enzyme commission number, that is added as an xref. Triples created: <orthology_class_id> is a class <orthology_class_id> has lab...
[ "def", "_process_ortholog_classes", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing ortholog classes\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "...
This method add the KEGG orthology classes to the graph. If there's an embedded enzyme commission number, that is added as an xref. Triples created: <orthology_class_id> is a class <orthology_class_id> has label <orthology_symbols> <orthology_class_id> has description <...
[ "This", "method", "add", "the", "KEGG", "orthology", "classes", "to", "the", "graph", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L354-L423
18,376
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_orthologs
def _process_orthologs(self, raw, limit=None): """ This method maps orthologs for a species to the KEGG orthology classes. Triples created: <gene_id> is a class <orthology_class_id> is a class <assoc_id> has subject <gene_id> <assoc_id> has object <orthology_cla...
python
def _process_orthologs(self, raw, limit=None): """ This method maps orthologs for a species to the KEGG orthology classes. Triples created: <gene_id> is a class <orthology_class_id> is a class <assoc_id> has subject <gene_id> <assoc_id> has object <orthology_cla...
[ "def", "_process_orthologs", "(", "self", ",", "raw", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing orthologs\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", ...
This method maps orthologs for a species to the KEGG orthology classes. Triples created: <gene_id> is a class <orthology_class_id> is a class <assoc_id> has subject <gene_id> <assoc_id> has object <orthology_class_id> :param limit: :return:
[ "This", "method", "maps", "orthologs", "for", "a", "species", "to", "the", "KEGG", "orthology", "classes", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L425-L473
18,377
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_kegg_disease2gene
def _process_kegg_disease2gene(self, limit=None): """ This method creates an association between diseases and their associated genes. We are being conservative here, and only processing those diseases for which there is no mapping to OMIM. Triples created: <alternate_loc...
python
def _process_kegg_disease2gene(self, limit=None): """ This method creates an association between diseases and their associated genes. We are being conservative here, and only processing those diseases for which there is no mapping to OMIM. Triples created: <alternate_loc...
[ "def", "_process_kegg_disease2gene", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing KEGG disease to gene\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "="...
This method creates an association between diseases and their associated genes. We are being conservative here, and only processing those diseases for which there is no mapping to OMIM. Triples created: <alternate_locus> is an Individual <alternate_locus> has type <variant_locus...
[ "This", "method", "creates", "an", "association", "between", "diseases", "and", "their", "associated", "genes", ".", "We", "are", "being", "conservative", "here", "and", "only", "processing", "those", "diseases", "for", "which", "there", "is", "no", "mapping", ...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L475-L551
18,378
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_omim2gene
def _process_omim2gene(self, limit=None): """ This method maps the OMIM IDs and KEGG gene ID. Currently split based on the link_type field. Equivalent link types are mapped as gene XRefs. Reverse link types are mapped as disease to gene associations. Original link types a...
python
def _process_omim2gene(self, limit=None): """ This method maps the OMIM IDs and KEGG gene ID. Currently split based on the link_type field. Equivalent link types are mapped as gene XRefs. Reverse link types are mapped as disease to gene associations. Original link types a...
[ "def", "_process_omim2gene", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing OMIM to KEGG gene\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self",...
This method maps the OMIM IDs and KEGG gene ID. Currently split based on the link_type field. Equivalent link types are mapped as gene XRefs. Reverse link types are mapped as disease to gene associations. Original link types are currently skipped. Triples created: <kegg_...
[ "This", "method", "maps", "the", "OMIM", "IDs", "and", "KEGG", "gene", "ID", ".", "Currently", "split", "based", "on", "the", "link_type", "field", ".", "Equivalent", "link", "types", "are", "mapped", "as", "gene", "XRefs", ".", "Reverse", "link", "types",...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L553-L634
18,379
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_genes_kegg2ncbi
def _process_genes_kegg2ncbi(self, limit=None): """ This method maps the KEGG human gene IDs to the corresponding NCBI Gene IDs. Triples created: <kegg_gene_id> is a class <ncbi_gene_id> is a class <kegg_gene_id> equivalentClass <ncbi_gene_id> :param ...
python
def _process_genes_kegg2ncbi(self, limit=None): """ This method maps the KEGG human gene IDs to the corresponding NCBI Gene IDs. Triples created: <kegg_gene_id> is a class <ncbi_gene_id> is a class <kegg_gene_id> equivalentClass <ncbi_gene_id> :param ...
[ "def", "_process_genes_kegg2ncbi", "(", "self", ",", "limit", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Processing KEGG gene IDs to NCBI gene IDs\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph...
This method maps the KEGG human gene IDs to the corresponding NCBI Gene IDs. Triples created: <kegg_gene_id> is a class <ncbi_gene_id> is a class <kegg_gene_id> equivalentClass <ncbi_gene_id> :param limit: :return:
[ "This", "method", "maps", "the", "KEGG", "human", "gene", "IDs", "to", "the", "corresponding", "NCBI", "Gene", "IDs", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L706-L754
18,380
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._process_pathway_disease
def _process_pathway_disease(self, limit): """ We make a link between the pathway identifiers, and any diseases associated with them. Since we model diseases as processes, we make a triple saying that the pathway may be causally upstream of or within the disease process. ...
python
def _process_pathway_disease(self, limit): """ We make a link between the pathway identifiers, and any diseases associated with them. Since we model diseases as processes, we make a triple saying that the pathway may be causally upstream of or within the disease process. ...
[ "def", "_process_pathway_disease", "(", "self", ",", "limit", ")", ":", "LOG", ".", "info", "(", "\"Processing KEGG pathways to disease ids\"", ")", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self",...
We make a link between the pathway identifiers, and any diseases associated with them. Since we model diseases as processes, we make a triple saying that the pathway may be causally upstream of or within the disease process. :param limit: :return:
[ "We", "make", "a", "link", "between", "the", "pathway", "identifiers", "and", "any", "diseases", "associated", "with", "them", ".", "Since", "we", "model", "diseases", "as", "processes", "we", "make", "a", "triple", "saying", "that", "the", "pathway", "may",...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L792-L832
18,381
monarch-initiative/dipper
dipper/sources/KEGG.py
KEGG._make_variant_locus_id
def _make_variant_locus_id(self, gene_id, disease_id): """ We actually want the association between the gene and the disease to be via an alternate locus not the "wildtype" gene itself. so we make an anonymous alternate locus, and put that in the association We also make ...
python
def _make_variant_locus_id(self, gene_id, disease_id): """ We actually want the association between the gene and the disease to be via an alternate locus not the "wildtype" gene itself. so we make an anonymous alternate locus, and put that in the association We also make ...
[ "def", "_make_variant_locus_id", "(", "self", ",", "gene_id", ",", "disease_id", ")", ":", "alt_locus_id", "=", "'_:'", "+", "re", ".", "sub", "(", "r':'", ",", "''", ",", "gene_id", ")", "+", "'-'", "+", "re", ".", "sub", "(", "r':'", ",", "''", "...
We actually want the association between the gene and the disease to be via an alternate locus not the "wildtype" gene itself. so we make an anonymous alternate locus, and put that in the association We also make the label for the anonymous class, and add it to the label hash ...
[ "We", "actually", "want", "the", "association", "between", "the", "gene", "and", "the", "disease", "to", "be", "via", "an", "alternate", "locus", "not", "the", "wildtype", "gene", "itself", ".", "so", "we", "make", "an", "anonymous", "alternate", "locus", ...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L906-L933
18,382
monarch-initiative/dipper
dipper/sources/CTD.py
CTD._fetch_disambiguating_assoc
def _fetch_disambiguating_assoc(self): """ For any of the items in the chemical-disease association file that have ambiguous association types we fetch the disambiguated associations using the batch query API, and store these in a file. Elsewhere, we can loop through the file and...
python
def _fetch_disambiguating_assoc(self): """ For any of the items in the chemical-disease association file that have ambiguous association types we fetch the disambiguated associations using the batch query API, and store these in a file. Elsewhere, we can loop through the file and...
[ "def", "_fetch_disambiguating_assoc", "(", "self", ")", ":", "disambig_file", "=", "'/'", ".", "join", "(", "(", "self", ".", "rawdir", ",", "self", ".", "static_files", "[", "'publications'", "]", "[", "'file'", "]", ")", ")", "assoc_file", "=", "'/'", ...
For any of the items in the chemical-disease association file that have ambiguous association types we fetch the disambiguated associations using the batch query API, and store these in a file. Elsewhere, we can loop through the file and create the appropriate associations. :return:
[ "For", "any", "of", "the", "items", "in", "the", "chemical", "-", "disease", "association", "file", "that", "have", "ambiguous", "association", "types", "we", "fetch", "the", "disambiguated", "associations", "using", "the", "batch", "query", "API", "and", "sto...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/CTD.py#L243-L323
18,383
monarch-initiative/dipper
dipper/sources/CTD.py
CTD._make_association
def _make_association(self, subject_id, object_id, rel_id, pubmed_ids): """ Make a reified association given an array of pubmed identifiers. Args: :param subject_id id of the subject of the association (gene/chem) :param object_id id of the object of the association (d...
python
def _make_association(self, subject_id, object_id, rel_id, pubmed_ids): """ Make a reified association given an array of pubmed identifiers. Args: :param subject_id id of the subject of the association (gene/chem) :param object_id id of the object of the association (d...
[ "def", "_make_association", "(", "self", ",", "subject_id", ",", "object_id", ",", "rel_id", ",", "pubmed_ids", ")", ":", "# TODO pass in the relevant Assoc class rather than relying on G2P", "assoc", "=", "G2PAssoc", "(", "self", ".", "graph", ",", "self", ".", "na...
Make a reified association given an array of pubmed identifiers. Args: :param subject_id id of the subject of the association (gene/chem) :param object_id id of the object of the association (disease) :param rel_id relationship id :param pubmed_ids an array of...
[ "Make", "a", "reified", "association", "given", "an", "array", "of", "pubmed", "identifiers", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/CTD.py#L485-L510
18,384
monarch-initiative/dipper
dipper/sources/Bgee.py
Bgee.checkIfRemoteIsNewer
def checkIfRemoteIsNewer(self, localfile, remote_size, remote_modify): """ Overrides checkIfRemoteIsNewer in Source class :param localfile: str file path :param remote_size: str bytes :param remote_modify: str last modify date in the form 20160705042714 :return: boolean ...
python
def checkIfRemoteIsNewer(self, localfile, remote_size, remote_modify): """ Overrides checkIfRemoteIsNewer in Source class :param localfile: str file path :param remote_size: str bytes :param remote_modify: str last modify date in the form 20160705042714 :return: boolean ...
[ "def", "checkIfRemoteIsNewer", "(", "self", ",", "localfile", ",", "remote_size", ",", "remote_modify", ")", ":", "is_remote_newer", "=", "False", "status", "=", "os", ".", "stat", "(", "localfile", ")", "LOG", ".", "info", "(", "\"\\nLocal file size: %i\"", "...
Overrides checkIfRemoteIsNewer in Source class :param localfile: str file path :param remote_size: str bytes :param remote_modify: str last modify date in the form 20160705042714 :return: boolean True if remote file is newer else False
[ "Overrides", "checkIfRemoteIsNewer", "in", "Source", "class" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Bgee.py#L232-L256
18,385
monarch-initiative/dipper
dipper/sources/Bgee.py
Bgee._convert_ftp_time_to_iso
def _convert_ftp_time_to_iso(ftp_time): """ Convert datetime in the format 20160705042714 to a datetime object :return: datetime object """ date_time = datetime( int(ftp_time[:4]), int(ftp_time[4:6]), int(ftp_time[6:8]), int(ftp_time[8:10]), int(ftp_time[...
python
def _convert_ftp_time_to_iso(ftp_time): """ Convert datetime in the format 20160705042714 to a datetime object :return: datetime object """ date_time = datetime( int(ftp_time[:4]), int(ftp_time[4:6]), int(ftp_time[6:8]), int(ftp_time[8:10]), int(ftp_time[...
[ "def", "_convert_ftp_time_to_iso", "(", "ftp_time", ")", ":", "date_time", "=", "datetime", "(", "int", "(", "ftp_time", "[", ":", "4", "]", ")", ",", "int", "(", "ftp_time", "[", "4", ":", "6", "]", ")", ",", "int", "(", "ftp_time", "[", "6", ":",...
Convert datetime in the format 20160705042714 to a datetime object :return: datetime object
[ "Convert", "datetime", "in", "the", "format", "20160705042714", "to", "a", "datetime", "object" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Bgee.py#L259-L268
18,386
monarch-initiative/dipper
dipper/sources/EOM.py
EOM.fetch
def fetch(self, is_dl_forced=False): '''connection details for DISCO''' cxn = {} cxn['host'] = 'nif-db.crbs.ucsd.edu' cxn['database'] = 'disco_crawler' cxn['port'] = '5432' cxn['user'] = config.get_config()['user']['disco'] cxn['password'] = config.get_config()['k...
python
def fetch(self, is_dl_forced=False): '''connection details for DISCO''' cxn = {} cxn['host'] = 'nif-db.crbs.ucsd.edu' cxn['database'] = 'disco_crawler' cxn['port'] = '5432' cxn['user'] = config.get_config()['user']['disco'] cxn['password'] = config.get_config()['k...
[ "def", "fetch", "(", "self", ",", "is_dl_forced", "=", "False", ")", ":", "cxn", "=", "{", "}", "cxn", "[", "'host'", "]", "=", "'nif-db.crbs.ucsd.edu'", "cxn", "[", "'database'", "]", "=", "'disco_crawler'", "cxn", "[", "'port'", "]", "=", "'5432'", "...
connection details for DISCO
[ "connection", "details", "for", "DISCO" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/EOM.py#L63-L87
18,387
monarch-initiative/dipper
dipper/sources/EOM.py
EOM.parse
def parse(self, limit=None): ''' Over ride Source.parse inherited via PostgreSQLSource ''' if limit is not None: LOG.info("Only parsing first %s rows of each file", limit) if self.test_only: self.test_mode = True LOG.info("Parsing files...")...
python
def parse(self, limit=None): ''' Over ride Source.parse inherited via PostgreSQLSource ''' if limit is not None: LOG.info("Only parsing first %s rows of each file", limit) if self.test_only: self.test_mode = True LOG.info("Parsing files...")...
[ "def", "parse", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "not", "None", ":", "LOG", ".", "info", "(", "\"Only parsing first %s rows of each file\"", ",", "limit", ")", "if", "self", ".", "test_only", ":", "self", ".", "test_...
Over ride Source.parse inherited via PostgreSQLSource
[ "Over", "ride", "Source", ".", "parse", "inherited", "via", "PostgreSQLSource" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/EOM.py#L89-L113
18,388
monarch-initiative/dipper
dipper/sources/MGI.py
MGI._process_gxd_genotype_view
def _process_gxd_genotype_view(self, limit=None): """ This table indicates the relationship between a genotype and it's background strain. It leverages the Genotype class methods to do this. Makes these triples: <MGI:genotypeid> GENO:has_reference_part <MGI:strainid> ...
python
def _process_gxd_genotype_view(self, limit=None): """ This table indicates the relationship between a genotype and it's background strain. It leverages the Genotype class methods to do this. Makes these triples: <MGI:genotypeid> GENO:has_reference_part <MGI:strainid> ...
[ "def", "_process_gxd_genotype_view", "(", "self", ",", "limit", "=", "None", ")", ":", "line_counter", "=", "0", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "geno", "=", ...
This table indicates the relationship between a genotype and it's background strain. It leverages the Genotype class methods to do this. Makes these triples: <MGI:genotypeid> GENO:has_reference_part <MGI:strainid> <MGI:strainid> a GENO:genomic_background If the genotyp...
[ "This", "table", "indicates", "the", "relationship", "between", "a", "genotype", "and", "it", "s", "background", "strain", ".", "It", "leverages", "the", "Genotype", "class", "methods", "to", "do", "this", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MGI.py#L335-L430
18,389
monarch-initiative/dipper
dipper/sources/MGI.py
MGI._process_gxd_genotype_summary_view
def _process_gxd_genotype_summary_view(self, limit=None): """ Add the genotype internal id to mgiid mapping to the idhashmap. Also, add them as individuals to the graph. We re-format the label to put the background strain in brackets after the gvc. We must pass through t...
python
def _process_gxd_genotype_summary_view(self, limit=None): """ Add the genotype internal id to mgiid mapping to the idhashmap. Also, add them as individuals to the graph. We re-format the label to put the background strain in brackets after the gvc. We must pass through t...
[ "def", "_process_gxd_genotype_summary_view", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "grap...
Add the genotype internal id to mgiid mapping to the idhashmap. Also, add them as individuals to the graph. We re-format the label to put the background strain in brackets after the gvc. We must pass through the file once to get the ids and aggregate the vslcs into a hashmap int...
[ "Add", "the", "genotype", "internal", "id", "to", "mgiid", "mapping", "to", "the", "idhashmap", ".", "Also", "add", "them", "as", "individuals", "to", "the", "graph", ".", "We", "re", "-", "format", "the", "label", "to", "put", "the", "background", "stra...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MGI.py#L432-L503
18,390
monarch-initiative/dipper
dipper/sources/MGI.py
MGI.process_mgi_relationship_transgene_genes
def process_mgi_relationship_transgene_genes(self, limit=None): """ Here, we have the relationship between MGI transgene alleles, and the non-mouse gene ids that are part of them. We augment the allele with the transgene parts. :param limit: :return: """ ...
python
def process_mgi_relationship_transgene_genes(self, limit=None): """ Here, we have the relationship between MGI transgene alleles, and the non-mouse gene ids that are part of them. We augment the allele with the transgene parts. :param limit: :return: """ ...
[ "def", "process_mgi_relationship_transgene_genes", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "LOG", ".", "info", "(", "\...
Here, we have the relationship between MGI transgene alleles, and the non-mouse gene ids that are part of them. We augment the allele with the transgene parts. :param limit: :return:
[ "Here", "we", "have", "the", "relationship", "between", "MGI", "transgene", "alleles", "and", "the", "non", "-", "mouse", "gene", "ids", "that", "are", "part", "of", "them", ".", "We", "augment", "the", "allele", "with", "the", "transgene", "parts", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/MGI.py#L1891-L1944
18,391
monarch-initiative/dipper
dipper/graph/RDFGraph.py
RDFGraph._getnode
def _getnode(self, curie): # convention is lowercase names """ This is a wrapper for creating a URIRef or Bnode object with a given a curie or iri as a string. If an id starts with an underscore, it assigns it to a BNode, otherwise it creates it with a standard URIRef. ...
python
def _getnode(self, curie): # convention is lowercase names """ This is a wrapper for creating a URIRef or Bnode object with a given a curie or iri as a string. If an id starts with an underscore, it assigns it to a BNode, otherwise it creates it with a standard URIRef. ...
[ "def", "_getnode", "(", "self", ",", "curie", ")", ":", "# convention is lowercase names", "node", "=", "None", "if", "curie", "[", "0", "]", "==", "'_'", ":", "if", "self", ".", "are_bnodes_skized", "is", "True", ":", "node", "=", "self", ".", "skolemiz...
This is a wrapper for creating a URIRef or Bnode object with a given a curie or iri as a string. If an id starts with an underscore, it assigns it to a BNode, otherwise it creates it with a standard URIRef. Alternatively, self.skolemize_blank_node is True, it will skolemize the ...
[ "This", "is", "a", "wrapper", "for", "creating", "a", "URIRef", "or", "Bnode", "object", "with", "a", "given", "a", "curie", "or", "iri", "as", "a", "string", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/graph/RDFGraph.py#L92-L126
18,392
monarch-initiative/dipper
dipper/models/assoc/D2PAssoc.py
D2PAssoc.add_association_to_graph
def add_association_to_graph(self): """ The reified relationship between a disease and a phenotype is decorated with some provenance information. This makes the assumption that both the disease and phenotype are classes. :param g: :return: """ ...
python
def add_association_to_graph(self): """ The reified relationship between a disease and a phenotype is decorated with some provenance information. This makes the assumption that both the disease and phenotype are classes. :param g: :return: """ ...
[ "def", "add_association_to_graph", "(", "self", ")", ":", "# add the basic association nodes", "# if rel == self.globaltt[['has disposition']:", "Assoc", ".", "add_association_to_graph", "(", "self", ")", "# anticipating trouble with onsets ranges that look like curies", "if", "self"...
The reified relationship between a disease and a phenotype is decorated with some provenance information. This makes the assumption that both the disease and phenotype are classes. :param g: :return:
[ "The", "reified", "relationship", "between", "a", "disease", "and", "a", "phenotype", "is", "decorated", "with", "some", "provenance", "information", ".", "This", "makes", "the", "assumption", "that", "both", "the", "disease", "and", "phenotype", "are", "classes...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/models/assoc/D2PAssoc.py#L50-L75
18,393
monarch-initiative/dipper
dipper/sources/Monochrom.py
Monochrom.make_parent_bands
def make_parent_bands(self, band, child_bands): """ this will determine the grouping bands that it belongs to, recursively 13q21.31 ==> 13, 13q, 13q2, 13q21, 13q21.3, 13q21.31 :param band: :param child_bands: :return: """ m = re.match(r'([pq][A-H\d]+(?:...
python
def make_parent_bands(self, band, child_bands): """ this will determine the grouping bands that it belongs to, recursively 13q21.31 ==> 13, 13q, 13q2, 13q21, 13q21.3, 13q21.31 :param band: :param child_bands: :return: """ m = re.match(r'([pq][A-H\d]+(?:...
[ "def", "make_parent_bands", "(", "self", ",", "band", ",", "child_bands", ")", ":", "m", "=", "re", ".", "match", "(", "r'([pq][A-H\\d]+(?:\\.\\d+)?)'", ",", "band", ")", "if", "len", "(", "band", ")", ">", "0", ":", "if", "m", ":", "p", "=", "str", ...
this will determine the grouping bands that it belongs to, recursively 13q21.31 ==> 13, 13q, 13q2, 13q21, 13q21.3, 13q21.31 :param band: :param child_bands: :return:
[ "this", "will", "determine", "the", "grouping", "bands", "that", "it", "belongs", "to", "recursively", "13q21", ".", "31", "==", ">", "13", "13q", "13q2", "13q21", "13q21", ".", "3", "13q21", ".", "31" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Monochrom.py#L334-L354
18,394
monarch-initiative/dipper
dipper/utils/CurieUtil.py
CurieUtil.get_curie
def get_curie(self, uri): '''Get a CURIE from a URI ''' prefix = self.get_curie_prefix(uri) if prefix is not None: key = self.curie_map[prefix] return '%s:%s' % (prefix, uri[len(key):len(uri)]) return None
python
def get_curie(self, uri): '''Get a CURIE from a URI ''' prefix = self.get_curie_prefix(uri) if prefix is not None: key = self.curie_map[prefix] return '%s:%s' % (prefix, uri[len(key):len(uri)]) return None
[ "def", "get_curie", "(", "self", ",", "uri", ")", ":", "prefix", "=", "self", ".", "get_curie_prefix", "(", "uri", ")", "if", "prefix", "is", "not", "None", ":", "key", "=", "self", ".", "curie_map", "[", "prefix", "]", "return", "'%s:%s'", "%", "(",...
Get a CURIE from a URI
[ "Get", "a", "CURIE", "from", "a", "URI" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/CurieUtil.py#L31-L37
18,395
monarch-initiative/dipper
dipper/utils/CurieUtil.py
CurieUtil.get_uri
def get_uri(self, curie): ''' Get a URI from a CURIE ''' if curie is None: return None parts = curie.split(':') if len(parts) == 1: if curie != '': LOG.error("Not a properly formed curie: \"%s\"", curie) return None prefix = par...
python
def get_uri(self, curie): ''' Get a URI from a CURIE ''' if curie is None: return None parts = curie.split(':') if len(parts) == 1: if curie != '': LOG.error("Not a properly formed curie: \"%s\"", curie) return None prefix = par...
[ "def", "get_uri", "(", "self", ",", "curie", ")", ":", "if", "curie", "is", "None", ":", "return", "None", "parts", "=", "curie", ".", "split", "(", "':'", ")", "if", "len", "(", "parts", ")", "==", "1", ":", "if", "curie", "!=", "''", ":", "LO...
Get a URI from a CURIE
[ "Get", "a", "URI", "from", "a", "CURIE" ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/CurieUtil.py#L46-L60
18,396
monarch-initiative/dipper
dipper/sources/Coriell.py
Coriell.fetch
def fetch(self, is_dl_forced=False): """ Here we connect to the coriell sftp server using private connection details. They dump bi-weekly files with a timestamp in the filename. For each catalog, we ping the remote site and pull the most-recently updated file, renaming it to our...
python
def fetch(self, is_dl_forced=False): """ Here we connect to the coriell sftp server using private connection details. They dump bi-weekly files with a timestamp in the filename. For each catalog, we ping the remote site and pull the most-recently updated file, renaming it to our...
[ "def", "fetch", "(", "self", ",", "is_dl_forced", "=", "False", ")", ":", "host", "=", "config", ".", "get_config", "(", ")", "[", "'dbauth'", "]", "[", "'coriell'", "]", "[", "'host'", "]", "key", "=", "config", ".", "get_config", "(", ")", "[", "...
Here we connect to the coriell sftp server using private connection details. They dump bi-weekly files with a timestamp in the filename. For each catalog, we ping the remote site and pull the most-recently updated file, renaming it to our local latest.csv. Be sure to have pg user/pass...
[ "Here", "we", "connect", "to", "the", "coriell", "sftp", "server", "using", "private", "connection", "details", ".", "They", "dump", "bi", "-", "weekly", "files", "with", "a", "timestamp", "in", "the", "filename", ".", "For", "each", "catalog", "we", "ping...
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Coriell.py#L150-L224
18,397
monarch-initiative/dipper
dipper/sources/Coriell.py
Coriell._process_collection
def _process_collection(self, collection_id, label, page): """ This function will process the data supplied internally about the repository from Coriell. Triples: Repository a ERO:collection rdf:label Literal(label) foaf:page Literal(page) :p...
python
def _process_collection(self, collection_id, label, page): """ This function will process the data supplied internally about the repository from Coriell. Triples: Repository a ERO:collection rdf:label Literal(label) foaf:page Literal(page) :p...
[ "def", "_process_collection", "(", "self", ",", "collection_id", ",", "label", ",", "page", ")", ":", "# ############# BUILD THE CELL LINE REPOSITORY #############", "for", "graph", "in", "[", "self", ".", "graph", ",", "self", ".", "testgraph", "]", ":", "#...
This function will process the data supplied internally about the repository from Coriell. Triples: Repository a ERO:collection rdf:label Literal(label) foaf:page Literal(page) :param collection_id: :param label: :param page: :return:
[ "This", "function", "will", "process", "the", "data", "supplied", "internally", "about", "the", "repository", "from", "Coriell", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Coriell.py#L760-L788
18,398
monarch-initiative/dipper
dipper/sources/FlyBase.py
FlyBase._process_genotypes
def _process_genotypes(self, limit): """ Add the genotype internal id to flybase mapping to the idhashmap. Also, add them as individuals to the graph. Triples created: <genotype id> a GENO:intrinsic_genotype <genotype id> rdfs:label "<gvc> [bkgd]" :param limit: ...
python
def _process_genotypes(self, limit): """ Add the genotype internal id to flybase mapping to the idhashmap. Also, add them as individuals to the graph. Triples created: <genotype id> a GENO:intrinsic_genotype <genotype id> rdfs:label "<gvc> [bkgd]" :param limit: ...
[ "def", "_process_genotypes", "(", "self", ",", "limit", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "graph", ")", "line_counter", "=...
Add the genotype internal id to flybase mapping to the idhashmap. Also, add them as individuals to the graph. Triples created: <genotype id> a GENO:intrinsic_genotype <genotype id> rdfs:label "<gvc> [bkgd]" :param limit: :return:
[ "Add", "the", "genotype", "internal", "id", "to", "flybase", "mapping", "to", "the", "idhashmap", ".", "Also", "add", "them", "as", "individuals", "to", "the", "graph", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/FlyBase.py#L358-L423
18,399
monarch-initiative/dipper
dipper/sources/FlyBase.py
FlyBase._process_stocks
def _process_stocks(self, limit): """ Stock definitions. Here we instantiate them as instances of the given taxon. :param limit: :return: """ if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model...
python
def _process_stocks(self, limit): """ Stock definitions. Here we instantiate them as instances of the given taxon. :param limit: :return: """ if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model...
[ "def", "_process_stocks", "(", "self", ",", "limit", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "model", "=", "Model", "(", "graph", ")", "line_counter", "=", ...
Stock definitions. Here we instantiate them as instances of the given taxon. :param limit: :return:
[ "Stock", "definitions", ".", "Here", "we", "instantiate", "them", "as", "instances", "of", "the", "given", "taxon", "." ]
24cc80db355bbe15776edc5c7b41e0886959ba41
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/FlyBase.py#L426-L480