repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
dustin/twitty-twister
twittytwister/twitter.py
Twitter.__clientDefer
def __clientDefer(self, c): """Return a deferred for a HTTP client, after handling incoming headers""" def handle_headers(r): self.gotHeaders(c.response_headers) return r return c.deferred.addBoth(handle_headers)
python
def __clientDefer(self, c): """Return a deferred for a HTTP client, after handling incoming headers""" def handle_headers(r): self.gotHeaders(c.response_headers) return r return c.deferred.addBoth(handle_headers)
[ "def", "__clientDefer", "(", "self", ",", "c", ")", ":", "def", "handle_headers", "(", "r", ")", ":", "self", ".", "gotHeaders", "(", "c", ".", "response_headers", ")", "return", "r", "return", "c", ".", "deferred", ".", "addBoth", "(", "handle_headers",...
Return a deferred for a HTTP client, after handling incoming headers
[ "Return", "a", "deferred", "for", "a", "HTTP", "client", "after", "handling", "incoming", "headers" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L231-L237
dustin/twitty-twister
twittytwister/twitter.py
Twitter.__doDownloadPage
def __doDownloadPage(self, *args, **kwargs): """Works like client.downloadPage(), but handle incoming headers """ logger.debug("download page: %r, %r", args, kwargs) return self.__clientDefer(downloadPage(*args, **kwargs))
python
def __doDownloadPage(self, *args, **kwargs): """Works like client.downloadPage(), but handle incoming headers """ logger.debug("download page: %r, %r", args, kwargs) return self.__clientDefer(downloadPage(*args, **kwargs))
[ "def", "__doDownloadPage", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "\"download page: %r, %r\"", ",", "args", ",", "kwargs", ")", "return", "self", ".", "__clientDefer", "(", "downloadPage", "(", "*", ...
Works like client.downloadPage(), but handle incoming headers
[ "Works", "like", "client", ".", "downloadPage", "()", "but", "handle", "incoming", "headers" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L271-L276
dustin/twitty-twister
twittytwister/twitter.py
Twitter.verify_credentials
def verify_credentials(self, delegate=None): "Verify a user's credentials." parser = txml.Users(delegate) return self.__downloadPage('/account/verify_credentials.xml', parser)
python
def verify_credentials(self, delegate=None): "Verify a user's credentials." parser = txml.Users(delegate) return self.__downloadPage('/account/verify_credentials.xml', parser)
[ "def", "verify_credentials", "(", "self", ",", "delegate", "=", "None", ")", ":", "parser", "=", "txml", ".", "Users", "(", "delegate", ")", "return", "self", ".", "__downloadPage", "(", "'/account/verify_credentials.xml'", ",", "parser", ")" ]
Verify a user's credentials.
[ "Verify", "a", "user", "s", "credentials", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L304-L307
dustin/twitty-twister
twittytwister/twitter.py
Twitter.update
def update(self, status, source=None, params={}): "Update your status. Returns the ID of the new post." params = params.copy() params['status'] = status if source: params['source'] = source return self.__parsed_post(self.__post('/statuses/update.xml', params), ...
python
def update(self, status, source=None, params={}): "Update your status. Returns the ID of the new post." params = params.copy() params['status'] = status if source: params['source'] = source return self.__parsed_post(self.__post('/statuses/update.xml', params), ...
[ "def", "update", "(", "self", ",", "status", ",", "source", "=", "None", ",", "params", "=", "{", "}", ")", ":", "params", "=", "params", ".", "copy", "(", ")", "params", "[", "'status'", "]", "=", "status", "if", "source", ":", "params", "[", "'...
Update your status. Returns the ID of the new post.
[ "Update", "your", "status", ".", "Returns", "the", "ID", "of", "the", "new", "post", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L315-L322
dustin/twitty-twister
twittytwister/twitter.py
Twitter.retweet
def retweet(self, id, delegate): """Retweet a post Returns the retweet status info back to the given delegate """ parser = txml.Statuses(delegate) return self.__postPage('/statuses/retweet/%s.xml' % (id), parser)
python
def retweet(self, id, delegate): """Retweet a post Returns the retweet status info back to the given delegate """ parser = txml.Statuses(delegate) return self.__postPage('/statuses/retweet/%s.xml' % (id), parser)
[ "def", "retweet", "(", "self", ",", "id", ",", "delegate", ")", ":", "parser", "=", "txml", ".", "Statuses", "(", "delegate", ")", "return", "self", ".", "__postPage", "(", "'/statuses/retweet/%s.xml'", "%", "(", "id", ")", ",", "parser", ")" ]
Retweet a post Returns the retweet status info back to the given delegate
[ "Retweet", "a", "post" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L324-L330
dustin/twitty-twister
twittytwister/twitter.py
Twitter.friends
def friends(self, delegate, params={}, extra_args=None): """Get updates from friends. Calls the delgate once for each status object received.""" return self.__get('/statuses/friends_timeline.xml', delegate, params, txml.Statuses, extra_args=extra_args)
python
def friends(self, delegate, params={}, extra_args=None): """Get updates from friends. Calls the delgate once for each status object received.""" return self.__get('/statuses/friends_timeline.xml', delegate, params, txml.Statuses, extra_args=extra_args)
[ "def", "friends", "(", "self", ",", "delegate", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "return", "self", ".", "__get", "(", "'/statuses/friends_timeline.xml'", ",", "delegate", ",", "params", ",", "txml", ".", "Statuses", ...
Get updates from friends. Calls the delgate once for each status object received.
[ "Get", "updates", "from", "friends", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L332-L337
dustin/twitty-twister
twittytwister/twitter.py
Twitter.home_timeline
def home_timeline(self, delegate, params={}, extra_args=None): """Get updates from friends. Calls the delgate once for each status object received.""" return self.__get('/statuses/home_timeline.xml', delegate, params, txml.Statuses, extra_args=extra_args)
python
def home_timeline(self, delegate, params={}, extra_args=None): """Get updates from friends. Calls the delgate once for each status object received.""" return self.__get('/statuses/home_timeline.xml', delegate, params, txml.Statuses, extra_args=extra_args)
[ "def", "home_timeline", "(", "self", ",", "delegate", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "return", "self", ".", "__get", "(", "'/statuses/home_timeline.xml'", ",", "delegate", ",", "params", ",", "txml", ".", "Statuses"...
Get updates from friends. Calls the delgate once for each status object received.
[ "Get", "updates", "from", "friends", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L339-L344
dustin/twitty-twister
twittytwister/twitter.py
Twitter.user_timeline
def user_timeline(self, delegate, user=None, params={}, extra_args=None): """Get the most recent updates for a user. If no user is specified, the statuses for the authenticating user are returned. See search for example of how results are returned.""" if user: param...
python
def user_timeline(self, delegate, user=None, params={}, extra_args=None): """Get the most recent updates for a user. If no user is specified, the statuses for the authenticating user are returned. See search for example of how results are returned.""" if user: param...
[ "def", "user_timeline", "(", "self", ",", "delegate", ",", "user", "=", "None", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "if", "user", ":", "params", "[", "'id'", "]", "=", "user", "return", "self", ".", "__get", "(",...
Get the most recent updates for a user. If no user is specified, the statuses for the authenticating user are returned. See search for example of how results are returned.
[ "Get", "the", "most", "recent", "updates", "for", "a", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L350-L360
dustin/twitty-twister
twittytwister/twitter.py
Twitter.public_timeline
def public_timeline(self, delegate, params={}, extra_args=None): "Get the most recent public timeline." return self.__get('/statuses/public_timeline.atom', delegate, params, extra_args=extra_args)
python
def public_timeline(self, delegate, params={}, extra_args=None): "Get the most recent public timeline." return self.__get('/statuses/public_timeline.atom', delegate, params, extra_args=extra_args)
[ "def", "public_timeline", "(", "self", ",", "delegate", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "return", "self", ".", "__get", "(", "'/statuses/public_timeline.atom'", ",", "delegate", ",", "params", ",", "extra_args", "=", ...
Get the most recent public timeline.
[ "Get", "the", "most", "recent", "public", "timeline", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L367-L371
dustin/twitty-twister
twittytwister/twitter.py
Twitter.direct_messages
def direct_messages(self, delegate, params={}, extra_args=None): """Get direct messages for the authenticating user. Search results are returned one message at a time a DirectMessage objects""" return self.__get('/direct_messages.xml', delegate, params, txml.Di...
python
def direct_messages(self, delegate, params={}, extra_args=None): """Get direct messages for the authenticating user. Search results are returned one message at a time a DirectMessage objects""" return self.__get('/direct_messages.xml', delegate, params, txml.Di...
[ "def", "direct_messages", "(", "self", ",", "delegate", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "return", "self", ".", "__get", "(", "'/direct_messages.xml'", ",", "delegate", ",", "params", ",", "txml", ".", "Direct", ","...
Get direct messages for the authenticating user. Search results are returned one message at a time a DirectMessage objects
[ "Get", "direct", "messages", "for", "the", "authenticating", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L373-L379
dustin/twitty-twister
twittytwister/twitter.py
Twitter.send_direct_message
def send_direct_message(self, text, user=None, delegate=None, screen_name=None, user_id=None, params={}): """Send a direct message """ params = params.copy() if user is not None: params['user'] = user if user_id is not None: params['user_id'] = user_id ...
python
def send_direct_message(self, text, user=None, delegate=None, screen_name=None, user_id=None, params={}): """Send a direct message """ params = params.copy() if user is not None: params['user'] = user if user_id is not None: params['user_id'] = user_id ...
[ "def", "send_direct_message", "(", "self", ",", "text", ",", "user", "=", "None", ",", "delegate", "=", "None", ",", "screen_name", "=", "None", ",", "user_id", "=", "None", ",", "params", "=", "{", "}", ")", ":", "params", "=", "params", ".", "copy"...
Send a direct message
[ "Send", "a", "direct", "message" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L381-L393
dustin/twitty-twister
twittytwister/twitter.py
Twitter.replies
def replies(self, delegate, params={}, extra_args=None): """Get the most recent replies for the authenticating user. See search for example of how results are returned.""" return self.__get('/statuses/replies.atom', delegate, params, extra_args=extra_args)
python
def replies(self, delegate, params={}, extra_args=None): """Get the most recent replies for the authenticating user. See search for example of how results are returned.""" return self.__get('/statuses/replies.atom', delegate, params, extra_args=extra_args)
[ "def", "replies", "(", "self", ",", "delegate", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ")", ":", "return", "self", ".", "__get", "(", "'/statuses/replies.atom'", ",", "delegate", ",", "params", ",", "extra_args", "=", "extra_args", ...
Get the most recent replies for the authenticating user. See search for example of how results are returned.
[ "Get", "the", "most", "recent", "replies", "for", "the", "authenticating", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L395-L400
dustin/twitty-twister
twittytwister/twitter.py
Twitter.follow_user
def follow_user(self, user, delegate): """Follow the given user. Returns the user info back to the given delegate """ parser = txml.Users(delegate) return self.__postPage('/friendships/create/%s.xml' % (user), parser)
python
def follow_user(self, user, delegate): """Follow the given user. Returns the user info back to the given delegate """ parser = txml.Users(delegate) return self.__postPage('/friendships/create/%s.xml' % (user), parser)
[ "def", "follow_user", "(", "self", ",", "user", ",", "delegate", ")", ":", "parser", "=", "txml", ".", "Users", "(", "delegate", ")", "return", "self", ".", "__postPage", "(", "'/friendships/create/%s.xml'", "%", "(", "user", ")", ",", "parser", ")" ]
Follow the given user. Returns the user info back to the given delegate
[ "Follow", "the", "given", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L414-L420
dustin/twitty-twister
twittytwister/twitter.py
Twitter.unfollow_user
def unfollow_user(self, user, delegate): """Unfollow the given user. Returns the user info back to the given delegate """ parser = txml.Users(delegate) return self.__postPage('/friendships/destroy/%s.xml' % (user), parser)
python
def unfollow_user(self, user, delegate): """Unfollow the given user. Returns the user info back to the given delegate """ parser = txml.Users(delegate) return self.__postPage('/friendships/destroy/%s.xml' % (user), parser)
[ "def", "unfollow_user", "(", "self", ",", "user", ",", "delegate", ")", ":", "parser", "=", "txml", ".", "Users", "(", "delegate", ")", "return", "self", ".", "__postPage", "(", "'/friendships/destroy/%s.xml'", "%", "(", "user", ")", ",", "parser", ")" ]
Unfollow the given user. Returns the user info back to the given delegate
[ "Unfollow", "the", "given", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L422-L428
dustin/twitty-twister
twittytwister/twitter.py
Twitter.list_friends
def list_friends(self, delegate, user=None, params={}, extra_args=None, page_delegate=None): """Get the list of friends for a user. Calls the delegate with each user object found.""" if user: url = '/statuses/friends/' + user + '.xml' else: url = '/statuses/frien...
python
def list_friends(self, delegate, user=None, params={}, extra_args=None, page_delegate=None): """Get the list of friends for a user. Calls the delegate with each user object found.""" if user: url = '/statuses/friends/' + user + '.xml' else: url = '/statuses/frien...
[ "def", "list_friends", "(", "self", ",", "delegate", ",", "user", "=", "None", ",", "params", "=", "{", "}", ",", "extra_args", "=", "None", ",", "page_delegate", "=", "None", ")", ":", "if", "user", ":", "url", "=", "'/statuses/friends/'", "+", "user"...
Get the list of friends for a user. Calls the delegate with each user object found.
[ "Get", "the", "list", "of", "friends", "for", "a", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L457-L466
dustin/twitty-twister
twittytwister/twitter.py
Twitter.show_user
def show_user(self, user): """Get the info for a specific user. Returns a delegate that will receive the user in a callback.""" url = '/users/show/%s.xml' % (user) d = defer.Deferred() self.__downloadPage(url, txml.Users(lambda u: d.callback(u))) \ .addErrback(lamb...
python
def show_user(self, user): """Get the info for a specific user. Returns a delegate that will receive the user in a callback.""" url = '/users/show/%s.xml' % (user) d = defer.Deferred() self.__downloadPage(url, txml.Users(lambda u: d.callback(u))) \ .addErrback(lamb...
[ "def", "show_user", "(", "self", ",", "user", ")", ":", "url", "=", "'/users/show/%s.xml'", "%", "(", "user", ")", "d", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "__downloadPage", "(", "url", ",", "txml", ".", "Users", "(", "lambda", "u",...
Get the info for a specific user. Returns a delegate that will receive the user in a callback.
[ "Get", "the", "info", "for", "a", "specific", "user", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L488-L499
dustin/twitty-twister
twittytwister/twitter.py
Twitter.search
def search(self, query, delegate, args=None, extra_args=None): """Perform a search query. Results are given one at a time to the delegate. An example delegate may look like this: def exampleDelegate(entry): print entry.title""" if args is None: args = {...
python
def search(self, query, delegate, args=None, extra_args=None): """Perform a search query. Results are given one at a time to the delegate. An example delegate may look like this: def exampleDelegate(entry): print entry.title""" if args is None: args = {...
[ "def", "search", "(", "self", ",", "query", ",", "delegate", ",", "args", "=", "None", ",", "extra_args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "{", "}", "args", "[", "'q'", "]", "=", "query", "return", "self", ".",...
Perform a search query. Results are given one at a time to the delegate. An example delegate may look like this: def exampleDelegate(entry): print entry.title
[ "Perform", "a", "search", "query", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L501-L513
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor.startService
def startService(self): """ Start the service. This causes a transition to the C{'idle'} state, and then calls L{connect} to attempt an initial conection. """ service.Service.startService(self) self._toState('idle') try: self.connect() ...
python
def startService(self): """ Start the service. This causes a transition to the C{'idle'} state, and then calls L{connect} to attempt an initial conection. """ service.Service.startService(self) self._toState('idle') try: self.connect() ...
[ "def", "startService", "(", "self", ")", ":", "service", ".", "Service", ".", "startService", "(", "self", ")", "self", ".", "_toState", "(", "'idle'", ")", "try", ":", "self", ".", "connect", "(", ")", "except", "NoConsumerError", ":", "pass" ]
Start the service. This causes a transition to the C{'idle'} state, and then calls L{connect} to attempt an initial conection.
[ "Start", "the", "service", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L880-L893
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor.connect
def connect(self, forceReconnect=False): """ Check current conditions and initiate connection if possible. This is called to check preconditions for starting a new connection, and initating the connection itself. If the service is not running, this will do nothing. @pa...
python
def connect(self, forceReconnect=False): """ Check current conditions and initiate connection if possible. This is called to check preconditions for starting a new connection, and initating the connection itself. If the service is not running, this will do nothing. @pa...
[ "def", "connect", "(", "self", ",", "forceReconnect", "=", "False", ")", ":", "if", "self", ".", "_state", "==", "'stopped'", ":", "raise", "Error", "(", "\"This service is not running. Not connecting.\"", ")", "if", "self", ".", "_state", "==", "'connected'", ...
Check current conditions and initiate connection if possible. This is called to check preconditions for starting a new connection, and initating the connection itself. If the service is not running, this will do nothing. @param forceReconnect: Drop an existing connection to reconnnect...
[ "Check", "current", "conditions", "and", "initiate", "connection", "if", "possible", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L906-L958
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor.makeConnection
def makeConnection(self, protocol): """ Called when the connection has been established. This method is called when an HTTP 200 response has been received, with the protocol that decodes the individual Twitter stream elements. That protocol will call the consumer for all Twitter...
python
def makeConnection(self, protocol): """ Called when the connection has been established. This method is called when an HTTP 200 response has been received, with the protocol that decodes the individual Twitter stream elements. That protocol will call the consumer for all Twitter...
[ "def", "makeConnection", "(", "self", ",", "protocol", ")", ":", "self", ".", "_errorState", "=", "None", "def", "cb", "(", "result", ")", ":", "self", ".", "protocol", "=", "None", "if", "self", ".", "_state", "==", "'stopped'", ":", "# Don't transition...
Called when the connection has been established. This method is called when an HTTP 200 response has been received, with the protocol that decodes the individual Twitter stream elements. That protocol will call the consumer for all Twitter entries received. The protocol, stored in L{pr...
[ "Called", "when", "the", "connection", "has", "been", "established", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L969-L1000
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._reconnect
def _reconnect(self, errorState): """ Attempt to reconnect. If the current back-off delay is 0, L{connect} is called. Otherwise, it will cause a transition to the C{'waiting'} state, ultimately causing a call to L{connect} when the delay expires. """ def connect(...
python
def _reconnect(self, errorState): """ Attempt to reconnect. If the current back-off delay is 0, L{connect} is called. Otherwise, it will cause a transition to the C{'waiting'} state, ultimately causing a call to L{connect} when the delay expires. """ def connect(...
[ "def", "_reconnect", "(", "self", ",", "errorState", ")", ":", "def", "connect", "(", ")", ":", "if", "self", ".", "noisy", ":", "log", ".", "msg", "(", "\"Reconnecting now.\"", ")", "self", ".", "connect", "(", ")", "backOff", "=", "self", ".", "bac...
Attempt to reconnect. If the current back-off delay is 0, L{connect} is called. Otherwise, it will cause a transition to the C{'waiting'} state, ultimately causing a call to L{connect} when the delay expires.
[ "Attempt", "to", "reconnect", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1003-L1029
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._toState
def _toState(self, state, *args, **kwargs): """ Transition to the next state. @param state: Name of the next state. """ try: method = getattr(self, '_state_%s' % state) except AttributeError: raise ValueError("No such state %r" % state) l...
python
def _toState(self, state, *args, **kwargs): """ Transition to the next state. @param state: Name of the next state. """ try: method = getattr(self, '_state_%s' % state) except AttributeError: raise ValueError("No such state %r" % state) l...
[ "def", "_toState", "(", "self", ",", "state", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "method", "=", "getattr", "(", "self", ",", "'_state_%s'", "%", "state", ")", "except", "AttributeError", ":", "raise", "ValueError", "(", ...
Transition to the next state. @param state: Name of the next state.
[ "Transition", "to", "the", "next", "state", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1032-L1045
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._state_stopped
def _state_stopped(self): """ The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect. """ if self._reconnectDelayedCall:...
python
def _state_stopped(self): """ The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect. """ if self._reconnectDelayedCall:...
[ "def", "_state_stopped", "(", "self", ")", ":", "if", "self", ".", "_reconnectDelayedCall", ":", "self", ".", "_reconnectDelayedCall", ".", "cancel", "(", ")", "self", ".", "_reconnectDelayedCall", "=", "None", "self", ".", "loseConnection", "(", ")" ]
The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect.
[ "The", "service", "is", "not", "running", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1048-L1059
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._state_connecting
def _state_connecting(self): """ A connection is being started. A succesful attempt results in the state C{'connected'} when the first response from Twitter has been received. Transitioning to the state C{'aborting'} will cause an immediate disconnect instead, by transit...
python
def _state_connecting(self): """ A connection is being started. A succesful attempt results in the state C{'connected'} when the first response from Twitter has been received. Transitioning to the state C{'aborting'} will cause an immediate disconnect instead, by transit...
[ "def", "_state_connecting", "(", "self", ")", ":", "def", "responseReceived", "(", "protocol", ")", ":", "self", ".", "makeConnection", "(", "protocol", ")", "if", "self", ".", "_state", "==", "'aborting'", ":", "self", ".", "_toState", "(", "'disconnecting'...
A connection is being started. A succesful attempt results in the state C{'connected'} when the first response from Twitter has been received. Transitioning to the state C{'aborting'} will cause an immediate disconnect instead, by transitioning to C{'disconnecting'}. Errors wil...
[ "A", "connection", "is", "being", "started", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1081-L1114
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._state_error
def _state_error(self, reason): """ The connection attempt resulted in an error. Attempt a reconnect with a back-off algorithm. """ log.err(reason) def matchException(failure): for errorState, backOff in self.backOffs.iteritems(): if 'errorTy...
python
def _state_error(self, reason): """ The connection attempt resulted in an error. Attempt a reconnect with a back-off algorithm. """ log.err(reason) def matchException(failure): for errorState, backOff in self.backOffs.iteritems(): if 'errorTy...
[ "def", "_state_error", "(", "self", ",", "reason", ")", ":", "log", ".", "err", "(", "reason", ")", "def", "matchException", "(", "failure", ")", ":", "for", "errorState", ",", "backOff", "in", "self", ".", "backOffs", ".", "iteritems", "(", ")", ":", ...
The connection attempt resulted in an error. Attempt a reconnect with a back-off algorithm.
[ "The", "connection", "attempt", "resulted", "in", "an", "error", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1168-L1186
dustin/twitty-twister
twittytwister/streaming.py
LengthDelimitedStream.lineReceived
def lineReceived(self, line): """ Called when a line is received. We expect a length in bytes or an empty line for keep-alive. If we got a length, switch to raw mode to receive that amount of bytes. """ if line and line.isdigit(): self._expectedLength = int(l...
python
def lineReceived(self, line): """ Called when a line is received. We expect a length in bytes or an empty line for keep-alive. If we got a length, switch to raw mode to receive that amount of bytes. """ if line and line.isdigit(): self._expectedLength = int(l...
[ "def", "lineReceived", "(", "self", ",", "line", ")", ":", "if", "line", "and", "line", ".", "isdigit", "(", ")", ":", "self", ".", "_expectedLength", "=", "int", "(", "line", ")", "self", ".", "_rawBuffer", "=", "[", "]", "self", ".", "_rawBufferLen...
Called when a line is received. We expect a length in bytes or an empty line for keep-alive. If we got a length, switch to raw mode to receive that amount of bytes.
[ "Called", "when", "a", "line", "is", "received", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/streaming.py#L35-L48
dustin/twitty-twister
twittytwister/streaming.py
LengthDelimitedStream.rawDataReceived
def rawDataReceived(self, data): """ Called when raw data is received. Fill the raw buffer C{_rawBuffer} until we have received at least C{_expectedLength} bytes. Call C{datagramReceived} with the received byte string of the expected size. Then switch back to line mode with ...
python
def rawDataReceived(self, data): """ Called when raw data is received. Fill the raw buffer C{_rawBuffer} until we have received at least C{_expectedLength} bytes. Call C{datagramReceived} with the received byte string of the expected size. Then switch back to line mode with ...
[ "def", "rawDataReceived", "(", "self", ",", "data", ")", ":", "self", ".", "_rawBuffer", ".", "append", "(", "data", ")", "self", ".", "_rawBufferLength", "+=", "len", "(", "data", ")", "if", "self", ".", "_rawBufferLength", ">=", "self", ".", "_expected...
Called when raw data is received. Fill the raw buffer C{_rawBuffer} until we have received at least C{_expectedLength} bytes. Call C{datagramReceived} with the received byte string of the expected size. Then switch back to line mode with the remainder of the buffer.
[ "Called", "when", "raw", "data", "is", "received", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/streaming.py#L51-L73
dustin/twitty-twister
twittytwister/streaming.py
TwitterObject.fromDict
def fromDict(cls, data): """ Fill this objects attributes from a dict for known properties. """ obj = cls() obj.raw = data for name, value in data.iteritems(): if cls.SIMPLE_PROPS and name in cls.SIMPLE_PROPS: setattr(obj, name, value) ...
python
def fromDict(cls, data): """ Fill this objects attributes from a dict for known properties. """ obj = cls() obj.raw = data for name, value in data.iteritems(): if cls.SIMPLE_PROPS and name in cls.SIMPLE_PROPS: setattr(obj, name, value) ...
[ "def", "fromDict", "(", "cls", ",", "data", ")", ":", "obj", "=", "cls", "(", ")", "obj", ".", "raw", "=", "data", "for", "name", ",", "value", "in", "data", ".", "iteritems", "(", ")", ":", "if", "cls", ".", "SIMPLE_PROPS", "and", "name", "in", ...
Fill this objects attributes from a dict for known properties.
[ "Fill", "this", "objects", "attributes", "from", "a", "dict", "for", "known", "properties", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/streaming.py#L102-L119
dustin/twitty-twister
twittytwister/streaming.py
TwitterStream.datagramReceived
def datagramReceived(self, data): """ Decode the JSON-encoded datagram and call the callback. """ try: obj = json.loads(data) except ValueError, e: log.err(e, 'Invalid JSON in stream: %r' % data) return if u'text' in obj: o...
python
def datagramReceived(self, data): """ Decode the JSON-encoded datagram and call the callback. """ try: obj = json.loads(data) except ValueError, e: log.err(e, 'Invalid JSON in stream: %r' % data) return if u'text' in obj: o...
[ "def", "datagramReceived", "(", "self", ",", "data", ")", ":", "try", ":", "obj", "=", "json", ".", "loads", "(", "data", ")", "except", "ValueError", ",", "e", ":", "log", ".", "err", "(", "e", ",", "'Invalid JSON in stream: %r'", "%", "data", ")", ...
Decode the JSON-encoded datagram and call the callback.
[ "Decode", "the", "JSON", "-", "encoded", "datagram", "and", "call", "the", "callback", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/streaming.py#L306-L322
dustin/twitty-twister
twittytwister/streaming.py
TwitterStream.connectionLost
def connectionLost(self, reason): """ Called when the body is complete or the connection was lost. @note: As the body length is usually not known at the beginning of the response we expect a L{PotentialDataLoss} when Twitter closes the stream, instead of L{ResponseDone}. Other e...
python
def connectionLost(self, reason): """ Called when the body is complete or the connection was lost. @note: As the body length is usually not known at the beginning of the response we expect a L{PotentialDataLoss} when Twitter closes the stream, instead of L{ResponseDone}. Other e...
[ "def", "connectionLost", "(", "self", ",", "reason", ")", ":", "self", ".", "setTimeout", "(", "None", ")", "if", "reason", ".", "check", "(", "ResponseDone", ",", "PotentialDataLoss", ")", ":", "self", ".", "deferred", ".", "callback", "(", "None", ")",...
Called when the body is complete or the connection was lost. @note: As the body length is usually not known at the beginning of the response we expect a L{PotentialDataLoss} when Twitter closes the stream, instead of L{ResponseDone}. Other exceptions are treated as error conditions.
[ "Called", "when", "the", "body", "is", "complete", "or", "the", "connection", "was", "lost", "." ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/streaming.py#L325-L338
dustin/twitty-twister
twittytwister/txml.py
simpleListFactory
def simpleListFactory(list_type): """Used for simple parsers that support only one type of object""" def create(delegate, extra_args=None): """Create a Parser object for the specific tag type, on the fly""" return listParser(list_type, delegate, extra_args) return create
python
def simpleListFactory(list_type): """Used for simple parsers that support only one type of object""" def create(delegate, extra_args=None): """Create a Parser object for the specific tag type, on the fly""" return listParser(list_type, delegate, extra_args) return create
[ "def", "simpleListFactory", "(", "list_type", ")", ":", "def", "create", "(", "delegate", ",", "extra_args", "=", "None", ")", ":", "\"\"\"Create a Parser object for the specific tag type, on the fly\"\"\"", "return", "listParser", "(", "list_type", ",", "delegate", ","...
Used for simple parsers that support only one type of object
[ "Used", "for", "simple", "parsers", "that", "support", "only", "one", "type", "of", "object" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/txml.py#L305-L310
dustin/twitty-twister
twittytwister/txml.py
BaseXMLHandler.setSubDelegates
def setSubDelegates(self, namelist, before=None, after=None): """Set a delegate for a sub-sub-item, according to a list of names""" if len(namelist) > 1: def set_sub(i): i.setSubDelegates(namelist[1:], before, after) self.setBeforeDelegate(namelist[0], set_sub) ...
python
def setSubDelegates(self, namelist, before=None, after=None): """Set a delegate for a sub-sub-item, according to a list of names""" if len(namelist) > 1: def set_sub(i): i.setSubDelegates(namelist[1:], before, after) self.setBeforeDelegate(namelist[0], set_sub) ...
[ "def", "setSubDelegates", "(", "self", ",", "namelist", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "if", "len", "(", "namelist", ")", ">", "1", ":", "def", "set_sub", "(", "i", ")", ":", "i", ".", "setSubDelegates", "(", "name...
Set a delegate for a sub-sub-item, according to a list of names
[ "Set", "a", "delegate", "for", "a", "sub", "-", "sub", "-", "item", "according", "to", "a", "list", "of", "names" ]
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/txml.py#L48-L55
jupyter/jupyter-drive
jupyterdrive/mixednbmanager.py
_split_path
def _split_path(path): """split a path return by the api return - the sentinel: - the rest of the path as a list. - the original path stripped of / for normalisation. """ path = path.strip('/') list_path = path.split('/') sentinel = list_path.pop(0) return sentinel, ...
python
def _split_path(path): """split a path return by the api return - the sentinel: - the rest of the path as a list. - the original path stripped of / for normalisation. """ path = path.strip('/') list_path = path.split('/') sentinel = list_path.pop(0) return sentinel, ...
[ "def", "_split_path", "(", "path", ")", ":", "path", "=", "path", ".", "strip", "(", "'/'", ")", "list_path", "=", "path", ".", "split", "(", "'/'", ")", "sentinel", "=", "list_path", ".", "pop", "(", "0", ")", "return", "sentinel", ",", "list_path",...
split a path return by the api return - the sentinel: - the rest of the path as a list. - the original path stripped of / for normalisation.
[ "split", "a", "path", "return", "by", "the", "api" ]
train
https://github.com/jupyter/jupyter-drive/blob/545813377cb901235e8ea81f83b0ac7755dbd7a9/jupyterdrive/mixednbmanager.py#L21-L32
jupyter/jupyter-drive
jupyterdrive/mixednbmanager.py
MixedContentsManager.path_dispatch_rename
def path_dispatch_rename(rename_like_method): """ decorator for rename-like function, that need dispatch on 2 arguments """ def _wrapper_method(self, old_path, new_path): old_path, _old_path, old_sentinel = _split_path(old_path); new_path, _new_path, new_sentine...
python
def path_dispatch_rename(rename_like_method): """ decorator for rename-like function, that need dispatch on 2 arguments """ def _wrapper_method(self, old_path, new_path): old_path, _old_path, old_sentinel = _split_path(old_path); new_path, _new_path, new_sentine...
[ "def", "path_dispatch_rename", "(", "rename_like_method", ")", ":", "def", "_wrapper_method", "(", "self", ",", "old_path", ",", "new_path", ")", ":", "old_path", ",", "_old_path", ",", "old_sentinel", "=", "_split_path", "(", "old_path", ")", "new_path", ",", ...
decorator for rename-like function, that need dispatch on 2 arguments
[ "decorator", "for", "rename", "-", "like", "function", "that", "need", "dispatch", "on", "2", "arguments" ]
train
https://github.com/jupyter/jupyter-drive/blob/545813377cb901235e8ea81f83b0ac7755dbd7a9/jupyterdrive/mixednbmanager.py#L186-L208
jupyter/jupyter-drive
jupyterdrive/__init__.py
deactivate
def deactivate(profile='default'): """should be a matter of just unsetting the above keys """ with jconfig(profile) as config: deact = True; if not getattr(config.NotebookApp.contents_manager_class, 'startswith',lambda x:False)('jupyterdrive'): deact=False if 'gdrive' not...
python
def deactivate(profile='default'): """should be a matter of just unsetting the above keys """ with jconfig(profile) as config: deact = True; if not getattr(config.NotebookApp.contents_manager_class, 'startswith',lambda x:False)('jupyterdrive'): deact=False if 'gdrive' not...
[ "def", "deactivate", "(", "profile", "=", "'default'", ")", ":", "with", "jconfig", "(", "profile", ")", "as", "config", ":", "deact", "=", "True", "if", "not", "getattr", "(", "config", ".", "NotebookApp", ".", "contents_manager_class", ",", "'startswith'",...
should be a matter of just unsetting the above keys
[ "should", "be", "a", "matter", "of", "just", "unsetting", "the", "above", "keys" ]
train
https://github.com/jupyter/jupyter-drive/blob/545813377cb901235e8ea81f83b0ac7755dbd7a9/jupyterdrive/__init__.py#L111-L122
klavinslab/coral
coral/analysis/utils.py
sequence_type
def sequence_type(seq): '''Validates a coral.sequence data type. :param sequence_in: input DNA sequence. :type sequence_in: any :returns: The material - 'dna', 'rna', or 'peptide'. :rtype: str :raises: ValueError ''' if isinstance(seq, coral.DNA): material = 'dna' elif isin...
python
def sequence_type(seq): '''Validates a coral.sequence data type. :param sequence_in: input DNA sequence. :type sequence_in: any :returns: The material - 'dna', 'rna', or 'peptide'. :rtype: str :raises: ValueError ''' if isinstance(seq, coral.DNA): material = 'dna' elif isin...
[ "def", "sequence_type", "(", "seq", ")", ":", "if", "isinstance", "(", "seq", ",", "coral", ".", "DNA", ")", ":", "material", "=", "'dna'", "elif", "isinstance", "(", "seq", ",", "coral", ".", "RNA", ")", ":", "material", "=", "'rna'", "elif", "isins...
Validates a coral.sequence data type. :param sequence_in: input DNA sequence. :type sequence_in: any :returns: The material - 'dna', 'rna', or 'peptide'. :rtype: str :raises: ValueError
[ "Validates", "a", "coral", ".", "sequence", "data", "type", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/utils.py#L5-L23
klavinslab/coral
coral/reaction/_pcr.py
pcr
def pcr(template, primer1, primer2, min_tm=50.0, min_primer_len=14): '''Simulate a PCR. :param template: DNA template from which to PCR. :type template: coral.DNA :param primer1: First PCR primer. :type primer1: coral.Primer :param primer2: First PCR primer. :type primer2: coral.Primer ...
python
def pcr(template, primer1, primer2, min_tm=50.0, min_primer_len=14): '''Simulate a PCR. :param template: DNA template from which to PCR. :type template: coral.DNA :param primer1: First PCR primer. :type primer1: coral.Primer :param primer2: First PCR primer. :type primer2: coral.Primer ...
[ "def", "pcr", "(", "template", ",", "primer1", ",", "primer2", ",", "min_tm", "=", "50.0", ",", "min_primer_len", "=", "14", ")", ":", "# Find match in top or bottom strands for each primer", "p1_matches", "=", "coral", ".", "analysis", ".", "anneal", "(", "temp...
Simulate a PCR. :param template: DNA template from which to PCR. :type template: coral.DNA :param primer1: First PCR primer. :type primer1: coral.Primer :param primer2: First PCR primer. :type primer2: coral.Primer :param min_tm: Minimum melting temperature (Tm) at which primers must bind ...
[ "Simulate", "a", "PCR", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/reaction/_pcr.py#L9-L161
klavinslab/coral
coral/reaction/_restriction.py
digest
def digest(dna, restriction_enzyme): '''Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :rtype: coral.DNA list ...
python
def digest(dna, restriction_enzyme): '''Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :rtype: coral.DNA list ...
[ "def", "digest", "(", "dna", ",", "restriction_enzyme", ")", ":", "pattern", "=", "restriction_enzyme", ".", "recognition_site", "located", "=", "dna", ".", "locate", "(", "pattern", ")", "if", "not", "located", "[", "0", "]", "and", "not", "located", "[",...
Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :rtype: coral.DNA list
[ "Restriction", "endonuclease", "reaction", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/reaction/_restriction.py#L5-L42
klavinslab/coral
coral/reaction/_restriction.py
_cut
def _cut(dna, index, restriction_enzyme): '''Cuts template once at the specified index. :param dna: DNA to cut :type dna: coral.DNA :param index: index at which to cut :type index: int :param restriction_enzyme: Enzyme with which to cut :type restriction_enzyme: coral.RestrictionSite :r...
python
def _cut(dna, index, restriction_enzyme): '''Cuts template once at the specified index. :param dna: DNA to cut :type dna: coral.DNA :param index: index at which to cut :type index: int :param restriction_enzyme: Enzyme with which to cut :type restriction_enzyme: coral.RestrictionSite :r...
[ "def", "_cut", "(", "dna", ",", "index", ",", "restriction_enzyme", ")", ":", "# TODO: handle case where cut site is outside of recognition sequence,", "# for both circular and linear cases where site is at index 0", "# Find absolute indices at which to cut", "cut_site", "=", "restrict...
Cuts template once at the specified index. :param dna: DNA to cut :type dna: coral.DNA :param index: index at which to cut :type index: int :param restriction_enzyme: Enzyme with which to cut :type restriction_enzyme: coral.RestrictionSite :returns: 2-element list of digested sequence, incl...
[ "Cuts", "template", "once", "at", "the", "specified", "index", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/reaction/_restriction.py#L45-L86
klavinslab/coral
bin/ipynb2rst.py
ipynb_to_rst
def ipynb_to_rst(directory, filename): """Converts a given file in a directory to an rst in the same directory.""" print(filename) os.chdir(directory) subprocess.Popen(["ipython", "nbconvert", "--to", "rst", filename], stdout=subprocess.PIPE, ...
python
def ipynb_to_rst(directory, filename): """Converts a given file in a directory to an rst in the same directory.""" print(filename) os.chdir(directory) subprocess.Popen(["ipython", "nbconvert", "--to", "rst", filename], stdout=subprocess.PIPE, ...
[ "def", "ipynb_to_rst", "(", "directory", ",", "filename", ")", ":", "print", "(", "filename", ")", "os", ".", "chdir", "(", "directory", ")", "subprocess", ".", "Popen", "(", "[", "\"ipython\"", ",", "\"nbconvert\"", ",", "\"--to\"", ",", "\"rst\"", ",", ...
Converts a given file in a directory to an rst in the same directory.
[ "Converts", "a", "given", "file", "in", "a", "directory", "to", "an", "rst", "in", "the", "same", "directory", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/bin/ipynb2rst.py#L13-L21
klavinslab/coral
bin/ipynb2rst.py
convert_ipynbs
def convert_ipynbs(directory): """Recursively converts all ipynb files in a directory into rst files in the same directory.""" # The ipython_examples dir has to be in the same dir as this script for root, subfolders, files in os.walk(os.path.abspath(directory)): for f in files: if "....
python
def convert_ipynbs(directory): """Recursively converts all ipynb files in a directory into rst files in the same directory.""" # The ipython_examples dir has to be in the same dir as this script for root, subfolders, files in os.walk(os.path.abspath(directory)): for f in files: if "....
[ "def", "convert_ipynbs", "(", "directory", ")", ":", "# The ipython_examples dir has to be in the same dir as this script", "for", "root", ",", "subfolders", ",", "files", "in", "os", ".", "walk", "(", "os", ".", "path", ".", "abspath", "(", "directory", ")", ")",...
Recursively converts all ipynb files in a directory into rst files in the same directory.
[ "Recursively", "converts", "all", "ipynb", "files", "in", "a", "directory", "into", "rst", "files", "in", "the", "same", "directory", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/bin/ipynb2rst.py#L24-L32
klavinslab/coral
coral/analysis/_structure/structure_windows.py
_context_walk
def _context_walk(dna, window_size, context_len, step): '''Generate context-dependent 'non-boundedness' scores for a DNA sequence. :param dna: Sequence to score. :type dna: coral.DNA :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bases of...
python
def _context_walk(dna, window_size, context_len, step): '''Generate context-dependent 'non-boundedness' scores for a DNA sequence. :param dna: Sequence to score. :type dna: coral.DNA :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bases of...
[ "def", "_context_walk", "(", "dna", ",", "window_size", ",", "context_len", ",", "step", ")", ":", "# Generate window indices", "window_start_ceiling", "=", "len", "(", "dna", ")", "-", "context_len", "-", "window_size", "window_starts", "=", "range", "(", "cont...
Generate context-dependent 'non-boundedness' scores for a DNA sequence. :param dna: Sequence to score. :type dna: coral.DNA :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bases of context to use when analyzing each win...
[ "Generate", "context", "-", "dependent", "non", "-", "boundedness", "scores", "for", "a", "DNA", "sequence", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/structure_windows.py#L56-L98
klavinslab/coral
coral/analysis/_structure/structure_windows.py
StructureWindows.windows
def windows(self, window_size=60, context_len=90, step=10): '''Walk through the sequence of interest in windows of window_size, evaluate free (unbound) pair probabilities. :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bas...
python
def windows(self, window_size=60, context_len=90, step=10): '''Walk through the sequence of interest in windows of window_size, evaluate free (unbound) pair probabilities. :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bas...
[ "def", "windows", "(", "self", ",", "window_size", "=", "60", ",", "context_len", "=", "90", ",", "step", "=", "10", ")", ":", "self", ".", "walked", "=", "_context_walk", "(", "self", ".", "template", ",", "window_size", ",", "context_len", ",", "step...
Walk through the sequence of interest in windows of window_size, evaluate free (unbound) pair probabilities. :param window_size: Window size in base pairs. :type window_size: int :param context_len: The number of bases of context to use when analyzing each wi...
[ "Walk", "through", "the", "sequence", "of", "interest", "in", "windows", "of", "window_size", "evaluate", "free", "(", "unbound", ")", "pair", "probabilities", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/structure_windows.py#L20-L36
klavinslab/coral
coral/analysis/_structure/structure_windows.py
StructureWindows.plot
def plot(self): '''Plot the results of the run method.''' try: from matplotlib import pylab except ImportError: raise ImportError('Optional dependency matplotlib not installed.') if self.walked: fig = pylab.figure() ax1 = fig.add_subplot(1...
python
def plot(self): '''Plot the results of the run method.''' try: from matplotlib import pylab except ImportError: raise ImportError('Optional dependency matplotlib not installed.') if self.walked: fig = pylab.figure() ax1 = fig.add_subplot(1...
[ "def", "plot", "(", "self", ")", ":", "try", ":", "from", "matplotlib", "import", "pylab", "except", "ImportError", ":", "raise", "ImportError", "(", "'Optional dependency matplotlib not installed.'", ")", "if", "self", ".", "walked", ":", "fig", "=", "pylab", ...
Plot the results of the run method.
[ "Plot", "the", "results", "of", "the", "run", "method", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/structure_windows.py#L38-L53
klavinslab/coral
coral/analysis/_sequence/anneal.py
anneal
def anneal(template, primer, min_tm=50.0, min_len=10): '''Simulates a primer binding event. Will find the maximum subset of bases in the primer that binds to the template, including overhang sequences. **Note**: Primer binding locations indicate the 3' end of the primer, not the begining of the annealin...
python
def anneal(template, primer, min_tm=50.0, min_len=10): '''Simulates a primer binding event. Will find the maximum subset of bases in the primer that binds to the template, including overhang sequences. **Note**: Primer binding locations indicate the 3' end of the primer, not the begining of the annealin...
[ "def", "anneal", "(", "template", ",", "primer", ",", "min_tm", "=", "50.0", ",", "min_len", "=", "10", ")", ":", "# TODO: add possibility for primer basepair mismatch", "if", "len", "(", "primer", ")", "<", "min_len", ":", "msg", "=", "'Primer length is shorter...
Simulates a primer binding event. Will find the maximum subset of bases in the primer that binds to the template, including overhang sequences. **Note**: Primer binding locations indicate the 3' end of the primer, not the begining of the annealing sequence. :param template: DNA template for which to bi...
[ "Simulates", "a", "primer", "binding", "event", ".", "Will", "find", "the", "maximum", "subset", "of", "bases", "in", "the", "primer", "that", "binds", "to", "the", "template", "including", "overhang", "sequences", ".", "**", "Note", "**", ":", "Primer", "...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequence/anneal.py#L12-L160
klavinslab/coral
coral/design/_primers.py
primer
def primer(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=None, structure=False): '''Design primer to a nearest-neighbor Tm setpoint. :param dna: Sequence for which to design a primer. :type dna: coral.DNA :param tm: Ideal ...
python
def primer(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=None, structure=False): '''Design primer to a nearest-neighbor Tm setpoint. :param dna: Sequence for which to design a primer. :type dna: coral.DNA :param tm: Ideal ...
[ "def", "primer", "(", "dna", ",", "tm", "=", "65", ",", "min_len", "=", "10", ",", "tm_undershoot", "=", "1", ",", "tm_overshoot", "=", "3", ",", "end_gc", "=", "False", ",", "tm_parameters", "=", "'cloning'", ",", "overhang", "=", "None", ",", "stru...
Design primer to a nearest-neighbor Tm setpoint. :param dna: Sequence for which to design a primer. :type dna: coral.DNA :param tm: Ideal primer Tm in degrees C. :type tm: float :param min_len: Minimum primer length. :type min_len: int :param tm_undershoot: Allowed Tm undershoot. :type ...
[ "Design", "primer", "to", "a", "nearest", "-", "neighbor", "Tm", "setpoint", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_primers.py#L6-L98
klavinslab/coral
coral/design/_primers.py
primers
def primers(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhangs=None, structure=False): '''Design primers for PCR amplifying any arbitrary sequence. :param dna: Input sequence. :type dna: coral.DNA :param tm: Ideal primer Tm ...
python
def primers(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhangs=None, structure=False): '''Design primers for PCR amplifying any arbitrary sequence. :param dna: Input sequence. :type dna: coral.DNA :param tm: Ideal primer Tm ...
[ "def", "primers", "(", "dna", ",", "tm", "=", "65", ",", "min_len", "=", "10", ",", "tm_undershoot", "=", "1", ",", "tm_overshoot", "=", "3", ",", "end_gc", "=", "False", ",", "tm_parameters", "=", "'cloning'", ",", "overhangs", "=", "None", ",", "st...
Design primers for PCR amplifying any arbitrary sequence. :param dna: Input sequence. :type dna: coral.DNA :param tm: Ideal primer Tm in degrees C. :type tm: float :param min_len: Minimum primer length. :type min_len: int :param tm_undershoot: Allowed Tm undershoot. :type tm_undershoot:...
[ "Design", "primers", "for", "PCR", "amplifying", "any", "arbitrary", "sequence", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_primers.py#L101-L140
klavinslab/coral
coral/reaction/_oligo_assembly.py
assemble_oligos
def assemble_oligos(dna_list, reference=None): '''Given a list of DNA sequences, assemble into a single construct. :param dna_list: List of DNA sequences - they must be single-stranded. :type dna_list: coral.DNA list :param reference: Expected sequence - once assembly completed, this will be used to...
python
def assemble_oligos(dna_list, reference=None): '''Given a list of DNA sequences, assemble into a single construct. :param dna_list: List of DNA sequences - they must be single-stranded. :type dna_list: coral.DNA list :param reference: Expected sequence - once assembly completed, this will be used to...
[ "def", "assemble_oligos", "(", "dna_list", ",", "reference", "=", "None", ")", ":", "# FIXME: this protocol currently only supports 5' ends on the assembly", "# Find all matches for every oligo. If more than 2 per side, error.", "# Self-oligo is included in case the 3' end is self-complement...
Given a list of DNA sequences, assemble into a single construct. :param dna_list: List of DNA sequences - they must be single-stranded. :type dna_list: coral.DNA list :param reference: Expected sequence - once assembly completed, this will be used to reorient the DNA (assembly could potentially occur fr...
[ "Given", "a", "list", "of", "DNA", "sequences", "assemble", "into", "a", "single", "construct", ".", ":", "param", "dna_list", ":", "List", "of", "DNA", "sequences", "-", "they", "must", "be", "single", "-", "stranded", ".", ":", "type", "dna_list", ":",...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/reaction/_oligo_assembly.py#L12-L92
klavinslab/coral
coral/reaction/_oligo_assembly.py
bind_unique
def bind_unique(reference, query_list, min_overlap=12, right=True): '''(5' or 3' region on reference sequence that uniquely matches the reverse complement of the associated (5' or 3') region of one sequence in a list of query sequences. :param reference: Reference sequence. :type reference: coral.D...
python
def bind_unique(reference, query_list, min_overlap=12, right=True): '''(5' or 3' region on reference sequence that uniquely matches the reverse complement of the associated (5' or 3') region of one sequence in a list of query sequences. :param reference: Reference sequence. :type reference: coral.D...
[ "def", "bind_unique", "(", "reference", ",", "query_list", ",", "min_overlap", "=", "12", ",", "right", "=", "True", ")", ":", "size", "=", "min_overlap", "found", "=", "[", "]", "# Reverse complementing here provides massive speedup?", "rev_query", "=", "[", "s...
(5' or 3' region on reference sequence that uniquely matches the reverse complement of the associated (5' or 3') region of one sequence in a list of query sequences. :param reference: Reference sequence. :type reference: coral.DNA :param query_list: List of query sequences. :type query_list: co...
[ "(", "5", "or", "3", "region", "on", "reference", "sequence", "that", "uniquely", "matches", "the", "reverse", "complement", "of", "the", "associated", "(", "5", "or", "3", ")", "region", "of", "one", "sequence", "in", "a", "list", "of", "query", "sequen...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/reaction/_oligo_assembly.py#L95-L134
klavinslab/coral
coral/analysis/_sequencing/sanger.py
Sanger.nonmatches
def nonmatches(self): '''Report mismatches, indels, and coverage.''' # For every result, keep a dictionary of mismatches, insertions, and # deletions report = [] for result in self.aligned_results: report.append(self._analyze_single(self.aligned_reference, result)) ...
python
def nonmatches(self): '''Report mismatches, indels, and coverage.''' # For every result, keep a dictionary of mismatches, insertions, and # deletions report = [] for result in self.aligned_results: report.append(self._analyze_single(self.aligned_reference, result)) ...
[ "def", "nonmatches", "(", "self", ")", ":", "# For every result, keep a dictionary of mismatches, insertions, and", "# deletions", "report", "=", "[", "]", "for", "result", "in", "self", ".", "aligned_results", ":", "report", ".", "append", "(", "self", ".", "_analy...
Report mismatches, indels, and coverage.
[ "Report", "mismatches", "indels", "and", "coverage", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/sanger.py#L72-L80
klavinslab/coral
coral/analysis/_sequencing/sanger.py
Sanger.plot
def plot(self): '''Make a summary plot of the alignment and highlight nonmatches.''' import matplotlib.pyplot as plt import matplotlib.patches as patches # Constants to use throughout drawing n = len(self.results) nbases = len(self.aligned_reference) barheight = ...
python
def plot(self): '''Make a summary plot of the alignment and highlight nonmatches.''' import matplotlib.pyplot as plt import matplotlib.patches as patches # Constants to use throughout drawing n = len(self.results) nbases = len(self.aligned_reference) barheight = ...
[ "def", "plot", "(", "self", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "matplotlib", ".", "patches", "as", "patches", "# Constants to use throughout drawing", "n", "=", "len", "(", "self", ".", "results", ")", "nbases", "=", "len...
Make a summary plot of the alignment and highlight nonmatches.
[ "Make", "a", "summary", "plot", "of", "the", "alignment", "and", "highlight", "nonmatches", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/sanger.py#L82-L134
klavinslab/coral
coral/analysis/_sequencing/sanger.py
Sanger._analyze_single
def _analyze_single(self, reference, result): '''Report mistmatches and indels for a single (aligned) reference and result.''' # TODO: Recalculate coverage based on reference (e.g. sequencing result # longer than template reference_str = str(reference) result_str = str(re...
python
def _analyze_single(self, reference, result): '''Report mistmatches and indels for a single (aligned) reference and result.''' # TODO: Recalculate coverage based on reference (e.g. sequencing result # longer than template reference_str = str(reference) result_str = str(re...
[ "def", "_analyze_single", "(", "self", ",", "reference", ",", "result", ")", ":", "# TODO: Recalculate coverage based on reference (e.g. sequencing result", "# longer than template", "reference_str", "=", "str", "(", "reference", ")", "result_str", "=", "str", "(", "resul...
Report mistmatches and indels for a single (aligned) reference and result.
[ "Report", "mistmatches", "and", "indels", "for", "a", "single", "(", "aligned", ")", "reference", "and", "result", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/sanger.py#L136-L158
klavinslab/coral
coral/analysis/_sequencing/sanger.py
Sanger._remove_n
def _remove_n(self): '''Remove terminal Ns from sequencing results.''' for i, result in enumerate(self.results): largest = max(str(result).split('N'), key=len) start = result.locate(largest)[0][0] stop = start + len(largest) if start != stop: ...
python
def _remove_n(self): '''Remove terminal Ns from sequencing results.''' for i, result in enumerate(self.results): largest = max(str(result).split('N'), key=len) start = result.locate(largest)[0][0] stop = start + len(largest) if start != stop: ...
[ "def", "_remove_n", "(", "self", ")", ":", "for", "i", ",", "result", "in", "enumerate", "(", "self", ".", "results", ")", ":", "largest", "=", "max", "(", "str", "(", "result", ")", ".", "split", "(", "'N'", ")", ",", "key", "=", "len", ")", "...
Remove terminal Ns from sequencing results.
[ "Remove", "terminal", "Ns", "from", "sequencing", "results", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/sanger.py#L160-L167
klavinslab/coral
coral/design/_sequence_generation/random_sequences.py
random_dna
def random_dna(n): '''Generate a random DNA sequence. :param n: Output sequence length. :type n: int :returns: Random DNA sequence of length n. :rtype: coral.DNA ''' return coral.DNA(''.join([random.choice('ATGC') for i in range(n)]))
python
def random_dna(n): '''Generate a random DNA sequence. :param n: Output sequence length. :type n: int :returns: Random DNA sequence of length n. :rtype: coral.DNA ''' return coral.DNA(''.join([random.choice('ATGC') for i in range(n)]))
[ "def", "random_dna", "(", "n", ")", ":", "return", "coral", ".", "DNA", "(", "''", ".", "join", "(", "[", "random", ".", "choice", "(", "'ATGC'", ")", "for", "i", "in", "range", "(", "n", ")", "]", ")", ")" ]
Generate a random DNA sequence. :param n: Output sequence length. :type n: int :returns: Random DNA sequence of length n. :rtype: coral.DNA
[ "Generate", "a", "random", "DNA", "sequence", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_sequence_generation/random_sequences.py#L7-L16
klavinslab/coral
coral/design/_sequence_generation/random_sequences.py
random_codons
def random_codons(peptide, frequency_cutoff=0.0, weighted=False, table=None): '''Generate randomized codons given a peptide sequence. :param peptide: Peptide sequence for which to generate randomized codons. :type peptide: coral.Peptide :param frequency_cutoff: Relative codon usage ...
python
def random_codons(peptide, frequency_cutoff=0.0, weighted=False, table=None): '''Generate randomized codons given a peptide sequence. :param peptide: Peptide sequence for which to generate randomized codons. :type peptide: coral.Peptide :param frequency_cutoff: Relative codon usage ...
[ "def", "random_codons", "(", "peptide", ",", "frequency_cutoff", "=", "0.0", ",", "weighted", "=", "False", ",", "table", "=", "None", ")", ":", "if", "table", "is", "None", ":", "table", "=", "CODON_FREQ_BY_AA", "[", "'sc'", "]", "# Process codon table usin...
Generate randomized codons given a peptide sequence. :param peptide: Peptide sequence for which to generate randomized codons. :type peptide: coral.Peptide :param frequency_cutoff: Relative codon usage cutoff - codons that are rarer will not be used. Frequen...
[ "Generate", "randomized", "codons", "given", "a", "peptide", "sequence", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_sequence_generation/random_sequences.py#L19-L70
klavinslab/coral
coral/design/_sequence_generation/random_sequences.py
_cutoff
def _cutoff(table, frequency_cutoff): '''Generate new codon frequency table given a mean cutoff. :param table: codon frequency table of form {amino acid: codon: frequency} :type table: dict :param frequency_cutoff: value between 0 and 1.0 for mean frequency cutoff :type frequency_cutoff: float ...
python
def _cutoff(table, frequency_cutoff): '''Generate new codon frequency table given a mean cutoff. :param table: codon frequency table of form {amino acid: codon: frequency} :type table: dict :param frequency_cutoff: value between 0 and 1.0 for mean frequency cutoff :type frequency_cutoff: float ...
[ "def", "_cutoff", "(", "table", ",", "frequency_cutoff", ")", ":", "new_table", "=", "{", "}", "# IDEA: cutoff should be relative to most-frequent codon, not average?", "for", "amino_acid", ",", "codons", "in", "table", ".", "iteritems", "(", ")", ":", "average_cutoff...
Generate new codon frequency table given a mean cutoff. :param table: codon frequency table of form {amino acid: codon: frequency} :type table: dict :param frequency_cutoff: value between 0 and 1.0 for mean frequency cutoff :type frequency_cutoff: float :returns: A codon frequency table with some c...
[ "Generate", "new", "codon", "frequency", "table", "given", "a", "mean", "cutoff", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_sequence_generation/random_sequences.py#L73-L92
klavinslab/coral
coral/database/_entrez.py
fetch_genome
def fetch_genome(genome_id): '''Acquire a genome from Entrez ''' # TODO: Can strandedness by found in fetched genome attributes? # TODO: skip read/write step? # Using a dummy email for now - does this violate NCBI guidelines? email = 'loremipsum@gmail.com' Entrez.email = email print 'D...
python
def fetch_genome(genome_id): '''Acquire a genome from Entrez ''' # TODO: Can strandedness by found in fetched genome attributes? # TODO: skip read/write step? # Using a dummy email for now - does this violate NCBI guidelines? email = 'loremipsum@gmail.com' Entrez.email = email print 'D...
[ "def", "fetch_genome", "(", "genome_id", ")", ":", "# TODO: Can strandedness by found in fetched genome attributes?", "# TODO: skip read/write step?", "# Using a dummy email for now - does this violate NCBI guidelines?", "email", "=", "'loremipsum@gmail.com'", "Entrez", ".", "email", "...
Acquire a genome from Entrez
[ "Acquire", "a", "genome", "from", "Entrez" ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/database/_entrez.py#L15-L34
klavinslab/coral
coral/analysis/_structure/viennarna.py
ViennaRNA.cofold
def cofold(self, strand1, strand2, temp=37.0, dangles=2, nolp=False, nogu=False, noclosinggu=False, constraints=None, canonicalbponly=False, partition=-1, pfscale=None, gquad=False): '''Run the RNAcofold command and retrieve the result in a dictionary. :param strand1: Stra...
python
def cofold(self, strand1, strand2, temp=37.0, dangles=2, nolp=False, nogu=False, noclosinggu=False, constraints=None, canonicalbponly=False, partition=-1, pfscale=None, gquad=False): '''Run the RNAcofold command and retrieve the result in a dictionary. :param strand1: Stra...
[ "def", "cofold", "(", "self", ",", "strand1", ",", "strand2", ",", "temp", "=", "37.0", ",", "dangles", "=", "2", ",", "nolp", "=", "False", ",", "nogu", "=", "False", ",", "noclosinggu", "=", "False", ",", "constraints", "=", "None", ",", "canonical...
Run the RNAcofold command and retrieve the result in a dictionary. :param strand1: Strand 1 for running RNAcofold. :type strand1: coral.DNA or coral.RNA :param strand1: Strand 2 for running RNAcofold. :type strand2: coral.DNA or coral.RNA :param temp: Temperature at which to run...
[ "Run", "the", "RNAcofold", "command", "and", "retrieve", "the", "result", "in", "a", "dictionary", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/viennarna.py#L18-L140
klavinslab/coral
coral/analysis/_structure/viennarna.py
ViennaRNA.fold
def fold(self, strand, temp=37.0, dangles=2, nolp=False, nogu=False, noclosinggu=False, constraints=None, canonicalbponly=False, partition=False, pfscale=None, imfeelinglucky=False, gquad=False): '''Run the RNAfold command and retrieve the result in a dictionary. :param strand...
python
def fold(self, strand, temp=37.0, dangles=2, nolp=False, nogu=False, noclosinggu=False, constraints=None, canonicalbponly=False, partition=False, pfscale=None, imfeelinglucky=False, gquad=False): '''Run the RNAfold command and retrieve the result in a dictionary. :param strand...
[ "def", "fold", "(", "self", ",", "strand", ",", "temp", "=", "37.0", ",", "dangles", "=", "2", ",", "nolp", "=", "False", ",", "nogu", "=", "False", ",", "noclosinggu", "=", "False", ",", "constraints", "=", "None", ",", "canonicalbponly", "=", "Fals...
Run the RNAfold command and retrieve the result in a dictionary. :param strand: The DNA or RNA sequence on which to run RNAfold. :type strand: coral.DNA or coral.RNA :param temp: Temperature at which to run the calculations. :type temp: float :param dangles: How to treat danglin...
[ "Run", "the", "RNAfold", "command", "and", "retrieve", "the", "result", "in", "a", "dictionary", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/viennarna.py#L143-L248
klavinslab/coral
coral/analysis/_structure/dimers.py
dimers
def dimers(primer1, primer2, concentrations=[5e-7, 3e-11]): '''Calculate expected fraction of primer dimers. :param primer1: Forward primer. :type primer1: coral.DNA :param primer2: Reverse primer. :type primer2: coral.DNA :param template: DNA template. :type template: coral.DNA :param ...
python
def dimers(primer1, primer2, concentrations=[5e-7, 3e-11]): '''Calculate expected fraction of primer dimers. :param primer1: Forward primer. :type primer1: coral.DNA :param primer2: Reverse primer. :type primer2: coral.DNA :param template: DNA template. :type template: coral.DNA :param ...
[ "def", "dimers", "(", "primer1", ",", "primer2", ",", "concentrations", "=", "[", "5e-7", ",", "3e-11", "]", ")", ":", "# It is not reasonable (yet) to use a long template for doing these", "# computations directly, as NUPACK does an exhaustive calculation and", "# would take too...
Calculate expected fraction of primer dimers. :param primer1: Forward primer. :type primer1: coral.DNA :param primer2: Reverse primer. :type primer2: coral.DNA :param template: DNA template. :type template: coral.DNA :param concentrations: list of concentrations for primers and the ...
[ "Calculate", "expected", "fraction", "of", "primer", "dimers", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/dimers.py#L5-L40
klavinslab/coral
coral/seqio/_dna.py
read_dna
def read_dna(path): '''Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA ''' filename, ext = os.path.splitext(os.path.split(path)[-1]) genbank_exts = ['.gb', '.ape'] fasta...
python
def read_dna(path): '''Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA ''' filename, ext = os.path.splitext(os.path.split(path)[-1]) genbank_exts = ['.gb', '.ape'] fasta...
[ "def", "read_dna", "(", "path", ")", ":", "filename", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "split", "(", "path", ")", "[", "-", "1", "]", ")", "genbank_exts", "=", "[", "'.gb'", ",", "'.ape'", "]", "...
Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA
[ "Read", "DNA", "from", "file", ".", "Uses", "BioPython", "and", "coerces", "to", "coral", "format", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L22-L69
klavinslab/coral
coral/seqio/_dna.py
read_sequencing
def read_sequencing(directory): '''Read .seq and .abi/.ab1 results files from a dir. :param directory: Path to directory containing sequencing files. :type directory: str :returns: A list of DNA sequences. :rtype: coral.DNA list ''' dirfiles = os.listdir(directory) seq_exts = ['.seq', ...
python
def read_sequencing(directory): '''Read .seq and .abi/.ab1 results files from a dir. :param directory: Path to directory containing sequencing files. :type directory: str :returns: A list of DNA sequences. :rtype: coral.DNA list ''' dirfiles = os.listdir(directory) seq_exts = ['.seq', ...
[ "def", "read_sequencing", "(", "directory", ")", ":", "dirfiles", "=", "os", ".", "listdir", "(", "directory", ")", "seq_exts", "=", "[", "'.seq'", ",", "'.abi'", ",", "'.ab1'", "]", "# Exclude files that aren't sequencing results", "seq_paths", "=", "[", "x", ...
Read .seq and .abi/.ab1 results files from a dir. :param directory: Path to directory containing sequencing files. :type directory: str :returns: A list of DNA sequences. :rtype: coral.DNA list
[ "Read", ".", "seq", "and", ".", "abi", "/", ".", "ab1", "results", "files", "from", "a", "dir", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L72-L88
klavinslab/coral
coral/seqio/_dna.py
write_dna
def write_dna(dna, path): '''Write DNA to a file (genbank or fasta). :param dna: DNA sequence to write to file :type dna: coral.DNA :param path: file path to write. Has to be genbank or fasta file. :type path: str ''' # Check if path filetype is valid, remember for later ext = os.path....
python
def write_dna(dna, path): '''Write DNA to a file (genbank or fasta). :param dna: DNA sequence to write to file :type dna: coral.DNA :param path: file path to write. Has to be genbank or fasta file. :type path: str ''' # Check if path filetype is valid, remember for later ext = os.path....
[ "def", "write_dna", "(", "dna", ",", "path", ")", ":", "# Check if path filetype is valid, remember for later", "ext", "=", "os", ".", "path", ".", "splitext", "(", "path", ")", "[", "1", "]", "if", "ext", "==", "'.gb'", "or", "ext", "==", "'.ape'", ":", ...
Write DNA to a file (genbank or fasta). :param dna: DNA sequence to write to file :type dna: coral.DNA :param path: file path to write. Has to be genbank or fasta file. :type path: str
[ "Write", "DNA", "to", "a", "file", "(", "genbank", "or", "fasta", ")", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L91-L132
klavinslab/coral
coral/seqio/_dna.py
write_primers
def write_primers(primer_list, path, names=None, notes=None): '''Write a list of primers out to a csv file. The first three columns are compatible with the current IDT order form (name, sequence, notes). By default there are no notes, which is an optional parameter. :param primer_list: A list of primer...
python
def write_primers(primer_list, path, names=None, notes=None): '''Write a list of primers out to a csv file. The first three columns are compatible with the current IDT order form (name, sequence, notes). By default there are no notes, which is an optional parameter. :param primer_list: A list of primer...
[ "def", "write_primers", "(", "primer_list", ",", "path", ",", "names", "=", "None", ",", "notes", "=", "None", ")", ":", "# Check for notes and names having the right length, apply them to primers", "if", "names", "is", "not", "None", ":", "if", "len", "(", "names...
Write a list of primers out to a csv file. The first three columns are compatible with the current IDT order form (name, sequence, notes). By default there are no notes, which is an optional parameter. :param primer_list: A list of primers. :type primer_list: coral.Primer list :param path: A path t...
[ "Write", "a", "list", "of", "primers", "out", "to", "a", "csv", "file", ".", "The", "first", "three", "columns", "are", "compatible", "with", "the", "current", "IDT", "order", "form", "(", "name", "sequence", "notes", ")", ".", "By", "default", "there", ...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L135-L172
klavinslab/coral
coral/seqio/_dna.py
_process_feature_type
def _process_feature_type(feature_type, bio_to_coral=True): '''Translate genbank feature types into usable ones (currently identical). The feature table is derived from the official genbank spec (gbrel.txt) available at http://www.insdc.org/documents/feature-table :param feature_type: feature to conver...
python
def _process_feature_type(feature_type, bio_to_coral=True): '''Translate genbank feature types into usable ones (currently identical). The feature table is derived from the official genbank spec (gbrel.txt) available at http://www.insdc.org/documents/feature-table :param feature_type: feature to conver...
[ "def", "_process_feature_type", "(", "feature_type", ",", "bio_to_coral", "=", "True", ")", ":", "err_msg", "=", "'Unrecognized feature type: {}'", ".", "format", "(", "feature_type", ")", "if", "bio_to_coral", ":", "try", ":", "name", "=", "coral", ".", "consta...
Translate genbank feature types into usable ones (currently identical). The feature table is derived from the official genbank spec (gbrel.txt) available at http://www.insdc.org/documents/feature-table :param feature_type: feature to convert :type feature_type: str :param bio_to_coral: from coral t...
[ "Translate", "genbank", "feature", "types", "into", "usable", "ones", "(", "currently", "identical", ")", ".", "The", "feature", "table", "is", "derived", "from", "the", "official", "genbank", "spec", "(", "gbrel", ".", "txt", ")", "available", "at", "http",...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L175-L201
klavinslab/coral
coral/seqio/_dna.py
_seqfeature_to_coral
def _seqfeature_to_coral(feature): '''Convert a Biopython SeqFeature to a coral.Feature. :param feature: Biopython SeqFeature :type feature: Bio.SeqFeature ''' # Some genomic sequences don't have a label attribute # TODO: handle genomic cases differently than others. Some features lack # a...
python
def _seqfeature_to_coral(feature): '''Convert a Biopython SeqFeature to a coral.Feature. :param feature: Biopython SeqFeature :type feature: Bio.SeqFeature ''' # Some genomic sequences don't have a label attribute # TODO: handle genomic cases differently than others. Some features lack # a...
[ "def", "_seqfeature_to_coral", "(", "feature", ")", ":", "# Some genomic sequences don't have a label attribute", "# TODO: handle genomic cases differently than others. Some features lack", "# a label but should still be incorporated somehow.", "qualifiers", "=", "feature", ".", "qualifier...
Convert a Biopython SeqFeature to a coral.Feature. :param feature: Biopython SeqFeature :type feature: Bio.SeqFeature
[ "Convert", "a", "Biopython", "SeqFeature", "to", "a", "coral", ".", "Feature", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L204-L265
klavinslab/coral
coral/seqio/_dna.py
_coral_to_seqfeature
def _coral_to_seqfeature(feature): '''Convert a coral.Feature to a Biopython SeqFeature. :param feature: coral Feature. :type feature: coral.Feature ''' bio_strand = 1 if feature.strand == 1 else -1 ftype = _process_feature_type(feature.feature_type, bio_to_coral=False) sublocations = [] ...
python
def _coral_to_seqfeature(feature): '''Convert a coral.Feature to a Biopython SeqFeature. :param feature: coral Feature. :type feature: coral.Feature ''' bio_strand = 1 if feature.strand == 1 else -1 ftype = _process_feature_type(feature.feature_type, bio_to_coral=False) sublocations = [] ...
[ "def", "_coral_to_seqfeature", "(", "feature", ")", ":", "bio_strand", "=", "1", "if", "feature", ".", "strand", "==", "1", "else", "-", "1", "ftype", "=", "_process_feature_type", "(", "feature", ".", "feature_type", ",", "bio_to_coral", "=", "False", ")", ...
Convert a coral.Feature to a Biopython SeqFeature. :param feature: coral Feature. :type feature: coral.Feature
[ "Convert", "a", "coral", ".", "Feature", "to", "a", "Biopython", "SeqFeature", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L268-L307
klavinslab/coral
coral/analysis/_sequencing/align.py
as_ord_matrix
def as_ord_matrix(matrix, alphabet): '''Given the SubstitutionMatrix input, generate an equivalent matrix that is indexed by the ASCII number of each residue (e.g. A -> 65).''' ords = [ord(c) for c in alphabet] ord_matrix = np.zeros((max(ords) + 1, max(ords) + 1), dtype=np.integer) for i, row_ord in...
python
def as_ord_matrix(matrix, alphabet): '''Given the SubstitutionMatrix input, generate an equivalent matrix that is indexed by the ASCII number of each residue (e.g. A -> 65).''' ords = [ord(c) for c in alphabet] ord_matrix = np.zeros((max(ords) + 1, max(ords) + 1), dtype=np.integer) for i, row_ord in...
[ "def", "as_ord_matrix", "(", "matrix", ",", "alphabet", ")", ":", "ords", "=", "[", "ord", "(", "c", ")", "for", "c", "in", "alphabet", "]", "ord_matrix", "=", "np", ".", "zeros", "(", "(", "max", "(", "ords", ")", "+", "1", ",", "max", "(", "o...
Given the SubstitutionMatrix input, generate an equivalent matrix that is indexed by the ASCII number of each residue (e.g. A -> 65).
[ "Given", "the", "SubstitutionMatrix", "input", "generate", "an", "equivalent", "matrix", "that", "is", "indexed", "by", "the", "ASCII", "number", "of", "each", "residue", "(", "e", ".", "g", ".", "A", "-", ">", "65", ")", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/align.py#L6-L15
klavinslab/coral
coral/analysis/_sequencing/align.py
aligner
def aligner(seqj, seqi, method='global', gap_open=-7, gap_extend=-7, gap_double=-7, matrix=submat.DNA_SIMPLE.matrix, alphabet=submat.DNA_SIMPLE.alphabet): '''Calculates the alignment of two sequences. The global method uses a global Needleman-Wunsh algorithm, local does a a local Smi...
python
def aligner(seqj, seqi, method='global', gap_open=-7, gap_extend=-7, gap_double=-7, matrix=submat.DNA_SIMPLE.matrix, alphabet=submat.DNA_SIMPLE.alphabet): '''Calculates the alignment of two sequences. The global method uses a global Needleman-Wunsh algorithm, local does a a local Smi...
[ "def", "aligner", "(", "seqj", ",", "seqi", ",", "method", "=", "'global'", ",", "gap_open", "=", "-", "7", ",", "gap_extend", "=", "-", "7", ",", "gap_double", "=", "-", "7", ",", "matrix", "=", "submat", ".", "DNA_SIMPLE", ".", "matrix", ",", "al...
Calculates the alignment of two sequences. The global method uses a global Needleman-Wunsh algorithm, local does a a local Smith-Waterman alignment, global_cfe does a global alignment with cost-free ends and glocal does an alignment which is global only with respect to the shorter sequence, also known a...
[ "Calculates", "the", "alignment", "of", "two", "sequences", ".", "The", "global", "method", "uses", "a", "global", "Needleman", "-", "Wunsh", "algorithm", "local", "does", "a", "a", "local", "Smith", "-", "Waterman", "alignment", "global_cfe", "does", "a", "...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/align.py#L29-L185
klavinslab/coral
coral/analysis/_sequencing/align.py
score_alignment
def score_alignment(a, b, gap_open, gap_extend, matrix): '''Calculate the alignment score from two aligned sequences. :param a: The first aligned sequence. :type a: str :param b: The second aligned sequence. :type b: str :param gap_open: The cost of opening a gap (negative number). :type ga...
python
def score_alignment(a, b, gap_open, gap_extend, matrix): '''Calculate the alignment score from two aligned sequences. :param a: The first aligned sequence. :type a: str :param b: The second aligned sequence. :type b: str :param gap_open: The cost of opening a gap (negative number). :type ga...
[ "def", "score_alignment", "(", "a", ",", "b", ",", "gap_open", ",", "gap_extend", ",", "matrix", ")", ":", "al", "=", "a", "bl", "=", "b", "l", "=", "len", "(", "al", ")", "score", "=", "0", "assert", "len", "(", "bl", ")", "==", "l", ",", "'...
Calculate the alignment score from two aligned sequences. :param a: The first aligned sequence. :type a: str :param b: The second aligned sequence. :type b: str :param gap_open: The cost of opening a gap (negative number). :type gap_open: int :param gap_extend: The cost of extending an open...
[ "Calculate", "the", "alignment", "score", "from", "two", "aligned", "sequences", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/align.py#L188-L219
klavinslab/coral
bin/build_sphinx_docs.py
build_docs
def build_docs(directory): """Builds sphinx docs from a given directory.""" os.chdir(directory) process = subprocess.Popen(["make", "html"], cwd=directory) process.communicate()
python
def build_docs(directory): """Builds sphinx docs from a given directory.""" os.chdir(directory) process = subprocess.Popen(["make", "html"], cwd=directory) process.communicate()
[ "def", "build_docs", "(", "directory", ")", ":", "os", ".", "chdir", "(", "directory", ")", "process", "=", "subprocess", ".", "Popen", "(", "[", "\"make\"", ",", "\"html\"", "]", ",", "cwd", "=", "directory", ")", "process", ".", "communicate", "(", "...
Builds sphinx docs from a given directory.
[ "Builds", "sphinx", "docs", "from", "a", "given", "directory", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/bin/build_sphinx_docs.py#L11-L15
klavinslab/coral
coral/design/_gibson.py
gibson_primers
def gibson_primers(dna1, dna2, overlap='mixed', maxlen=80, overlap_tm=65.0, insert=None, primer_kwargs=None): '''Design Gibson primers given two DNA sequences (connect left to right) :param dna1: First piece of DNA for which to design primers. Once Gibsoned, would be connect...
python
def gibson_primers(dna1, dna2, overlap='mixed', maxlen=80, overlap_tm=65.0, insert=None, primer_kwargs=None): '''Design Gibson primers given two DNA sequences (connect left to right) :param dna1: First piece of DNA for which to design primers. Once Gibsoned, would be connect...
[ "def", "gibson_primers", "(", "dna1", ",", "dna2", ",", "overlap", "=", "'mixed'", ",", "maxlen", "=", "80", ",", "overlap_tm", "=", "65.0", ",", "insert", "=", "None", ",", "primer_kwargs", "=", "None", ")", ":", "if", "primer_kwargs", "is", "None", "...
Design Gibson primers given two DNA sequences (connect left to right) :param dna1: First piece of DNA for which to design primers. Once Gibsoned, would be connected at its right side to dna2. :type dna1: coral.DNA :param dna2: First piece of DNA for which to design primers. Once Gibsoned, ...
[ "Design", "Gibson", "primers", "given", "two", "DNA", "sequences", "(", "connect", "left", "to", "right", ")" ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_gibson.py#L15-L133
klavinslab/coral
coral/design/_gibson.py
gibson
def gibson(seq_list, circular=True, overlaps='mixed', overlap_tm=65, maxlen=80, terminal_primers=True, primer_kwargs=None): '''Design Gibson primers given a set of sequences :param seq_list: List of DNA sequences to stitch together :type seq_list: list containing coral.DNA :param circular: I...
python
def gibson(seq_list, circular=True, overlaps='mixed', overlap_tm=65, maxlen=80, terminal_primers=True, primer_kwargs=None): '''Design Gibson primers given a set of sequences :param seq_list: List of DNA sequences to stitch together :type seq_list: list containing coral.DNA :param circular: I...
[ "def", "gibson", "(", "seq_list", ",", "circular", "=", "True", ",", "overlaps", "=", "'mixed'", ",", "overlap_tm", "=", "65", ",", "maxlen", "=", "80", ",", "terminal_primers", "=", "True", ",", "primer_kwargs", "=", "None", ")", ":", "# Input checking", ...
Design Gibson primers given a set of sequences :param seq_list: List of DNA sequences to stitch together :type seq_list: list containing coral.DNA :param circular: If true, designs primers for making a circular construct. If false, designs primers for a linear construct. :type circ...
[ "Design", "Gibson", "primers", "given", "a", "set", "of", "sequences" ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/design/_gibson.py#L136-L214
klavinslab/coral
coral/sequence/_sequence.py
_decompose
def _decompose(string, n): '''Given string and multiplier n, find m**2 decomposition. :param string: input string :type string: str :param n: multiplier :type n: int :returns: generator that produces m**2 * string if m**2 is a factor of n :rtype: generator of 0 or 1 ''' binary = [i...
python
def _decompose(string, n): '''Given string and multiplier n, find m**2 decomposition. :param string: input string :type string: str :param n: multiplier :type n: int :returns: generator that produces m**2 * string if m**2 is a factor of n :rtype: generator of 0 or 1 ''' binary = [i...
[ "def", "_decompose", "(", "string", ",", "n", ")", ":", "binary", "=", "[", "int", "(", "x", ")", "for", "x", "in", "bin", "(", "n", ")", "[", "2", ":", "]", "]", "new_string", "=", "string", "counter", "=", "1", "while", "counter", "<=", "len"...
Given string and multiplier n, find m**2 decomposition. :param string: input string :type string: str :param n: multiplier :type n: int :returns: generator that produces m**2 * string if m**2 is a factor of n :rtype: generator of 0 or 1
[ "Given", "string", "and", "multiplier", "n", "find", "m", "**", "2", "decomposition", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L244-L262
klavinslab/coral
coral/sequence/_sequence.py
reverse_complement
def reverse_complement(sequence, material): '''Reverse complement a sequence. :param sequence: Sequence to reverse complement :type sequence: str :param material: dna, rna, or peptide. :type material: str ''' code = dict(COMPLEMENTS[material]) reverse_sequence = sequence[::-1] retur...
python
def reverse_complement(sequence, material): '''Reverse complement a sequence. :param sequence: Sequence to reverse complement :type sequence: str :param material: dna, rna, or peptide. :type material: str ''' code = dict(COMPLEMENTS[material]) reverse_sequence = sequence[::-1] retur...
[ "def", "reverse_complement", "(", "sequence", ",", "material", ")", ":", "code", "=", "dict", "(", "COMPLEMENTS", "[", "material", "]", ")", "reverse_sequence", "=", "sequence", "[", ":", ":", "-", "1", "]", "return", "''", ".", "join", "(", "[", "code...
Reverse complement a sequence. :param sequence: Sequence to reverse complement :type sequence: str :param material: dna, rna, or peptide. :type material: str
[ "Reverse", "complement", "a", "sequence", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L386-L396
klavinslab/coral
coral/sequence/_sequence.py
check_alphabet
def check_alphabet(seq, material): '''Verify that a given string is valid DNA, RNA, or peptide characters. :param seq: DNA, RNA, or peptide sequence. :type seq: str :param material: Input material - 'dna', 'rna', or 'pepide'. :type sequence: str :returns: Whether the `seq` is a valid string of ...
python
def check_alphabet(seq, material): '''Verify that a given string is valid DNA, RNA, or peptide characters. :param seq: DNA, RNA, or peptide sequence. :type seq: str :param material: Input material - 'dna', 'rna', or 'pepide'. :type sequence: str :returns: Whether the `seq` is a valid string of ...
[ "def", "check_alphabet", "(", "seq", ",", "material", ")", ":", "errs", "=", "{", "'dna'", ":", "'DNA'", ",", "'rna'", ":", "'RNA'", ",", "'peptide'", ":", "'peptide'", "}", "if", "material", "==", "'dna'", "or", "material", "==", "'rna'", "or", "mater...
Verify that a given string is valid DNA, RNA, or peptide characters. :param seq: DNA, RNA, or peptide sequence. :type seq: str :param material: Input material - 'dna', 'rna', or 'pepide'. :type sequence: str :returns: Whether the `seq` is a valid string of `material`. :rtype: bool :raises: ...
[ "Verify", "that", "a", "given", "string", "is", "valid", "DNA", "RNA", "or", "peptide", "characters", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L399-L424
klavinslab/coral
coral/sequence/_sequence.py
process_seq
def process_seq(seq, material): '''Validate and process sequence inputs. :param seq: input sequence :type seq: str :param material: DNA, RNA, or peptide :type: str :returns: Uppercase version of `seq` with the alphabet checked by check_alphabet(). :rtype: str ''' chec...
python
def process_seq(seq, material): '''Validate and process sequence inputs. :param seq: input sequence :type seq: str :param material: DNA, RNA, or peptide :type: str :returns: Uppercase version of `seq` with the alphabet checked by check_alphabet(). :rtype: str ''' chec...
[ "def", "process_seq", "(", "seq", ",", "material", ")", ":", "check_alphabet", "(", "seq", ",", "material", ")", "seq", "=", "seq", ".", "upper", "(", ")", "return", "seq" ]
Validate and process sequence inputs. :param seq: input sequence :type seq: str :param material: DNA, RNA, or peptide :type: str :returns: Uppercase version of `seq` with the alphabet checked by check_alphabet(). :rtype: str
[ "Validate", "and", "process", "sequence", "inputs", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L427-L441
klavinslab/coral
coral/sequence/_sequence.py
palindrome
def palindrome(seq): '''Test whether a sequence is palindrome. :param seq: Sequence to analyze (DNA or RNA). :type seq: coral.DNA or coral.RNA :returns: Whether a sequence is a palindrome. :rtype: bool ''' seq_len = len(seq) if seq_len % 2 == 0: # Sequence has even number of ba...
python
def palindrome(seq): '''Test whether a sequence is palindrome. :param seq: Sequence to analyze (DNA or RNA). :type seq: coral.DNA or coral.RNA :returns: Whether a sequence is a palindrome. :rtype: bool ''' seq_len = len(seq) if seq_len % 2 == 0: # Sequence has even number of ba...
[ "def", "palindrome", "(", "seq", ")", ":", "seq_len", "=", "len", "(", "seq", ")", "if", "seq_len", "%", "2", "==", "0", ":", "# Sequence has even number of bases, can test non-overlapping seqs", "wing", "=", "seq_len", "/", "2", "l_wing", "=", "seq", "[", "...
Test whether a sequence is palindrome. :param seq: Sequence to analyze (DNA or RNA). :type seq: coral.DNA or coral.RNA :returns: Whether a sequence is a palindrome. :rtype: bool
[ "Test", "whether", "a", "sequence", "is", "palindrome", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L444-L465
klavinslab/coral
coral/sequence/_sequence.py
Sequence.copy
def copy(self): '''Create a copy of the current instance. :returns: A safely editable copy of the current sequence. ''' # Significant performance improvements by skipping alphabet check return type(self)(self.seq, self.material, run_checks=False)
python
def copy(self): '''Create a copy of the current instance. :returns: A safely editable copy of the current sequence. ''' # Significant performance improvements by skipping alphabet check return type(self)(self.seq, self.material, run_checks=False)
[ "def", "copy", "(", "self", ")", ":", "# Significant performance improvements by skipping alphabet check", "return", "type", "(", "self", ")", "(", "self", ".", "seq", ",", "self", ".", "material", ",", "run_checks", "=", "False", ")" ]
Create a copy of the current instance. :returns: A safely editable copy of the current sequence.
[ "Create", "a", "copy", "of", "the", "current", "instance", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L40-L47
klavinslab/coral
coral/sequence/_sequence.py
Sequence.locate
def locate(self, pattern): '''Find sequences matching a pattern. :param pattern: Sequence for which to find matches. :type pattern: str :returns: Indices of pattern matches. :rtype: list of ints ''' if len(pattern) > len(self): raise ValueError('Sear...
python
def locate(self, pattern): '''Find sequences matching a pattern. :param pattern: Sequence for which to find matches. :type pattern: str :returns: Indices of pattern matches. :rtype: list of ints ''' if len(pattern) > len(self): raise ValueError('Sear...
[ "def", "locate", "(", "self", ",", "pattern", ")", ":", "if", "len", "(", "pattern", ")", ">", "len", "(", "self", ")", ":", "raise", "ValueError", "(", "'Search pattern longer than searchable '", "+", "'sequence.'", ")", "seq", "=", "self", ".", "seq", ...
Find sequences matching a pattern. :param pattern: Sequence for which to find matches. :type pattern: str :returns: Indices of pattern matches. :rtype: list of ints
[ "Find", "sequences", "matching", "a", "pattern", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L49-L68
klavinslab/coral
coral/sequence/_sequence.py
Feature.copy
def copy(self): '''Return a copy of the Feature. :returns: A safely editable copy of the current feature. :rtype: coral.Feature ''' return type(self)(self.name, self.start, self.stop, self.feature_type, gene=self.gene, locus_tag=self.locus_tag, ...
python
def copy(self): '''Return a copy of the Feature. :returns: A safely editable copy of the current feature. :rtype: coral.Feature ''' return type(self)(self.name, self.start, self.stop, self.feature_type, gene=self.gene, locus_tag=self.locus_tag, ...
[ "def", "copy", "(", "self", ")", ":", "return", "type", "(", "self", ")", "(", "self", ".", "name", ",", "self", ".", "start", ",", "self", ".", "stop", ",", "self", ".", "feature_type", ",", "gene", "=", "self", ".", "gene", ",", "locus_tag", "=...
Return a copy of the Feature. :returns: A safely editable copy of the current feature. :rtype: coral.Feature
[ "Return", "a", "copy", "of", "the", "Feature", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_sequence.py#L334-L343
klavinslab/coral
coral/analysis/_structure/nupack.py
nupack_multi
def nupack_multi(seqs, material, cmd, arguments, report=True): '''Split Nupack commands over processors. :param inputs: List of sequences, same format as for coral.analysis.Nupack. :type inpus: list :param material: Input material: 'dna' or 'rna'. :type material: str :param cmd: Command: 'mfe',...
python
def nupack_multi(seqs, material, cmd, arguments, report=True): '''Split Nupack commands over processors. :param inputs: List of sequences, same format as for coral.analysis.Nupack. :type inpus: list :param material: Input material: 'dna' or 'rna'. :type material: str :param cmd: Command: 'mfe',...
[ "def", "nupack_multi", "(", "seqs", ",", "material", ",", "cmd", ",", "arguments", ",", "report", "=", "True", ")", ":", "nupack_pool", "=", "multiprocessing", ".", "Pool", "(", ")", "try", ":", "args", "=", "[", "{", "'seq'", ":", "seq", ",", "'cmd'...
Split Nupack commands over processors. :param inputs: List of sequences, same format as for coral.analysis.Nupack. :type inpus: list :param material: Input material: 'dna' or 'rna'. :type material: str :param cmd: Command: 'mfe', 'pairs', 'complexes', or 'concentrations'. :type cmd: str :pa...
[ "Split", "Nupack", "commands", "over", "processors", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1490-L1533
klavinslab/coral
coral/analysis/_structure/nupack.py
run_nupack
def run_nupack(kwargs): '''Run picklable Nupack command. :param kwargs: keyword arguments to pass to Nupack as well as 'cmd'. :returns: Variable - whatever `cmd` returns. ''' run = NUPACK(kwargs['seq']) output = getattr(run, kwargs['cmd'])(**kwargs['arguments']) return output
python
def run_nupack(kwargs): '''Run picklable Nupack command. :param kwargs: keyword arguments to pass to Nupack as well as 'cmd'. :returns: Variable - whatever `cmd` returns. ''' run = NUPACK(kwargs['seq']) output = getattr(run, kwargs['cmd'])(**kwargs['arguments']) return output
[ "def", "run_nupack", "(", "kwargs", ")", ":", "run", "=", "NUPACK", "(", "kwargs", "[", "'seq'", "]", ")", "output", "=", "getattr", "(", "run", ",", "kwargs", "[", "'cmd'", "]", ")", "(", "*", "*", "kwargs", "[", "'arguments'", "]", ")", "return",...
Run picklable Nupack command. :param kwargs: keyword arguments to pass to Nupack as well as 'cmd'. :returns: Variable - whatever `cmd` returns.
[ "Run", "picklable", "Nupack", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1536-L1545
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.pfunc_multi
def pfunc_multi(self, strands, permutation=None, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the partition function for an ordered complex of strands. Runs the \'pfunc\' command. :param strands: List of strands to use as inp...
python
def pfunc_multi(self, strands, permutation=None, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the partition function for an ordered complex of strands. Runs the \'pfunc\' command. :param strands: List of strands to use as inp...
[ "def", "pfunc_multi", "(", "self", ",", "strands", ",", "permutation", "=", "None", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "1.0", ",", "magnesium", "=", ...
Compute the partition function for an ordered complex of strands. Runs the \'pfunc\' command. :param strands: List of strands to use as inputs to pfunc -multi. :type strands: list :param permutation: The circular permutation of strands to test in complex. e.g...
[ "Compute", "the", "partition", "function", "for", "an", "ordered", "complex", "of", "strands", ".", "Runs", "the", "\\", "pfunc", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L97-L150
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.pairs
def pairs(self, strand, cutoff=0.001, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param strand: Strand on which to run pairs. Strands must be e...
python
def pairs(self, strand, cutoff=0.001, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param strand: Strand on which to run pairs. Strands must be e...
[ "def", "pairs", "(", "self", ",", "strand", ",", "cutoff", "=", "0.001", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "1.0", ",", "magnesium", "=", "0.0", ")...
Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param strand: Strand on which to run pairs. Strands must be either coral.DNA or coral.RNA). :type strand: list :param cutoff: Only probabilities above this cutoff appear...
[ "Compute", "the", "pair", "probabilities", "for", "an", "ordered", "complex", "of", "strands", ".", "Runs", "the", "\\", "pairs", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L153-L213
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.pairs_multi
def pairs_multi(self, strands, cutoff=0.001, permutation=None, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param stra...
python
def pairs_multi(self, strands, cutoff=0.001, permutation=None, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param stra...
[ "def", "pairs_multi", "(", "self", ",", "strands", ",", "cutoff", "=", "0.001", ",", "permutation", "=", "None", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "...
Compute the pair probabilities for an ordered complex of strands. Runs the \'pairs\' command. :param strands: List of strands to use as inputs to pairs -multi. :type strands: list :param permutation: The circular permutation of strands to test in complex. e.g...
[ "Compute", "the", "pair", "probabilities", "for", "an", "ordered", "complex", "of", "strands", ".", "Runs", "the", "\\", "pairs", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L216-L290
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.mfe
def mfe(self, strand, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strand: Strand on which to run mfe. Strands must be either ...
python
def mfe(self, strand, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strand: Strand on which to run mfe. Strands must be either ...
[ "def", "mfe", "(", "self", ",", "strand", ",", "degenerate", "=", "False", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "1.0", ",", "magnesium", "=", "0.0", ...
Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strand: Strand on which to run mfe. Strands must be either coral.DNA or coral.RNA). :type strand: coral.DNA or coral.RNA :param degenerate: Setting to True will result in returning...
[ "Compute", "the", "MFE", "for", "an", "ordered", "complex", "of", "strands", ".", "Runs", "the", "\\", "mfe", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L293-L354
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.mfe_multi
def mfe_multi(self, strands, permutation=None, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strands: Strands on whi...
python
def mfe_multi(self, strands, permutation=None, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strands: Strands on whi...
[ "def", "mfe_multi", "(", "self", ",", "strands", ",", "permutation", "=", "None", ",", "degenerate", "=", "False", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", ...
Compute the MFE for an ordered complex of strands. Runs the \'mfe\' command. :param strands: Strands on which to run mfe. Strands must be either coral.DNA or coral.RNA). :type strands: list :param permutation: The circular permutation of strands to test in ...
[ "Compute", "the", "MFE", "for", "an", "ordered", "complex", "of", "strands", ".", "Runs", "the", "\\", "mfe", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L357-L427
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.subopt
def subopt(self, strand, gap, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the suboptimal structures within a defined energy gap of the MFE. Runs the \'subopt\' command. :param strand: Strand on which to run subopt. Strands must b...
python
def subopt(self, strand, gap, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Compute the suboptimal structures within a defined energy gap of the MFE. Runs the \'subopt\' command. :param strand: Strand on which to run subopt. Strands must b...
[ "def", "subopt", "(", "self", ",", "strand", ",", "gap", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "1.0", ",", "magnesium", "=", "0.0", ")", ":", "# Set t...
Compute the suboptimal structures within a defined energy gap of the MFE. Runs the \'subopt\' command. :param strand: Strand on which to run subopt. Strands must be either coral.DNA or coral.RNA). :type strand: coral.DNA or coral.RNA :param gap: Energy gap within ...
[ "Compute", "the", "suboptimal", "structures", "within", "a", "defined", "energy", "gap", "of", "the", "MFE", ".", "Runs", "the", "\\", "subopt", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L430-L481
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.count
def count(self, strand, pseudo=False): '''Enumerates the total number of secondary structures over the structural ensemble Ω(π). Runs the \'count\' command. :param strand: Strand on which to run count. Strands must be either coral.DNA or coral.RNA). :type strand: ...
python
def count(self, strand, pseudo=False): '''Enumerates the total number of secondary structures over the structural ensemble Ω(π). Runs the \'count\' command. :param strand: Strand on which to run count. Strands must be either coral.DNA or coral.RNA). :type strand: ...
[ "def", "count", "(", "self", ",", "strand", ",", "pseudo", "=", "False", ")", ":", "# Set up command flags", "if", "pseudo", ":", "cmd_args", "=", "[", "'-pseudo'", "]", "else", ":", "cmd_args", "=", "[", "]", "# Set up the input file and run the command", "st...
Enumerates the total number of secondary structures over the structural ensemble Ω(π). Runs the \'count\' command. :param strand: Strand on which to run count. Strands must be either coral.DNA or coral.RNA). :type strand: list :param pseudo: Enable pseudoknots. ...
[ "Enumerates", "the", "total", "number", "of", "secondary", "structures", "over", "the", "structural", "ensemble", "Ω", "(", "π", ")", ".", "Runs", "the", "\\", "count", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L548-L572
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.count_multi
def count_multi(self, strands, permutation=None, pseudo=False): '''Enumerates the total number of secondary structures over the structural ensemble Ω(π) with an ordered permutation of strands. Runs the \'count\' command. :param strands: List of strands to use as inputs to count -multi. ...
python
def count_multi(self, strands, permutation=None, pseudo=False): '''Enumerates the total number of secondary structures over the structural ensemble Ω(π) with an ordered permutation of strands. Runs the \'count\' command. :param strands: List of strands to use as inputs to count -multi. ...
[ "def", "count_multi", "(", "self", ",", "strands", ",", "permutation", "=", "None", ",", "pseudo", "=", "False", ")", ":", "# Set up command flags", "cmd_args", "=", "[", "'-multi'", "]", "if", "pseudo", ":", "cmd_args", ".", "append", "(", "'-pseudo'", ")...
Enumerates the total number of secondary structures over the structural ensemble Ω(π) with an ordered permutation of strands. Runs the \'count\' command. :param strands: List of strands to use as inputs to count -multi. :type strands: list :param permutation: The circular permut...
[ "Enumerates", "the", "total", "number", "of", "secondary", "structures", "over", "the", "structural", "ensemble", "Ω", "(", "π", ")", "with", "an", "ordered", "permutation", "of", "strands", ".", "Runs", "the", "\\", "count", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L575-L615
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.energy
def energy(self, strand, dotparens, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Calculate the free energy of a given sequence structure. Runs the \'energy\' command. :param strand: Strand on which to run energy. Strands must be either ...
python
def energy(self, strand, dotparens, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): '''Calculate the free energy of a given sequence structure. Runs the \'energy\' command. :param strand: Strand on which to run energy. Strands must be either ...
[ "def", "energy", "(", "self", ",", "strand", ",", "dotparens", ",", "temp", "=", "37.0", ",", "pseudo", "=", "False", ",", "material", "=", "None", ",", "dangles", "=", "'some'", ",", "sodium", "=", "1.0", ",", "magnesium", "=", "0.0", ")", ":", "#...
Calculate the free energy of a given sequence structure. Runs the \'energy\' command. :param strand: Strand on which to run energy. Strands must be either coral.DNA or coral.RNA). :type strand: coral.DNA or coral.RNA :param dotparens: The structure in dotparens no...
[ "Calculate", "the", "free", "energy", "of", "a", "given", "sequence", "structure", ".", "Runs", "the", "\\", "energy", "\\", "command", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L618-L668
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.complexes
def complexes(self, strands, max_size, ordered=False, pairs=False, mfe=False, cutoff=0.001, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): ''' :param strands: Strands on which to run energy. Stra...
python
def complexes(self, strands, max_size, ordered=False, pairs=False, mfe=False, cutoff=0.001, degenerate=False, temp=37.0, pseudo=False, material=None, dangles='some', sodium=1.0, magnesium=0.0): ''' :param strands: Strands on which to run energy. Stra...
[ "def", "complexes", "(", "self", ",", "strands", ",", "max_size", ",", "ordered", "=", "False", ",", "pairs", "=", "False", ",", "mfe", "=", "False", ",", "cutoff", "=", "0.001", ",", "degenerate", "=", "False", ",", "temp", "=", "37.0", ",", "pseudo...
:param strands: Strands on which to run energy. Strands must be either coral.DNA or coral.RNA). :type strands: list of coral.DNA or coral.RNA :param max_size: Maximum complex size to consider (maximum number of strand species in complex). :type max...
[ ":", "param", "strands", ":", "Strands", "on", "which", "to", "run", "energy", ".", "Strands", "must", "be", "either", "coral", ".", "DNA", "or", "coral", ".", "RNA", ")", ".", ":", "type", "strands", ":", "list", "of", "coral", ".", "DNA", "or", "...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L976-L1124
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.complexes_timeonly
def complexes_timeonly(self, strands, max_size): '''Estimate the amount of time it will take to calculate all the partition functions for each circular permutation - estimate the time the actual \'complexes\' command will take to run. :param strands: Strands on which to run energy. Stra...
python
def complexes_timeonly(self, strands, max_size): '''Estimate the amount of time it will take to calculate all the partition functions for each circular permutation - estimate the time the actual \'complexes\' command will take to run. :param strands: Strands on which to run energy. Stra...
[ "def", "complexes_timeonly", "(", "self", ",", "strands", ",", "max_size", ")", ":", "cmd_args", "=", "[", "'-quiet'", ",", "'-timeonly'", "]", "lines", "=", "self", ".", "_multi_lines", "(", "strands", ",", "[", "max_size", "]", ")", "stdout", "=", "sel...
Estimate the amount of time it will take to calculate all the partition functions for each circular permutation - estimate the time the actual \'complexes\' command will take to run. :param strands: Strands on which to run energy. Strands must be either coral.DNA or coral...
[ "Estimate", "the", "amount", "of", "time", "it", "will", "take", "to", "calculate", "all", "the", "partition", "functions", "for", "each", "circular", "permutation", "-", "estimate", "the", "time", "the", "actual", "\\", "complexes", "\\", "command", "will", ...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1127-L1146
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.concentrations
def concentrations(self, complexes, concs, ordered=False, pairs=False, cutoff=0.001, temp=37.0): ''' :param complexes: A list of the type returned by the complexes() method. :type complexes: list :param concs: The concentration(s) of each ...
python
def concentrations(self, complexes, concs, ordered=False, pairs=False, cutoff=0.001, temp=37.0): ''' :param complexes: A list of the type returned by the complexes() method. :type complexes: list :param concs: The concentration(s) of each ...
[ "def", "concentrations", "(", "self", ",", "complexes", ",", "concs", ",", "ordered", "=", "False", ",", "pairs", "=", "False", ",", "cutoff", "=", "0.001", ",", "temp", "=", "37.0", ")", ":", "# Check inputs", "nstrands", "=", "len", "(", "complexes", ...
:param complexes: A list of the type returned by the complexes() method. :type complexes: list :param concs: The concentration(s) of each strand species in the initial complex. If they are all the same, a single float can be used here...
[ ":", "param", "complexes", ":", "A", "list", "of", "the", "type", "returned", "by", "the", "complexes", "()", "method", ".", ":", "type", "complexes", ":", "list", ":", "param", "concs", ":", "The", "concentration", "(", "s", ")", "of", "each", "strand...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1149-L1242
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK.distributions
def distributions(self, complexes, counts, volume, maxstates=1e7, ordered=False, temp=37.0): '''Runs the \'distributions\' NUPACK command. Note: this is intended for a relatively small number of species (on the order of ~20 total strands for complex size ~14). :par...
python
def distributions(self, complexes, counts, volume, maxstates=1e7, ordered=False, temp=37.0): '''Runs the \'distributions\' NUPACK command. Note: this is intended for a relatively small number of species (on the order of ~20 total strands for complex size ~14). :par...
[ "def", "distributions", "(", "self", ",", "complexes", ",", "counts", ",", "volume", ",", "maxstates", "=", "1e7", ",", "ordered", "=", "False", ",", "temp", "=", "37.0", ")", ":", "# Check inputs", "nstrands", "=", "len", "(", "complexes", "[", "0", "...
Runs the \'distributions\' NUPACK command. Note: this is intended for a relatively small number of species (on the order of ~20 total strands for complex size ~14). :param complexes: A list of the type returned by the complexes() method. :type complexes: list ...
[ "Runs", "the", "\\", "distributions", "\\", "NUPACK", "command", ".", "Note", ":", "this", "is", "intended", "for", "a", "relatively", "small", "number", "of", "species", "(", "on", "the", "order", "of", "~20", "total", "strands", "for", "complex", "size",...
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1245-L1343
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK._multi_lines
def _multi_lines(self, strands, permutation): '''Prepares lines to write to file for pfunc command input. :param strand: Strand input (cr.DNA or cr.RNA). :type strand: cr.DNA or cr.DNA :param permutation: Permutation (e.g. [1, 2, 3, 4]) of the type used by pf...
python
def _multi_lines(self, strands, permutation): '''Prepares lines to write to file for pfunc command input. :param strand: Strand input (cr.DNA or cr.RNA). :type strand: cr.DNA or cr.DNA :param permutation: Permutation (e.g. [1, 2, 3, 4]) of the type used by pf...
[ "def", "_multi_lines", "(", "self", ",", "strands", ",", "permutation", ")", ":", "lines", "=", "[", "]", "# Write the total number of distinct strands", "lines", ".", "append", "(", "str", "(", "len", "(", "strands", ")", ")", ")", "# Write the distinct strands...
Prepares lines to write to file for pfunc command input. :param strand: Strand input (cr.DNA or cr.RNA). :type strand: cr.DNA or cr.DNA :param permutation: Permutation (e.g. [1, 2, 3, 4]) of the type used by pfunc_multi. :type permutation: list
[ "Prepares", "lines", "to", "write", "to", "file", "for", "pfunc", "command", "input", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1346-L1363
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK._read_tempfile
def _read_tempfile(self, filename): '''Read in and return file that's in the tempdir. :param filename: Name of the file to read. :type filename: str ''' with open(os.path.join(self._tempdir, filename)) as f: return f.read()
python
def _read_tempfile(self, filename): '''Read in and return file that's in the tempdir. :param filename: Name of the file to read. :type filename: str ''' with open(os.path.join(self._tempdir, filename)) as f: return f.read()
[ "def", "_read_tempfile", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_tempdir", ",", "filename", ")", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
Read in and return file that's in the tempdir. :param filename: Name of the file to read. :type filename: str
[ "Read", "in", "and", "return", "file", "that", "s", "in", "the", "tempdir", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1366-L1374
klavinslab/coral
coral/analysis/_structure/nupack.py
NUPACK._pairs_to_np
def _pairs_to_np(self, pairlist, dim): '''Given a set of pair probability lines, construct a numpy array. :param pairlist: a list of pair probability triples :type pairlist: list :returns: An upper triangular matrix of pair probabilities augmented with one extra column...
python
def _pairs_to_np(self, pairlist, dim): '''Given a set of pair probability lines, construct a numpy array. :param pairlist: a list of pair probability triples :type pairlist: list :returns: An upper triangular matrix of pair probabilities augmented with one extra column...
[ "def", "_pairs_to_np", "(", "self", ",", "pairlist", ",", "dim", ")", ":", "mat", "=", "np", ".", "zeros", "(", "(", "dim", ",", "dim", "+", "1", ")", ")", "for", "line", "in", "pairlist", ":", "i", "=", "int", "(", "line", "[", "0", "]", ")"...
Given a set of pair probability lines, construct a numpy array. :param pairlist: a list of pair probability triples :type pairlist: list :returns: An upper triangular matrix of pair probabilities augmented with one extra column that represents the unpaired pr...
[ "Given", "a", "set", "of", "pair", "probability", "lines", "construct", "a", "numpy", "array", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_structure/nupack.py#L1376-L1393
klavinslab/coral
coral/sequence/_dna.py
_flip_feature
def _flip_feature(self, feature, parent_len): '''Adjust a feature's location when flipping DNA. :param feature: The feature to flip. :type feature: coral.Feature :param parent_len: The length of the sequence to which the feature belongs. :type parent_len: int ''' copy = feature.copy() ...
python
def _flip_feature(self, feature, parent_len): '''Adjust a feature's location when flipping DNA. :param feature: The feature to flip. :type feature: coral.Feature :param parent_len: The length of the sequence to which the feature belongs. :type parent_len: int ''' copy = feature.copy() ...
[ "def", "_flip_feature", "(", "self", ",", "feature", ",", "parent_len", ")", ":", "copy", "=", "feature", ".", "copy", "(", ")", "# Put on the other strand", "if", "copy", ".", "strand", "==", "0", ":", "copy", ".", "strand", "=", "1", "else", ":", "co...
Adjust a feature's location when flipping DNA. :param feature: The feature to flip. :type feature: coral.Feature :param parent_len: The length of the sequence to which the feature belongs. :type parent_len: int
[ "Adjust", "a", "feature", "s", "location", "when", "flipping", "DNA", "." ]
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/sequence/_dna.py#L734-L753