repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.clear
def clear(self): ''' Method which resets any variables held by this class, so that the parser can be used again :return: Nothing ''' self.tags = [] '''the current list of tags which have been opened in the XML file''' self.chars = {} '''the chars held by...
python
def clear(self): ''' Method which resets any variables held by this class, so that the parser can be used again :return: Nothing ''' self.tags = [] '''the current list of tags which have been opened in the XML file''' self.chars = {} '''the chars held by...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "tags", "=", "[", "]", "'''the current list of tags which have been opened in the XML file'''", "self", ".", "chars", "=", "{", "}", "'''the chars held by each tag, indexed by their tag name'''", "self", ".", "attribs", ...
Method which resets any variables held by this class, so that the parser can be used again :return: Nothing
[ "Method", "which", "resets", "any", "variables", "held", "by", "this", "class", "so", "that", "the", "parser", "can", "be", "used", "again", ":", "return", ":", "Nothing" ]
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L36-L67
train
This method resets all the variables held by this class so that the parser can be used again.
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.StartTag
def StartTag(self, name, attrs): ''' A method which is called by the SAX parser when a new tag is encountered :param name: name of the tag :param attrs: the tag's attributes :return: none, side effect of modifying bits of the current class ''' if name not in self....
python
def StartTag(self, name, attrs): ''' A method which is called by the SAX parser when a new tag is encountered :param name: name of the tag :param attrs: the tag's attributes :return: none, side effect of modifying bits of the current class ''' if name not in self....
[ "def", "StartTag", "(", "self", ",", "name", ",", "attrs", ")", ":", "if", "name", "not", "in", "self", ".", "excluded", ":", "if", "name", "in", "self", ".", "structure", ".", "keys", "(", ")", ":", "self", ".", "handler", "=", "self", ".", "str...
A method which is called by the SAX parser when a new tag is encountered :param name: name of the tag :param attrs: the tag's attributes :return: none, side effect of modifying bits of the current class
[ "A", "method", "which", "is", "called", "by", "the", "SAX", "parser", "when", "a", "new", "tag", "is", "encountered", ":", "param", "name", ":", "name", "of", "the", "tag", ":", "param", "attrs", ":", "the", "tag", "s", "attributes", ":", "return", "...
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L112-L132
train
This method is called by the SAX parser when a new tag is encountered.
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.validateData
def validateData(self, text): ''' Method which validates the data from each tag, to check whether it is an empty string :param text: data to be validated :return: True or False depending on the result ''' if text == "\n": return False for c in text: ...
python
def validateData(self, text): ''' Method which validates the data from each tag, to check whether it is an empty string :param text: data to be validated :return: True or False depending on the result ''' if text == "\n": return False for c in text: ...
[ "def", "validateData", "(", "self", ",", "text", ")", ":", "if", "text", "==", "\"\\n\"", ":", "return", "False", "for", "c", "in", "text", ":", "try", ":", "if", "str", "(", "c", ")", "!=", "\" \"", ":", "return", "True", "except", ":", "return", ...
Method which validates the data from each tag, to check whether it is an empty string :param text: data to be validated :return: True or False depending on the result
[ "Method", "which", "validates", "the", "data", "from", "each", "tag", "to", "check", "whether", "it", "is", "an", "empty", "string", ":", "param", "text", ":", "data", "to", "be", "validated", ":", "return", ":", "True", "or", "False", "depending", "on",...
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L134-L148
train
Method which validates the data from each tag
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.NewData
def NewData(self, text): ''' Method which is called by the SAX parser upon encountering text inside a tag :param text: the text encountered :return: None, has side effects modifying the class itself ''' sint = ignore_exception(ValueError)(int) if len(self.tags) > ...
python
def NewData(self, text): ''' Method which is called by the SAX parser upon encountering text inside a tag :param text: the text encountered :return: None, has side effects modifying the class itself ''' sint = ignore_exception(ValueError)(int) if len(self.tags) > ...
[ "def", "NewData", "(", "self", ",", "text", ")", ":", "sint", "=", "ignore_exception", "(", "ValueError", ")", "(", "int", ")", "if", "len", "(", "self", ".", "tags", ")", ">", "0", ":", "if", "self", ".", "tags", "[", "-", "1", "]", "==", "\"b...
Method which is called by the SAX parser upon encountering text inside a tag :param text: the text encountered :return: None, has side effects modifying the class itself
[ "Method", "which", "is", "called", "by", "the", "SAX", "parser", "upon", "encountering", "text", "inside", "a", "tag", ":", "param", "text", ":", "the", "text", "encountered", ":", "return", ":", "None", "has", "side", "effects", "modifying", "the", "class...
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L150-L167
train
Method which is called by the SAX parser upon encountering text inside a tag .
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.CopyNote
def CopyNote(self, part, measure_id, new_note): ''' handles copying the latest note into the measure note list. done at end of note loading to make sure staff_id is right as staff id could be encountered any point during the note tag :param part: the part class to copy it into...
python
def CopyNote(self, part, measure_id, new_note): ''' handles copying the latest note into the measure note list. done at end of note loading to make sure staff_id is right as staff id could be encountered any point during the note tag :param part: the part class to copy it into...
[ "def", "CopyNote", "(", "self", ",", "part", ",", "measure_id", ",", "new_note", ")", ":", "if", "part", ".", "getMeasure", "(", "measure_id", ",", "self", ".", "data", "[", "\"staff_id\"", "]", ")", "is", "None", ":", "part", ".", "addEmptyMeasure", "...
handles copying the latest note into the measure note list. done at end of note loading to make sure staff_id is right as staff id could be encountered any point during the note tag :param part: the part class to copy it into :param measure_id: the id of the measure in which the note b...
[ "handles", "copying", "the", "latest", "note", "into", "the", "measure", "note", "list", ".", "done", "at", "end", "of", "note", "loading", "to", "make", "sure", "staff_id", "is", "right", "as", "staff", "id", "could", "be", "encountered", "any", "point", ...
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L169-L203
train
Copies the latest note into the tree.
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.ResetHandler
def ResetHandler(self, name): ''' Method which assigns handler to the tag encountered before the current, or else sets it to None :param name: name of the latest tag :return: ''' if name in self.tags: if len(self.tags) > 1: key = len(...
python
def ResetHandler(self, name): ''' Method which assigns handler to the tag encountered before the current, or else sets it to None :param name: name of the latest tag :return: ''' if name in self.tags: if len(self.tags) > 1: key = len(...
[ "def", "ResetHandler", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "tags", ":", "if", "len", "(", "self", ".", "tags", ")", ">", "1", ":", "key", "=", "len", "(", "self", ".", "tags", ")", "-", "2", "self", ".", "hand...
Method which assigns handler to the tag encountered before the current, or else sets it to None :param name: name of the latest tag :return:
[ "Method", "which", "assigns", "handler", "to", "the", "tag", "encountered", "before", "the", "current", "or", "else", "sets", "it", "to", "None" ]
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L205-L225
train
Method which assigns handler to the latest tag encountered before the current. If the current tag is not found then it sets it to None.
Godley/MuseParse
MuseParse/classes/Input/MxmlParser.py
MxmlParser.parse
def parse(self, file): ''' Method the programmer should call when ready to parse a file. :param file: exact file path of the file to be processed :return: PieceTree object representing the file in memory ''' parser = make_parser() self.clear() class Extra...
python
def parse(self, file): ''' Method the programmer should call when ready to parse a file. :param file: exact file path of the file to be processed :return: PieceTree object representing the file in memory ''' parser = make_parser() self.clear() class Extra...
[ "def", "parse", "(", "self", ",", "file", ")", ":", "parser", "=", "make_parser", "(", ")", "self", ".", "clear", "(", ")", "class", "Extractor", "(", "xml", ".", "sax", ".", "ContentHandler", ")", ":", "def", "__init__", "(", "self", ",", "parent", ...
Method the programmer should call when ready to parse a file. :param file: exact file path of the file to be processed :return: PieceTree object representing the file in memory
[ "Method", "the", "programmer", "should", "call", "when", "ready", "to", "parse", "a", "file", ".", ":", "param", "file", ":", "exact", "file", "path", "of", "the", "file", "to", "be", "processed", ":", "return", ":", "PieceTree", "object", "representing", ...
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Input/MxmlParser.py#L351-L382
train
Method the programmer should call when ready to parse a file.
igorcoding/asynctnt-queue
asynctnt_queue/task.py
Task.release
async def release(self, *, delay=None): """ Release task (return to queue) with delay if specified :param delay: Time in seconds before task will become ready again :return: Task instance """ return await self._tube.release(self._task_id, delay=delay)
python
async def release(self, *, delay=None): """ Release task (return to queue) with delay if specified :param delay: Time in seconds before task will become ready again :return: Task instance """ return await self._tube.release(self._task_id, delay=delay)
[ "async", "def", "release", "(", "self", ",", "*", ",", "delay", "=", "None", ")", ":", "return", "await", "self", ".", "_tube", ".", "release", "(", "self", ".", "_task_id", ",", "delay", "=", "delay", ")" ]
Release task (return to queue) with delay if specified :param delay: Time in seconds before task will become ready again :return: Task instance
[ "Release", "task", "(", "return", "to", "queue", ")", "with", "delay", "if", "specified" ]
75719b2dd27e8314ae924aea6a7a85be8f48ecc5
https://github.com/igorcoding/asynctnt-queue/blob/75719b2dd27e8314ae924aea6a7a85be8f48ecc5/asynctnt_queue/task.py#L96-L103
train
Release the task from the queue.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool.get_cluster
def get_cluster(self, label): """Returns a connection to a mongo-clusters. Args: label (string): the label of a cluster. Returns: A connection to the cluster labeld with label. Raises: AttributeError: there is no cluster with the given label in the ...
python
def get_cluster(self, label): """Returns a connection to a mongo-clusters. Args: label (string): the label of a cluster. Returns: A connection to the cluster labeld with label. Raises: AttributeError: there is no cluster with the given label in the ...
[ "def", "get_cluster", "(", "self", ",", "label", ")", ":", "for", "cluster", "in", "self", ".", "_clusters", ":", "if", "label", "==", "cluster", "[", "'label'", "]", ":", "return", "self", ".", "_get_connection", "(", "cluster", ")", "raise", "Attribute...
Returns a connection to a mongo-clusters. Args: label (string): the label of a cluster. Returns: A connection to the cluster labeld with label. Raises: AttributeError: there is no cluster with the given label in the config
[ "Returns", "a", "connection", "to", "a", "mongo", "-", "clusters", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L26-L42
train
Returns a connection to a mongo - clusters.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._validate_config
def _validate_config(config): """Validate that the provided configurtion is valid. Each dictionary in the configuration list must have the following mandatory entries : {label: {host(string), port(int), dbpath(string|list of strings)}} It can also contain 1 optional key: ...
python
def _validate_config(config): """Validate that the provided configurtion is valid. Each dictionary in the configuration list must have the following mandatory entries : {label: {host(string), port(int), dbpath(string|list of strings)}} It can also contain 1 optional key: ...
[ "def", "_validate_config", "(", "config", ")", ":", "if", "not", "isinstance", "(", "config", ",", "list", ")", ":", "raise", "TypeError", "(", "'Config must be a list'", ")", "for", "config_dict", "in", "config", ":", "if", "not", "isinstance", "(", "config...
Validate that the provided configurtion is valid. Each dictionary in the configuration list must have the following mandatory entries : {label: {host(string), port(int), dbpath(string|list of strings)}} It can also contain 1 optional key: {read_preference(string)} ...
[ "Validate", "that", "the", "provided", "configurtion", "is", "valid", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L45-L98
train
Validate that the provided configuration is valid.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._parse_configs
def _parse_configs(self, config): """Builds a dict with information to connect to Clusters. Parses the list of configuration dictionaries passed by the user and builds an internal dict (_clusters) that holds information for creating Clients connecting to Clusters and matching database n...
python
def _parse_configs(self, config): """Builds a dict with information to connect to Clusters. Parses the list of configuration dictionaries passed by the user and builds an internal dict (_clusters) that holds information for creating Clients connecting to Clusters and matching database n...
[ "def", "_parse_configs", "(", "self", ",", "config", ")", ":", "for", "config_dict", "in", "config", ":", "label", "=", "config_dict", ".", "keys", "(", ")", "[", "0", "]", "cfg", "=", "config_dict", "[", "label", "]", "# Transform dbpath to something digest...
Builds a dict with information to connect to Clusters. Parses the list of configuration dictionaries passed by the user and builds an internal dict (_clusters) that holds information for creating Clients connecting to Clusters and matching database names. Args: config: A li...
[ "Builds", "a", "dict", "with", "information", "to", "connect", "to", "Clusters", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L100-L139
train
Parses the list of configuration dictionaries passed by the user and creates a dict with information to connect to Clusters and matching database names.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._parse_dbpath
def _parse_dbpath(dbpath): """Converts the dbpath to a regexp pattern. Transforms dbpath from a string or an array of strings to a regexp pattern which will be used to match database names. Args: dbpath: a string or an array containing the databases to be matched ...
python
def _parse_dbpath(dbpath): """Converts the dbpath to a regexp pattern. Transforms dbpath from a string or an array of strings to a regexp pattern which will be used to match database names. Args: dbpath: a string or an array containing the databases to be matched ...
[ "def", "_parse_dbpath", "(", "dbpath", ")", ":", "if", "isinstance", "(", "dbpath", ",", "list", ")", ":", "# Support dbpath param as an array.", "dbpath", "=", "'|'", ".", "join", "(", "dbpath", ")", "# Append $ (end of string) so that twit will not match twitter!", ...
Converts the dbpath to a regexp pattern. Transforms dbpath from a string or an array of strings to a regexp pattern which will be used to match database names. Args: dbpath: a string or an array containing the databases to be matched from a cluster. Returns...
[ "Converts", "the", "dbpath", "to", "a", "regexp", "pattern", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L142-L164
train
Converts the dbpath to a regexp pattern.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._get_read_preference
def _get_read_preference(read_preference): """Converts read_preference from string to pymongo.ReadPreference value. Args: read_preference: string containig the read_preference from the config file Returns: A value from the pymongo.Read...
python
def _get_read_preference(read_preference): """Converts read_preference from string to pymongo.ReadPreference value. Args: read_preference: string containig the read_preference from the config file Returns: A value from the pymongo.Read...
[ "def", "_get_read_preference", "(", "read_preference", ")", ":", "read_preference", "=", "getattr", "(", "pymongo", ".", "ReadPreference", ",", "read_preference", ",", "None", ")", "if", "read_preference", "is", "None", ":", "raise", "ValueError", "(", "'Invalid r...
Converts read_preference from string to pymongo.ReadPreference value. Args: read_preference: string containig the read_preference from the config file Returns: A value from the pymongo.ReadPreference enum Raises: E...
[ "Converts", "read_preference", "from", "string", "to", "pymongo", ".", "ReadPreference", "value", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L167-L181
train
Converts read_preference from string to pymongo. ReadPreference value.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool.set_timeout
def set_timeout(self, network_timeout): """Set the timeout for existing and future Clients. Close all current connections. This will cause future operations to create new Clients with the network_timeout passed through socketTimeoutMS optional parameter. Args: netwo...
python
def set_timeout(self, network_timeout): """Set the timeout for existing and future Clients. Close all current connections. This will cause future operations to create new Clients with the network_timeout passed through socketTimeoutMS optional parameter. Args: netwo...
[ "def", "set_timeout", "(", "self", ",", "network_timeout", ")", ":", "# Do nothing if attempting to set the same timeout twice.", "if", "network_timeout", "==", "self", ".", "_network_timeout", ":", "return", "self", ".", "_network_timeout", "=", "network_timeout", "self"...
Set the timeout for existing and future Clients. Close all current connections. This will cause future operations to create new Clients with the network_timeout passed through socketTimeoutMS optional parameter. Args: network_timeout: The new value in milliseconds for the t...
[ "Set", "the", "timeout", "for", "existing", "and", "future", "Clients", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L183-L197
train
Set the timeout for existing and future Clients.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._disconnect
def _disconnect(self): """Disconnect from all MongoDB Clients.""" for cluster in self._clusters: if 'connection' in cluster: connection = cluster.pop('connection') connection.close() # Remove all attributes that are database names so that next time ...
python
def _disconnect(self): """Disconnect from all MongoDB Clients.""" for cluster in self._clusters: if 'connection' in cluster: connection = cluster.pop('connection') connection.close() # Remove all attributes that are database names so that next time ...
[ "def", "_disconnect", "(", "self", ")", ":", "for", "cluster", "in", "self", ".", "_clusters", ":", "if", "'connection'", "in", "cluster", ":", "connection", "=", "cluster", ".", "pop", "(", "'connection'", ")", "connection", ".", "close", "(", ")", "# R...
Disconnect from all MongoDB Clients.
[ "Disconnect", "from", "all", "MongoDB", "Clients", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L199-L210
train
Disconnect from all MongoDB Clients.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._get_connection
def _get_connection(self, cluster): """Return a connection to a Cluster. Return a MongoClient or a MongoReplicaSetClient for the given Cluster. This is done in a lazy manner (if there is already a Client connected to the Cluster, it is returned and no other Client is created). ...
python
def _get_connection(self, cluster): """Return a connection to a Cluster. Return a MongoClient or a MongoReplicaSetClient for the given Cluster. This is done in a lazy manner (if there is already a Client connected to the Cluster, it is returned and no other Client is created). ...
[ "def", "_get_connection", "(", "self", ",", "cluster", ")", ":", "# w=1 because:", "# http://stackoverflow.com/questions/14798552/is-mongodb-2-x-write-concern-w-1-truly-equals-to-safe-true", "if", "'connection'", "not", "in", "cluster", ":", "cluster", "[", "'connection'", "]",...
Return a connection to a Cluster. Return a MongoClient or a MongoReplicaSetClient for the given Cluster. This is done in a lazy manner (if there is already a Client connected to the Cluster, it is returned and no other Client is created). Args: cluster: A dict containing in...
[ "Return", "a", "connection", "to", "a", "Cluster", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L212-L235
train
Return a connection to a Cluster.
uberVU/mongo-pool
mongo_pool/mongo_pool.py
MongoPool._match_dbname
def _match_dbname(self, dbname): """Map a database name to the Cluster that holds the database. Args: dbname: A database name. Returns: A dict containing the information about the Cluster that holds the database. """ for config in self._clust...
python
def _match_dbname(self, dbname): """Map a database name to the Cluster that holds the database. Args: dbname: A database name. Returns: A dict containing the information about the Cluster that holds the database. """ for config in self._clust...
[ "def", "_match_dbname", "(", "self", ",", "dbname", ")", ":", "for", "config", "in", "self", ".", "_clusters", ":", "if", "re", ".", "match", "(", "config", "[", "'pattern'", "]", ",", "dbname", ")", ":", "return", "config", "raise", "Exception", "(", ...
Map a database name to the Cluster that holds the database. Args: dbname: A database name. Returns: A dict containing the information about the Cluster that holds the database.
[ "Map", "a", "database", "name", "to", "the", "Cluster", "that", "holds", "the", "database", "." ]
286d1d8e0b3c17d5d7d4860487fe69358941067d
https://github.com/uberVU/mongo-pool/blob/286d1d8e0b3c17d5d7d4860487fe69358941067d/mongo_pool/mongo_pool.py#L237-L250
train
Map a database name to the Cluster that holds the database.
MacHu-GWU/single_file_module-project
sfm/flow.py
try_ntime
def try_ntime(max_try, func, *args, **kwargs): """ Try execute a function n times, until no exception raised or tried ``max_try`` times. **中文文档** 反复尝试执行一个函数若干次。直到成功为止或是重复尝试 ``max_try`` 次。期间 只要有一次成功, 就正常返回。如果一次都没有成功, 则行为跟最后一次执行了 ``func(*args, **kwargs)`` 一样。 """ if max_try < 1: ...
python
def try_ntime(max_try, func, *args, **kwargs): """ Try execute a function n times, until no exception raised or tried ``max_try`` times. **中文文档** 反复尝试执行一个函数若干次。直到成功为止或是重复尝试 ``max_try`` 次。期间 只要有一次成功, 就正常返回。如果一次都没有成功, 则行为跟最后一次执行了 ``func(*args, **kwargs)`` 一样。 """ if max_try < 1: ...
[ "def", "try_ntime", "(", "max_try", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "max_try", "<", "1", ":", "raise", "ValueError", "for", "i", "in", "range", "(", "max_try", ")", ":", "try", ":", "return", "func", "(", "...
Try execute a function n times, until no exception raised or tried ``max_try`` times. **中文文档** 反复尝试执行一个函数若干次。直到成功为止或是重复尝试 ``max_try`` 次。期间 只要有一次成功, 就正常返回。如果一次都没有成功, 则行为跟最后一次执行了 ``func(*args, **kwargs)`` 一样。
[ "Try", "execute", "a", "function", "n", "times", "until", "no", "exception", "raised", "or", "tried", "max_try", "times", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/flow.py#L9-L29
train
Try execute a function n times until no exception raised or tried is reached.
MounirMesselmeni/django-highlightjs
highlightjs/templatetags/highlightjs.py
highlightjs_javascript
def highlightjs_javascript(jquery=None): """ Return HTML for highlightjs JavaScript. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag n...
python
def highlightjs_javascript(jquery=None): """ Return HTML for highlightjs JavaScript. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag n...
[ "def", "highlightjs_javascript", "(", "jquery", "=", "None", ")", ":", "javascript", "=", "''", "# See if we have to include jQuery", "if", "jquery", "is", "None", ":", "jquery", "=", "get_highlightjs_setting", "(", "'include_jquery'", ",", "False", ")", "if", "jq...
Return HTML for highlightjs JavaScript. Adjust url in settings. If no url is returned, we don't want this statement to return any HTML. This is intended behavior. Default value: ``None`` This value is configurable, see Settings section **Tag name**:: highlightjs_javascript **Parame...
[ "Return", "HTML", "for", "highlightjs", "JavaScript", "." ]
3758cae67ed15f38641fb51a71ca9ed85af78345
https://github.com/MounirMesselmeni/django-highlightjs/blob/3758cae67ed15f38641fb51a71ca9ed85af78345/highlightjs/templatetags/highlightjs.py#L39-L79
train
Return HTML for highlightjs JavaScript.
Godley/MuseParse
MuseParse/classes/ObjectHierarchy/TreeClasses/StaffNode.py
StaffNode.toLily
def toLily(self): ''' Method which converts the object instance, its attributes and children to a string of lilypond code :return: str of lilypond code ''' lilystring = "" if not self.autoBeam: lilystring += "\\autoBeamOff" children = self.SortedChi...
python
def toLily(self): ''' Method which converts the object instance, its attributes and children to a string of lilypond code :return: str of lilypond code ''' lilystring = "" if not self.autoBeam: lilystring += "\\autoBeamOff" children = self.SortedChi...
[ "def", "toLily", "(", "self", ")", ":", "lilystring", "=", "\"\"", "if", "not", "self", ".", "autoBeam", ":", "lilystring", "+=", "\"\\\\autoBeamOff\"", "children", "=", "self", ".", "SortedChildren", "(", ")", "if", "not", "hasattr", "(", "self", ",", "...
Method which converts the object instance, its attributes and children to a string of lilypond code :return: str of lilypond code
[ "Method", "which", "converts", "the", "object", "instance", "its", "attributes", "and", "children", "to", "a", "string", "of", "lilypond", "code" ]
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/ObjectHierarchy/TreeClasses/StaffNode.py#L57-L76
train
Method which converts the object instance its attributes and children to a string of lilypond code.
ariebovenberg/snug
tutorial/composed0.py
repo
def repo(name: str, owner: str) -> snug.Query[dict]: """a repository lookup by owner and name""" return json.loads((yield f'/repos/{owner}/{name}').content)
python
def repo(name: str, owner: str) -> snug.Query[dict]: """a repository lookup by owner and name""" return json.loads((yield f'/repos/{owner}/{name}').content)
[ "def", "repo", "(", "name", ":", "str", ",", "owner", ":", "str", ")", "->", "snug", ".", "Query", "[", "dict", "]", ":", "return", "json", ".", "loads", "(", "(", "yield", "f'/repos/{owner}/{name}'", ")", ".", "content", ")" ]
a repository lookup by owner and name
[ "a", "repository", "lookup", "by", "owner", "and", "name" ]
4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef
https://github.com/ariebovenberg/snug/blob/4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef/tutorial/composed0.py#L13-L15
train
a repository lookup by owner and name
pyros-dev/pyzmp
pyzmp/node.py
Node.start
def start(self, timeout=None): """ Start child process :param timeout: the maximum time to wait for child process to report it has actually started. None waits until the update has been called at least once. """ started = super(Node, self).start(timeout=timeout) ...
python
def start(self, timeout=None): """ Start child process :param timeout: the maximum time to wait for child process to report it has actually started. None waits until the update has been called at least once. """ started = super(Node, self).start(timeout=timeout) ...
[ "def", "start", "(", "self", ",", "timeout", "=", "None", ")", ":", "started", "=", "super", "(", "Node", ",", "self", ")", ".", "start", "(", "timeout", "=", "timeout", ")", "if", "started", ":", "# TODO : return something produced in the context manager pass...
Start child process :param timeout: the maximum time to wait for child process to report it has actually started. None waits until the update has been called at least once.
[ "Start", "child", "process", ":", "param", "timeout", ":", "the", "maximum", "time", "to", "wait", "for", "child", "process", "to", "report", "it", "has", "actually", "started", ".", "None", "waits", "until", "the", "update", "has", "been", "called", "at",...
fac0b719b25996ce94a80ca2118f3eba5779d53d
https://github.com/pyros-dev/pyzmp/blob/fac0b719b25996ce94a80ca2118f3eba5779d53d/pyzmp/node.py#L161-L175
train
Start the child process.
ariebovenberg/snug
tutorial/executing_queries.py
repo
def repo(name: str, owner: str) -> snug.Query[dict]: """a repo lookup by owner and name""" request = snug.GET(f'https://api.github.com/repos/{owner}/{name}') response = yield request return json.loads(response.content)
python
def repo(name: str, owner: str) -> snug.Query[dict]: """a repo lookup by owner and name""" request = snug.GET(f'https://api.github.com/repos/{owner}/{name}') response = yield request return json.loads(response.content)
[ "def", "repo", "(", "name", ":", "str", ",", "owner", ":", "str", ")", "->", "snug", ".", "Query", "[", "dict", "]", ":", "request", "=", "snug", ".", "GET", "(", "f'https://api.github.com/repos/{owner}/{name}'", ")", "response", "=", "yield", "request", ...
a repo lookup by owner and name
[ "a", "repo", "lookup", "by", "owner", "and", "name" ]
4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef
https://github.com/ariebovenberg/snug/blob/4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef/tutorial/executing_queries.py#L6-L10
train
a repo lookup by owner and name
ariebovenberg/snug
tutorial/executing_queries.py
follow
def follow(name: str) -> snug.Query[bool]: """follow another user""" request = snug.PUT(f'https://api.github.com/user/following/{name}') response = yield request return response.status_code == 204
python
def follow(name: str) -> snug.Query[bool]: """follow another user""" request = snug.PUT(f'https://api.github.com/user/following/{name}') response = yield request return response.status_code == 204
[ "def", "follow", "(", "name", ":", "str", ")", "->", "snug", ".", "Query", "[", "bool", "]", ":", "request", "=", "snug", ".", "PUT", "(", "f'https://api.github.com/user/following/{name}'", ")", "response", "=", "yield", "request", "return", "response", ".",...
follow another user
[ "follow", "another", "user" ]
4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef
https://github.com/ariebovenberg/snug/blob/4f5cd30e6b7b2c3f0ad3cc10be865bd8900b38ef/tutorial/executing_queries.py#L13-L17
train
follow another user
envi-idl/envipyengine
envipyengine/taskengine/task.py
Task.taskinfo
def taskinfo(self): """ Retrieve the Task Information """ task_input = {'taskName': 'QueryTask', 'inputParameters': {"Task_Name": self._name}} info = taskengine.execute(task_input, self._engine, cwd=self._cwd) task_def = info['outputParameters']['DEFINITI...
python
def taskinfo(self): """ Retrieve the Task Information """ task_input = {'taskName': 'QueryTask', 'inputParameters': {"Task_Name": self._name}} info = taskengine.execute(task_input, self._engine, cwd=self._cwd) task_def = info['outputParameters']['DEFINITI...
[ "def", "taskinfo", "(", "self", ")", ":", "task_input", "=", "{", "'taskName'", ":", "'QueryTask'", ",", "'inputParameters'", ":", "{", "\"Task_Name\"", ":", "self", ".", "_name", "}", "}", "info", "=", "taskengine", ".", "execute", "(", "task_input", ",",...
Retrieve the Task Information
[ "Retrieve", "the", "Task", "Information" ]
567b639d6592deec3289f6122a9e3d18f2f98432
https://github.com/envi-idl/envipyengine/blob/567b639d6592deec3289f6122a9e3d18f2f98432/envipyengine/taskengine/task.py#L57-L133
train
Retrieve the Task Information
TylerTemp/docpie
docpie/element.py
Either.fix_argument_only
def fix_argument_only(self): ''' fix_argument_only() -> Either or Unit(Argument) `<arg> | ARG | <arg3>` -> `Required(Argument('<arg>', 'ARG', '<arg3>'))` `[<arg>] | [ARG] | [<arg3>]` -> `Optional(Argument('<arg>', 'ARG', '<arg3>'))` `(<arg>) | [ARG]...
python
def fix_argument_only(self): ''' fix_argument_only() -> Either or Unit(Argument) `<arg> | ARG | <arg3>` -> `Required(Argument('<arg>', 'ARG', '<arg3>'))` `[<arg>] | [ARG] | [<arg3>]` -> `Optional(Argument('<arg>', 'ARG', '<arg3>'))` `(<arg>) | [ARG]...
[ "def", "fix_argument_only", "(", "self", ")", ":", "# for idx, branch in enumerate(self):\r", "# if isinstance(branch[0], Either):\r", "# self[idx] = branch.fix()\r", "first_type", "=", "type", "(", "self", "[", "0", "]", ")", "if", "first_type", "not", "in", ...
fix_argument_only() -> Either or Unit(Argument) `<arg> | ARG | <arg3>` -> `Required(Argument('<arg>', 'ARG', '<arg3>'))` `[<arg>] | [ARG] | [<arg3>]` -> `Optional(Argument('<arg>', 'ARG', '<arg3>'))` `(<arg>) | [ARG]` -> not change, return self `-a | --bette...
[ "fix_argument_only", "()", "-", ">", "Either", "or", "Unit", "(", "Argument", ")", "<arg", ">", "|", "ARG", "|", "<arg3", ">", "-", ">", "Required", "(", "Argument", "(", "<arg", ">", "ARG", "<arg3", ">", "))", "[", "<arg", ">", "]", "|", "[", "A...
e658454b81b6c79a020d499f12ad73496392c09a
https://github.com/TylerTemp/docpie/blob/e658454b81b6c79a020d499f12ad73496392c09a/docpie/element.py#L1517-L1545
train
Fixes the argument only of the tuple.
koszullab/metaTOR
metator/scripts/hicstuff.py
despeckle_simple
def despeckle_simple(B, th2=2): """Single-chromosome despeckling Simple speckle removing function on a single chromomsome. It also works for multiple chromosomes but trends may be disrupted. Parameters ---------- B : array_like The input matrix to despeckle th2 : float The ...
python
def despeckle_simple(B, th2=2): """Single-chromosome despeckling Simple speckle removing function on a single chromomsome. It also works for multiple chromosomes but trends may be disrupted. Parameters ---------- B : array_like The input matrix to despeckle th2 : float The ...
[ "def", "despeckle_simple", "(", "B", ",", "th2", "=", "2", ")", ":", "A", "=", "np", ".", "copy", "(", "B", ")", "n1", "=", "A", ".", "shape", "[", "0", "]", "dist", "=", "{", "u", ":", "np", ".", "diag", "(", "A", ",", "u", ")", "for", ...
Single-chromosome despeckling Simple speckle removing function on a single chromomsome. It also works for multiple chromosomes but trends may be disrupted. Parameters ---------- B : array_like The input matrix to despeckle th2 : float The number of standard deviations above the...
[ "Single", "-", "chromosome", "despeckling" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L32-L70
train
Single - chromosome despeckling function on a single chromomsome.
koszullab/metaTOR
metator/scripts/hicstuff.py
despeckle_global
def despeckle_global(M, positions=None, stds=2): """Compute a trend by averaging all contacts of equal distance, then sets outstanding values (above stds standard deviations) to the expected value from the trend. """ N = np.array(M, dtype=np.float64) n, m = M.shape if positions is None: ...
python
def despeckle_global(M, positions=None, stds=2): """Compute a trend by averaging all contacts of equal distance, then sets outstanding values (above stds standard deviations) to the expected value from the trend. """ N = np.array(M, dtype=np.float64) n, m = M.shape if positions is None: ...
[ "def", "despeckle_global", "(", "M", ",", "positions", "=", "None", ",", "stds", "=", "2", ")", ":", "N", "=", "np", ".", "array", "(", "M", ",", "dtype", "=", "np", ".", "float64", ")", "n", ",", "m", "=", "M", ".", "shape", "if", "positions",...
Compute a trend by averaging all contacts of equal distance, then sets outstanding values (above stds standard deviations) to the expected value from the trend.
[ "Compute", "a", "trend", "by", "averaging", "all", "contacts", "of", "equal", "distance", "then", "sets", "outstanding", "values", "(", "above", "stds", "standard", "deviations", ")", "to", "the", "expected", "value", "from", "the", "trend", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L73-L115
train
Compute a trend by averaging all contacts of equal distance then sets outstanding values above stds standard deviations to the expected value from the trend.
koszullab/metaTOR
metator/scripts/hicstuff.py
despeckle_local
def despeckle_local(M, stds=2, width=2): """Replace outstanding values (above stds standard deviations) in a matrix by the average of a surrounding window of desired width. """ N = np.array(M, dtype=np.float64) n, m = M.shape for i, j in itertools.product(range(width, n - width), ...
python
def despeckle_local(M, stds=2, width=2): """Replace outstanding values (above stds standard deviations) in a matrix by the average of a surrounding window of desired width. """ N = np.array(M, dtype=np.float64) n, m = M.shape for i, j in itertools.product(range(width, n - width), ...
[ "def", "despeckle_local", "(", "M", ",", "stds", "=", "2", ",", "width", "=", "2", ")", ":", "N", "=", "np", ".", "array", "(", "M", ",", "dtype", "=", "np", ".", "float64", ")", "n", ",", "m", "=", "M", ".", "shape", "for", "i", ",", "j", ...
Replace outstanding values (above stds standard deviations) in a matrix by the average of a surrounding window of desired width.
[ "Replace", "outstanding", "values", "(", "above", "stds", "standard", "deviations", ")", "in", "a", "matrix", "by", "the", "average", "of", "a", "surrounding", "window", "of", "desired", "width", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L118-L132
train
Local despeckle algorithm for local system
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_dense
def bin_dense(M, subsampling_factor=3): """Sum over each block of given subsampling factor, returns a matrix whose dimensions are this much as small (e.g. a 27x27 matrix binned with a subsampling factor equal to 3 will return a 9x9 matrix whose each component is the sum of the corresponding 3x3 block in...
python
def bin_dense(M, subsampling_factor=3): """Sum over each block of given subsampling factor, returns a matrix whose dimensions are this much as small (e.g. a 27x27 matrix binned with a subsampling factor equal to 3 will return a 9x9 matrix whose each component is the sum of the corresponding 3x3 block in...
[ "def", "bin_dense", "(", "M", ",", "subsampling_factor", "=", "3", ")", ":", "m", "=", "min", "(", "M", ".", "shape", ")", "n", "=", "(", "m", "//", "subsampling_factor", ")", "*", "subsampling_factor", "if", "n", "==", "0", ":", "return", "np", "....
Sum over each block of given subsampling factor, returns a matrix whose dimensions are this much as small (e.g. a 27x27 matrix binned with a subsampling factor equal to 3 will return a 9x9 matrix whose each component is the sum of the corresponding 3x3 block in the original matrix). Remaining columns an...
[ "Sum", "over", "each", "block", "of", "given", "subsampling", "factor", "returns", "a", "matrix", "whose", "dimensions", "are", "this", "much", "as", "small", "(", "e", ".", "g", ".", "a", "27x27", "matrix", "binned", "with", "a", "subsampling", "factor", ...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L135-L171
train
Sum over each block of given subsampling factor returns a matrix whose dimensions are this much as small
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_sparse
def bin_sparse(M, subsampling_factor=3): """Perform the bin_dense procedure for sparse matrices. Remaining rows and cols are lumped with the rest at the end. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense binni...
python
def bin_sparse(M, subsampling_factor=3): """Perform the bin_dense procedure for sparse matrices. Remaining rows and cols are lumped with the rest at the end. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense binni...
[ "def", "bin_sparse", "(", "M", ",", "subsampling_factor", "=", "3", ")", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "coo_matrix", "except", "ImportError", "as", "e", ":", "print", "(", "str", "(", "e", ")", ")", "print", "(", "\"I am pe...
Perform the bin_dense procedure for sparse matrices. Remaining rows and cols are lumped with the rest at the end.
[ "Perform", "the", "bin_dense", "procedure", "for", "sparse", "matrices", ".", "Remaining", "rows", "and", "cols", "are", "lumped", "with", "the", "rest", "at", "the", "end", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L174-L205
train
Perform the bin_dense procedure for sparse matrices.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_matrix
def bin_matrix(M, subsampling_factor=3): """Bin either sparse or dense matrices. """ try: from scipy.sparse import issparse if issparse(M): return bin_sparse(M, subsampling_factor=subsampling_factor) else: raise ImportError except ImportError: ret...
python
def bin_matrix(M, subsampling_factor=3): """Bin either sparse or dense matrices. """ try: from scipy.sparse import issparse if issparse(M): return bin_sparse(M, subsampling_factor=subsampling_factor) else: raise ImportError except ImportError: ret...
[ "def", "bin_matrix", "(", "M", ",", "subsampling_factor", "=", "3", ")", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "issparse", "if", "issparse", "(", "M", ")", ":", "return", "bin_sparse", "(", "M", ",", "subsampling_factor", "=", "subsa...
Bin either sparse or dense matrices.
[ "Bin", "either", "sparse", "or", "dense", "matrices", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L208-L219
train
Bin either sparse or dense matrices.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_annotation
def bin_annotation(annotation=None, subsampling_factor=3): """Perform binning on genome annotations such as contig information or bin positions. """ if annotation is None: annotation = np.array([]) n = len(annotation) binned_positions = [annotation[i] for i in range(n) if ...
python
def bin_annotation(annotation=None, subsampling_factor=3): """Perform binning on genome annotations such as contig information or bin positions. """ if annotation is None: annotation = np.array([]) n = len(annotation) binned_positions = [annotation[i] for i in range(n) if ...
[ "def", "bin_annotation", "(", "annotation", "=", "None", ",", "subsampling_factor", "=", "3", ")", ":", "if", "annotation", "is", "None", ":", "annotation", "=", "np", ".", "array", "(", "[", "]", ")", "n", "=", "len", "(", "annotation", ")", "binned_p...
Perform binning on genome annotations such as contig information or bin positions.
[ "Perform", "binning", "on", "genome", "annotations", "such", "as", "contig", "information", "or", "bin", "positions", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L222-L234
train
Perform binning on genome annotations such as contig information or bin positions.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_measurement
def bin_measurement(measurement=None, subsampling_factor=3): """Perform binning on genome-wide measurements by summing each component in a window of variable size (subsampling_factor). """ subs = int(subsampling_factor) if measurement is None: measurement = np.array([]) n = len(measurem...
python
def bin_measurement(measurement=None, subsampling_factor=3): """Perform binning on genome-wide measurements by summing each component in a window of variable size (subsampling_factor). """ subs = int(subsampling_factor) if measurement is None: measurement = np.array([]) n = len(measurem...
[ "def", "bin_measurement", "(", "measurement", "=", "None", ",", "subsampling_factor", "=", "3", ")", ":", "subs", "=", "int", "(", "subsampling_factor", ")", "if", "measurement", "is", "None", ":", "measurement", "=", "np", ".", "array", "(", "[", "]", "...
Perform binning on genome-wide measurements by summing each component in a window of variable size (subsampling_factor).
[ "Perform", "binning", "on", "genome", "-", "wide", "measurements", "by", "summing", "each", "component", "in", "a", "window", "of", "variable", "size", "(", "subsampling_factor", ")", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L237-L248
train
Perform binning on genome - wide measurements by summing each component in a window of variable size subsampling_factor.
koszullab/metaTOR
metator/scripts/hicstuff.py
build_pyramid
def build_pyramid(M, subsampling_factor=3): """Iterate over a given number of times on matrix M so as to compute smaller and smaller matrices with bin_dense. """ subs = int(subsampling_factor) if subs < 1: raise ValueError( "Subsampling factor needs to be an integer greater than...
python
def build_pyramid(M, subsampling_factor=3): """Iterate over a given number of times on matrix M so as to compute smaller and smaller matrices with bin_dense. """ subs = int(subsampling_factor) if subs < 1: raise ValueError( "Subsampling factor needs to be an integer greater than...
[ "def", "build_pyramid", "(", "M", ",", "subsampling_factor", "=", "3", ")", ":", "subs", "=", "int", "(", "subsampling_factor", ")", "if", "subs", "<", "1", ":", "raise", "ValueError", "(", "\"Subsampling factor needs to be an integer greater than 1.\"", ")", "N",...
Iterate over a given number of times on matrix M so as to compute smaller and smaller matrices with bin_dense.
[ "Iterate", "over", "a", "given", "number", "of", "times", "on", "matrix", "M", "so", "as", "to", "compute", "smaller", "and", "smaller", "matrices", "with", "bin_dense", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L251-L263
train
Build a list of numpy arrays that can be used to compute smaller and smaller matrices with bin_dense.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_kb_dense
def bin_kb_dense(M, positions, length=10, contigs=None): """Perform binning with a fixed genomic length in kilobase pairs (kb). Fragments will be binned such that their total length is closest to the specified input. If a contig list is specified, binning will be performed such that fragments never ...
python
def bin_kb_dense(M, positions, length=10, contigs=None): """Perform binning with a fixed genomic length in kilobase pairs (kb). Fragments will be binned such that their total length is closest to the specified input. If a contig list is specified, binning will be performed such that fragments never ...
[ "def", "bin_kb_dense", "(", "M", ",", "positions", ",", "length", "=", "10", ",", "contigs", "=", "None", ")", ":", "unit", "=", "10", "**", "3", "ul", "=", "unit", "*", "length", "unit", "=", "positions", "/", "ul", "n", "=", "len", "(", "positi...
Perform binning with a fixed genomic length in kilobase pairs (kb). Fragments will be binned such that their total length is closest to the specified input. If a contig list is specified, binning will be performed such that fragments never overlap two contigs.
[ "Perform", "binning", "with", "a", "fixed", "genomic", "length", "in", "kilobase", "pairs", "(", "kb", ")", ".", "Fragments", "will", "be", "binned", "such", "that", "their", "total", "length", "is", "closest", "to", "the", "specified", "input", ".", "If",...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L266-L287
train
Perform binning with a fixed genomic length in kilobase pairs.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_exact_kb_dense
def bin_exact_kb_dense(M, positions, length=10): """Perform the kb-binning procedure with total bin lengths being exactly set to that of the specified input. Fragments overlapping two potential bins will be split and related contact counts will be divided according to overlap proportions in each bin. ...
python
def bin_exact_kb_dense(M, positions, length=10): """Perform the kb-binning procedure with total bin lengths being exactly set to that of the specified input. Fragments overlapping two potential bins will be split and related contact counts will be divided according to overlap proportions in each bin. ...
[ "def", "bin_exact_kb_dense", "(", "M", ",", "positions", ",", "length", "=", "10", ")", ":", "unit", "=", "10", "**", "3", "ul", "=", "unit", "*", "length", "units", "=", "positions", "/", "ul", "n", "=", "len", "(", "positions", ")", "idx", "=", ...
Perform the kb-binning procedure with total bin lengths being exactly set to that of the specified input. Fragments overlapping two potential bins will be split and related contact counts will be divided according to overlap proportions in each bin.
[ "Perform", "the", "kb", "-", "binning", "procedure", "with", "total", "bin", "lengths", "being", "exactly", "set", "to", "that", "of", "the", "specified", "input", ".", "Fragments", "overlapping", "two", "potential", "bins", "will", "be", "split", "and", "re...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L290-L311
train
Perform the kb - binning procedure with total bin lengths being exactly set to that of the specified input.
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_kb_sparse
def bin_kb_sparse(M, positions, length=10): """Perform the exact kb-binning procedure on a sparse matrix. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return bin_kb_dense(M.tod...
python
def bin_kb_sparse(M, positions, length=10): """Perform the exact kb-binning procedure on a sparse matrix. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return bin_kb_dense(M.tod...
[ "def", "bin_kb_sparse", "(", "M", ",", "positions", ",", "length", "=", "10", ")", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "coo_matrix", "except", "ImportError", "as", "e", ":", "print", "(", "str", "(", "e", ")", ")", "print", "("...
Perform the exact kb-binning procedure on a sparse matrix.
[ "Perform", "the", "exact", "kb", "-", "binning", "procedure", "on", "a", "sparse", "matrix", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L314-L334
train
Perform the exact kb - binning procedure on a sparse matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
trim_dense
def trim_dense(M, n_std=3, s_min=None, s_max=None): """By default, return a matrix stripped of component vectors whose sparsity (i.e. total contact count on a single column or row) deviates more than specified number of standard deviations from the mean. Boolean variables s_min and s_max act as abso...
python
def trim_dense(M, n_std=3, s_min=None, s_max=None): """By default, return a matrix stripped of component vectors whose sparsity (i.e. total contact count on a single column or row) deviates more than specified number of standard deviations from the mean. Boolean variables s_min and s_max act as abso...
[ "def", "trim_dense", "(", "M", ",", "n_std", "=", "3", ",", "s_min", "=", "None", ",", "s_max", "=", "None", ")", ":", "M", "=", "np", ".", "array", "(", "M", ")", "sparsity", "=", "M", ".", "sum", "(", "axis", "=", "1", ")", "mean", "=", "...
By default, return a matrix stripped of component vectors whose sparsity (i.e. total contact count on a single column or row) deviates more than specified number of standard deviations from the mean. Boolean variables s_min and s_max act as absolute fixed values which override such behaviour when sp...
[ "By", "default", "return", "a", "matrix", "stripped", "of", "component", "vectors", "whose", "sparsity", "(", "i", ".", "e", ".", "total", "contact", "count", "on", "a", "single", "column", "or", "row", ")", "deviates", "more", "than", "specified", "number...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L337-L358
train
By default return a matrix stripped of component vectors whose sparsity is greater than specified number of standard deviations from the mean.
koszullab/metaTOR
metator/scripts/hicstuff.py
trim_sparse
def trim_sparse(M, n_std=3, s_min=None, s_max=None): """Apply the trimming procedure to a sparse matrix. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return trim_dense(M.todens...
python
def trim_sparse(M, n_std=3, s_min=None, s_max=None): """Apply the trimming procedure to a sparse matrix. """ try: from scipy.sparse import coo_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return trim_dense(M.todens...
[ "def", "trim_sparse", "(", "M", ",", "n_std", "=", "3", ",", "s_min", "=", "None", ",", "s_max", "=", "None", ")", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "coo_matrix", "except", "ImportError", "as", "e", ":", "print", "(", "str", ...
Apply the trimming procedure to a sparse matrix.
[ "Apply", "the", "trimming", "procedure", "to", "a", "sparse", "matrix", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L361-L386
train
Apply the trimming procedure to a sparse matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
normalize_dense
def normalize_dense(M, norm="frag", order=1, iterations=3): """Apply one of the many normalization types to input dense matrix. Will also apply any callable norms such as a user-made or a lambda function. """ s = np.array(M, np.float64) floatorder = np.float64(order) if norm == "SCN": ...
python
def normalize_dense(M, norm="frag", order=1, iterations=3): """Apply one of the many normalization types to input dense matrix. Will also apply any callable norms such as a user-made or a lambda function. """ s = np.array(M, np.float64) floatorder = np.float64(order) if norm == "SCN": ...
[ "def", "normalize_dense", "(", "M", ",", "norm", "=", "\"frag\"", ",", "order", "=", "1", ",", "iterations", "=", "3", ")", ":", "s", "=", "np", ".", "array", "(", "M", ",", "np", ".", "float64", ")", "floatorder", "=", "np", ".", "float64", "(",...
Apply one of the many normalization types to input dense matrix. Will also apply any callable norms such as a user-made or a lambda function.
[ "Apply", "one", "of", "the", "many", "normalization", "types", "to", "input", "dense", "matrix", ".", "Will", "also", "apply", "any", "callable", "norms", "such", "as", "a", "user", "-", "made", "or", "a", "lambda", "function", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L389-L440
train
Apply one of the many normalization types to input dense matrix. Will also apply any callable norms such as a user - made or a lambda function.
koszullab/metaTOR
metator/scripts/hicstuff.py
normalize_sparse
def normalize_sparse(M, norm="frag", order=1, iterations=3): """Applies a normalization type to a sparse matrix. """ try: from scipy.sparse import csr_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return normalize_d...
python
def normalize_sparse(M, norm="frag", order=1, iterations=3): """Applies a normalization type to a sparse matrix. """ try: from scipy.sparse import csr_matrix except ImportError as e: print(str(e)) print("I am peforming dense normalization by default.") return normalize_d...
[ "def", "normalize_sparse", "(", "M", ",", "norm", "=", "\"frag\"", ",", "order", "=", "1", ",", "iterations", "=", "3", ")", ":", "try", ":", "from", "scipy", ".", "sparse", "import", "csr_matrix", "except", "ImportError", "as", "e", ":", "print", "(",...
Applies a normalization type to a sparse matrix.
[ "Applies", "a", "normalization", "type", "to", "a", "sparse", "matrix", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L443-L476
train
Applies a normalization type to a sparse matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
GC_partial
def GC_partial(portion): """Manually compute GC content percentage in a DNA string, taking ambiguous values into account (according to standard IUPAC notation). """ sequence_count = collections.Counter(portion) gc = ((sum([sequence_count[i] for i in 'gGcCsS']) + sum([sequence_count[i] for...
python
def GC_partial(portion): """Manually compute GC content percentage in a DNA string, taking ambiguous values into account (according to standard IUPAC notation). """ sequence_count = collections.Counter(portion) gc = ((sum([sequence_count[i] for i in 'gGcCsS']) + sum([sequence_count[i] for...
[ "def", "GC_partial", "(", "portion", ")", ":", "sequence_count", "=", "collections", ".", "Counter", "(", "portion", ")", "gc", "=", "(", "(", "sum", "(", "[", "sequence_count", "[", "i", "]", "for", "i", "in", "'gGcCsS'", "]", ")", "+", "sum", "(", ...
Manually compute GC content percentage in a DNA string, taking ambiguous values into account (according to standard IUPAC notation).
[ "Manually", "compute", "GC", "content", "percentage", "in", "a", "DNA", "string", "taking", "ambiguous", "values", "into", "account", "(", "according", "to", "standard", "IUPAC", "notation", ")", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L479-L489
train
Manually compute GC content percentage in a DNA string taking any ambiguous values into account.
koszullab/metaTOR
metator/scripts/hicstuff.py
GC_wide
def GC_wide(genome, window=1000): """Compute GC across a window of given length. :note: Requires Biopython """ GC = [] from Bio import SeqIO with open(genome) as handle: sequence = "".join([str(record.seq) for record in SeqIO.parse(handle, "fasta")]) n ...
python
def GC_wide(genome, window=1000): """Compute GC across a window of given length. :note: Requires Biopython """ GC = [] from Bio import SeqIO with open(genome) as handle: sequence = "".join([str(record.seq) for record in SeqIO.parse(handle, "fasta")]) n ...
[ "def", "GC_wide", "(", "genome", ",", "window", "=", "1000", ")", ":", "GC", "=", "[", "]", "from", "Bio", "import", "SeqIO", "with", "open", "(", "genome", ")", "as", "handle", ":", "sequence", "=", "\"\"", ".", "join", "(", "[", "str", "(", "re...
Compute GC across a window of given length. :note: Requires Biopython
[ "Compute", "GC", "across", "a", "window", "of", "given", "length", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L492-L509
train
Compute a window of length window across a genome.
koszullab/metaTOR
metator/scripts/hicstuff.py
split_genome
def split_genome(genome, chunk_size=10000): """Split genome into chunks of fixed size (save the last one). """ chunks = [] from Bio import SeqIO with open(genome) as handle: for record in SeqIO.parse(handle, "fasta"): sequence = record.seq n = len(sequence) ...
python
def split_genome(genome, chunk_size=10000): """Split genome into chunks of fixed size (save the last one). """ chunks = [] from Bio import SeqIO with open(genome) as handle: for record in SeqIO.parse(handle, "fasta"): sequence = record.seq n = len(sequence) ...
[ "def", "split_genome", "(", "genome", ",", "chunk_size", "=", "10000", ")", ":", "chunks", "=", "[", "]", "from", "Bio", "import", "SeqIO", "with", "open", "(", "genome", ")", "as", "handle", ":", "for", "record", "in", "SeqIO", ".", "parse", "(", "h...
Split genome into chunks of fixed size (save the last one).
[ "Split", "genome", "into", "chunks", "of", "fixed", "size", "(", "save", "the", "last", "one", ")", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L512-L524
train
Split a genome into chunks of fixed size
koszullab/metaTOR
metator/scripts/hicstuff.py
from_dade_matrix
def from_dade_matrix(filename, header=False): """ Loads a numpy array from a Dade matrix instance, e.g.: A matrix containing the following (or equivalent in numpy) [['RST','chr1~0','chr1~10','chr2~0','chr2~30'], ['chr1~0','5', '10', '11', '2'], ['chr1~10', '8', '3', '5'], ['chr2~0', '...
python
def from_dade_matrix(filename, header=False): """ Loads a numpy array from a Dade matrix instance, e.g.: A matrix containing the following (or equivalent in numpy) [['RST','chr1~0','chr1~10','chr2~0','chr2~30'], ['chr1~0','5', '10', '11', '2'], ['chr1~10', '8', '3', '5'], ['chr2~0', '...
[ "def", "from_dade_matrix", "(", "filename", ",", "header", "=", "False", ")", ":", "A", "=", "np", ".", "genfromtxt", "(", "filename", ",", "delimiter", "=", "\"\\t\"", ",", "dtype", "=", "None", ",", "filling_values", "=", "0", ")", "M", ",", "headers...
Loads a numpy array from a Dade matrix instance, e.g.: A matrix containing the following (or equivalent in numpy) [['RST','chr1~0','chr1~10','chr2~0','chr2~30'], ['chr1~0','5', '10', '11', '2'], ['chr1~10', '8', '3', '5'], ['chr2~0', '3', '5'], ['chr2~30', '5']] [['5'...
[ "Loads", "a", "numpy", "array", "from", "a", "Dade", "matrix", "instance", "e", ".", "g", ".", ":", "A", "matrix", "containing", "the", "following", "(", "or", "equivalent", "in", "numpy", ")" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L646-L675
train
Loads a numpy array from a Dade matrix file.
koszullab/metaTOR
metator/scripts/hicstuff.py
to_dade_matrix
def to_dade_matrix(M, annotations="", filename=None): """Returns a Dade matrix from input numpy matrix. Any annotations are added as header. If filename is provided and valid, said matrix is also saved as text. """ n, m = M.shape A = np.zeros((n + 1, m + 1)) A[1:, 1:] = M if not annotat...
python
def to_dade_matrix(M, annotations="", filename=None): """Returns a Dade matrix from input numpy matrix. Any annotations are added as header. If filename is provided and valid, said matrix is also saved as text. """ n, m = M.shape A = np.zeros((n + 1, m + 1)) A[1:, 1:] = M if not annotat...
[ "def", "to_dade_matrix", "(", "M", ",", "annotations", "=", "\"\"", ",", "filename", "=", "None", ")", ":", "n", ",", "m", "=", "M", ".", "shape", "A", "=", "np", ".", "zeros", "(", "(", "n", "+", "1", ",", "m", "+", "1", ")", ")", "A", "["...
Returns a Dade matrix from input numpy matrix. Any annotations are added as header. If filename is provided and valid, said matrix is also saved as text.
[ "Returns", "a", "Dade", "matrix", "from", "input", "numpy", "matrix", ".", "Any", "annotations", "are", "added", "as", "header", ".", "If", "filename", "is", "provided", "and", "valid", "said", "matrix", "is", "also", "saved", "as", "text", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L678-L701
train
Returns a Dade matrix from input numpy matrix. Any annotations are added as header.
koszullab/metaTOR
metator/scripts/hicstuff.py
from_structure
def from_structure(structure): """Return contact data from a 3D structure (in pdb format). """ try: from Bio import PDB if isinstance(structure, str): p = PDB.PDBParser() structure = p.get_structure('S', structure) if isinstance(structure, PDB.Structure.Struc...
python
def from_structure(structure): """Return contact data from a 3D structure (in pdb format). """ try: from Bio import PDB if isinstance(structure, str): p = PDB.PDBParser() structure = p.get_structure('S', structure) if isinstance(structure, PDB.Structure.Struc...
[ "def", "from_structure", "(", "structure", ")", ":", "try", ":", "from", "Bio", "import", "PDB", "if", "isinstance", "(", "structure", ",", "str", ")", ":", "p", "=", "PDB", ".", "PDBParser", "(", ")", "structure", "=", "p", ".", "get_structure", "(", ...
Return contact data from a 3D structure (in pdb format).
[ "Return", "contact", "data", "from", "a", "3D", "structure", "(", "in", "pdb", "format", ")", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L704-L733
train
Return contact data from a 3D structure.
koszullab/metaTOR
metator/scripts/hicstuff.py
largest_connected_component
def largest_connected_component(matrix): """Compute the adjacency matrix of the largest connected component of the graph whose input matrix is adjacent. """ try: import scipy.sparse n, components = scipy.sparse.csgraph.connected_components( matrix, directed=False) pr...
python
def largest_connected_component(matrix): """Compute the adjacency matrix of the largest connected component of the graph whose input matrix is adjacent. """ try: import scipy.sparse n, components = scipy.sparse.csgraph.connected_components( matrix, directed=False) pr...
[ "def", "largest_connected_component", "(", "matrix", ")", ":", "try", ":", "import", "scipy", ".", "sparse", "n", ",", "components", "=", "scipy", ".", "sparse", ".", "csgraph", ".", "connected_components", "(", "matrix", ",", "directed", "=", "False", ")", ...
Compute the adjacency matrix of the largest connected component of the graph whose input matrix is adjacent.
[ "Compute", "the", "adjacency", "matrix", "of", "the", "largest", "connected", "component", "of", "the", "graph", "whose", "input", "matrix", "is", "adjacent", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L736-L756
train
Compute the adjacency matrix of the largest connected component of the given matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
to_structure
def to_structure(matrix, alpha=1): """Compute best matching 3D genome structure from underlying input matrix using ShRec3D-derived method from Lesne et al., 2014. Link: https://www.ncbi.nlm.nih.gov/pubmed/25240436 The method performs two steps: first compute distance matrix by treating contact dat...
python
def to_structure(matrix, alpha=1): """Compute best matching 3D genome structure from underlying input matrix using ShRec3D-derived method from Lesne et al., 2014. Link: https://www.ncbi.nlm.nih.gov/pubmed/25240436 The method performs two steps: first compute distance matrix by treating contact dat...
[ "def", "to_structure", "(", "matrix", ",", "alpha", "=", "1", ")", ":", "connected", "=", "largest_connected_component", "(", "matrix", ")", "distances", "=", "to_distance", "(", "connected", ",", "alpha", ")", "n", ",", "m", "=", "connected", ".", "shape"...
Compute best matching 3D genome structure from underlying input matrix using ShRec3D-derived method from Lesne et al., 2014. Link: https://www.ncbi.nlm.nih.gov/pubmed/25240436 The method performs two steps: first compute distance matrix by treating contact data as an adjacency graph (of weights equal ...
[ "Compute", "best", "matching", "3D", "genome", "structure", "from", "underlying", "input", "matrix", "using", "ShRec3D", "-", "derived", "method", "from", "Lesne", "et", "al", ".", "2014", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L759-L798
train
Compute best matching 3D genome structure from underlying input matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
get_missing_bins
def get_missing_bins(original, trimmed): """Retrieve indices of a trimmed matrix with respect to the original matrix. Fairly fast but is only correct if diagonal values are different, which is always the case in practice. """ original_diag = np.diag(original) trimmed_diag = np.diag(trimmed) ...
python
def get_missing_bins(original, trimmed): """Retrieve indices of a trimmed matrix with respect to the original matrix. Fairly fast but is only correct if diagonal values are different, which is always the case in practice. """ original_diag = np.diag(original) trimmed_diag = np.diag(trimmed) ...
[ "def", "get_missing_bins", "(", "original", ",", "trimmed", ")", ":", "original_diag", "=", "np", ".", "diag", "(", "original", ")", "trimmed_diag", "=", "np", ".", "diag", "(", "trimmed", ")", "index", "=", "[", "]", "m", "=", "min", "(", "original", ...
Retrieve indices of a trimmed matrix with respect to the original matrix. Fairly fast but is only correct if diagonal values are different, which is always the case in practice.
[ "Retrieve", "indices", "of", "a", "trimmed", "matrix", "with", "respect", "to", "the", "original", "matrix", ".", "Fairly", "fast", "but", "is", "only", "correct", "if", "diagonal", "values", "are", "different", "which", "is", "always", "the", "case", "in", ...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L801-L816
train
Retrieve indices of a trimmed matrix with respect to the original matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
to_pdb
def to_pdb(structure, filename, contigs=None, annotations=None, indices=None, special_bins=None): """From a structure (or matrix) generate the corresponding pdb file representing each chain as a contig/chromosome and filling the occupancy field with a custom annotation. If the matrix has been tri...
python
def to_pdb(structure, filename, contigs=None, annotations=None, indices=None, special_bins=None): """From a structure (or matrix) generate the corresponding pdb file representing each chain as a contig/chromosome and filling the occupancy field with a custom annotation. If the matrix has been tri...
[ "def", "to_pdb", "(", "structure", ",", "filename", ",", "contigs", "=", "None", ",", "annotations", "=", "None", ",", "indices", "=", "None", ",", "special_bins", "=", "None", ")", ":", "n", "=", "len", "(", "structure", ")", "letters", "=", "(", "s...
From a structure (or matrix) generate the corresponding pdb file representing each chain as a contig/chromosome and filling the occupancy field with a custom annotation. If the matrix has been trimmed somewhat, remaining indices may be specified.
[ "From", "a", "structure", "(", "or", "matrix", ")", "generate", "the", "corresponding", "pdb", "file", "representing", "each", "chain", "as", "a", "contig", "/", "chromosome", "and", "filling", "the", "occupancy", "field", "with", "a", "custom", "annotation", ...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L819-L880
train
Generate a PDB file from a structure or matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
to_distance
def to_distance(matrix, alpha=1): """Compute distance matrix from contact data by applying a negative power law (alpha) to its nonzero pixels, then interpolating on the zeroes using a shortest-path algorithm. """ matrix = np.array(matrix) try: import scipy.sparse except ImportError a...
python
def to_distance(matrix, alpha=1): """Compute distance matrix from contact data by applying a negative power law (alpha) to its nonzero pixels, then interpolating on the zeroes using a shortest-path algorithm. """ matrix = np.array(matrix) try: import scipy.sparse except ImportError a...
[ "def", "to_distance", "(", "matrix", ",", "alpha", "=", "1", ")", ":", "matrix", "=", "np", ".", "array", "(", "matrix", ")", "try", ":", "import", "scipy", ".", "sparse", "except", "ImportError", "as", "e", ":", "print", "(", "\"Scipy not found.\"", "...
Compute distance matrix from contact data by applying a negative power law (alpha) to its nonzero pixels, then interpolating on the zeroes using a shortest-path algorithm.
[ "Compute", "distance", "matrix", "from", "contact", "data", "by", "applying", "a", "negative", "power", "law", "(", "alpha", ")", "to", "its", "nonzero", "pixels", "then", "interpolating", "on", "the", "zeroes", "using", "a", "shortest", "-", "path", "algori...
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L883-L915
train
Compute distance matrix from contact data by applying a negative power law to its nonzero pixels then interpolating on the zeroes using a shortest - path algorithm.
koszullab/metaTOR
metator/scripts/hicstuff.py
distance_to_contact
def distance_to_contact(D, alpha=1): """Compute contact matrix from input distance matrix. Distance values of zeroes are given the largest contact count otherwise inferred non-zero distance values. """ if callable(alpha): distance_function = alpha else: try: a = np.f...
python
def distance_to_contact(D, alpha=1): """Compute contact matrix from input distance matrix. Distance values of zeroes are given the largest contact count otherwise inferred non-zero distance values. """ if callable(alpha): distance_function = alpha else: try: a = np.f...
[ "def", "distance_to_contact", "(", "D", ",", "alpha", "=", "1", ")", ":", "if", "callable", "(", "alpha", ")", ":", "distance_function", "=", "alpha", "else", ":", "try", ":", "a", "=", "np", ".", "float64", "(", "alpha", ")", "def", "distance_function...
Compute contact matrix from input distance matrix. Distance values of zeroes are given the largest contact count otherwise inferred non-zero distance values.
[ "Compute", "contact", "matrix", "from", "input", "distance", "matrix", ".", "Distance", "values", "of", "zeroes", "are", "given", "the", "largest", "contact", "count", "otherwise", "inferred", "non", "-", "zero", "distance", "values", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L918-L942
train
Compute contact matrix from distance matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
distance_law
def distance_law(matrix, log_bins=False): """Compute distance law as a function of the genomic coordinate aka P(s). Bin length increases exponentially with distance if log_bins is True. """ D = np.array([np.average(np.diagonal(matrix, j)) for j in range(min(matrix.shape))]) if not...
python
def distance_law(matrix, log_bins=False): """Compute distance law as a function of the genomic coordinate aka P(s). Bin length increases exponentially with distance if log_bins is True. """ D = np.array([np.average(np.diagonal(matrix, j)) for j in range(min(matrix.shape))]) if not...
[ "def", "distance_law", "(", "matrix", ",", "log_bins", "=", "False", ")", ":", "D", "=", "np", ".", "array", "(", "[", "np", ".", "average", "(", "np", ".", "diagonal", "(", "matrix", ",", "j", ")", ")", "for", "j", "in", "range", "(", "min", "...
Compute distance law as a function of the genomic coordinate aka P(s). Bin length increases exponentially with distance if log_bins is True.
[ "Compute", "distance", "law", "as", "a", "function", "of", "the", "genomic", "coordinate", "aka", "P", "(", "s", ")", ".", "Bin", "length", "increases", "exponentially", "with", "distance", "if", "log_bins", "is", "True", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L945-L959
train
Compute distance law as a function of the genomic coordinate aka P ( s ).
koszullab/metaTOR
metator/scripts/hicstuff.py
pdb_to_structure
def pdb_to_structure(filename): """Import a structure object from a PDB file. """ try: from Bio.PDB import PDB except ImportError: print("I can't import Biopython which is needed to handle PDB files.") raise p = PDB.PDBParser() structure = p.get_structure('S', filename) ...
python
def pdb_to_structure(filename): """Import a structure object from a PDB file. """ try: from Bio.PDB import PDB except ImportError: print("I can't import Biopython which is needed to handle PDB files.") raise p = PDB.PDBParser() structure = p.get_structure('S', filename) ...
[ "def", "pdb_to_structure", "(", "filename", ")", ":", "try", ":", "from", "Bio", ".", "PDB", "import", "PDB", "except", "ImportError", ":", "print", "(", "\"I can't import Biopython which is needed to handle PDB files.\"", ")", "raise", "p", "=", "PDB", ".", "PDBP...
Import a structure object from a PDB file.
[ "Import", "a", "structure", "object", "from", "a", "PDB", "file", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L980-L993
train
Import a structure object from a PDB file.
koszullab/metaTOR
metator/scripts/hicstuff.py
noise
def noise(matrix): """Just a quick function to make a matrix noisy using a standard Poisson distribution (contacts are treated as rare events). """ D = shortest_path_interpolation(matrix, strict=True) return np.random.poisson(lam=D)
python
def noise(matrix): """Just a quick function to make a matrix noisy using a standard Poisson distribution (contacts are treated as rare events). """ D = shortest_path_interpolation(matrix, strict=True) return np.random.poisson(lam=D)
[ "def", "noise", "(", "matrix", ")", ":", "D", "=", "shortest_path_interpolation", "(", "matrix", ",", "strict", "=", "True", ")", "return", "np", ".", "random", ".", "poisson", "(", "lam", "=", "D", ")" ]
Just a quick function to make a matrix noisy using a standard Poisson distribution (contacts are treated as rare events).
[ "Just", "a", "quick", "function", "to", "make", "a", "matrix", "noisy", "using", "a", "standard", "Poisson", "distribution", "(", "contacts", "are", "treated", "as", "rare", "events", ")", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L996-L1002
train
Just a quick function to make a matrix noisy using a standard Poisson distribution.
koszullab/metaTOR
metator/scripts/hicstuff.py
positions_to_contigs
def positions_to_contigs(positions): """Flattens and converts a positions array to a contigs array, if applicable. """ if isinstance(positions, np.ndarray): flattened_positions = positions.flatten() else: try: flattened_positions = np.array( [pos for contig i...
python
def positions_to_contigs(positions): """Flattens and converts a positions array to a contigs array, if applicable. """ if isinstance(positions, np.ndarray): flattened_positions = positions.flatten() else: try: flattened_positions = np.array( [pos for contig i...
[ "def", "positions_to_contigs", "(", "positions", ")", ":", "if", "isinstance", "(", "positions", ",", "np", ".", "ndarray", ")", ":", "flattened_positions", "=", "positions", ".", "flatten", "(", ")", "else", ":", "try", ":", "flattened_positions", "=", "np"...
Flattens and converts a positions array to a contigs array, if applicable.
[ "Flattens", "and", "converts", "a", "positions", "array", "to", "a", "contigs", "array", "if", "applicable", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1005-L1031
train
Flattens and converts a positions array to a contigs array if applicable.
koszullab/metaTOR
metator/scripts/hicstuff.py
distance_diagonal_law
def distance_diagonal_law(matrix, positions=None): """Compute a distance law trend using the contact averages of equal distances. Specific positions can be supplied if needed. """ n = min(matrix.shape) if positions is None: return np.array([np.average(np.diagonal(matrix, j)) for j in range(...
python
def distance_diagonal_law(matrix, positions=None): """Compute a distance law trend using the contact averages of equal distances. Specific positions can be supplied if needed. """ n = min(matrix.shape) if positions is None: return np.array([np.average(np.diagonal(matrix, j)) for j in range(...
[ "def", "distance_diagonal_law", "(", "matrix", ",", "positions", "=", "None", ")", ":", "n", "=", "min", "(", "matrix", ".", "shape", ")", "if", "positions", "is", "None", ":", "return", "np", ".", "array", "(", "[", "np", ".", "average", "(", "np", ...
Compute a distance law trend using the contact averages of equal distances. Specific positions can be supplied if needed.
[ "Compute", "a", "distance", "law", "trend", "using", "the", "contact", "averages", "of", "equal", "distances", ".", "Specific", "positions", "can", "be", "supplied", "if", "needed", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1034-L1066
train
Compute a distance law trend using the contact averages of equal distances.
koszullab/metaTOR
metator/scripts/hicstuff.py
rippe_parameters
def rippe_parameters(matrix, positions, lengths=None, init=None, circ=False): """Estimate parameters from the model described in Rippe et al., 2001. """ n, _ = matrix.shape if lengths is None: lengths = np.abs(np.diff(positions)) measurements, bins = [], [] for i in range(n): ...
python
def rippe_parameters(matrix, positions, lengths=None, init=None, circ=False): """Estimate parameters from the model described in Rippe et al., 2001. """ n, _ = matrix.shape if lengths is None: lengths = np.abs(np.diff(positions)) measurements, bins = [], [] for i in range(n): ...
[ "def", "rippe_parameters", "(", "matrix", ",", "positions", ",", "lengths", "=", "None", ",", "init", "=", "None", ",", "circ", "=", "False", ")", ":", "n", ",", "_", "=", "matrix", ".", "shape", "if", "lengths", "is", "None", ":", "lengths", "=", ...
Estimate parameters from the model described in Rippe et al., 2001.
[ "Estimate", "parameters", "from", "the", "model", "described", "in", "Rippe", "et", "al", ".", "2001", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1069-L1095
train
Estimate parameters from the model described in Rippe et al. 2001.
koszullab/metaTOR
metator/scripts/hicstuff.py
estimate_param_rippe
def estimate_param_rippe(measurements, bins, init=None, circ=False): """Perform least square optimization needed for the rippe_parameters function. """ # Init values DEFAULT_INIT_RIPPE_PARAMETERS = [1., 9.6, -1.5] d = 3. def log_residuals(p, y, x): kuhn, lm, slope, A = p rippe ...
python
def estimate_param_rippe(measurements, bins, init=None, circ=False): """Perform least square optimization needed for the rippe_parameters function. """ # Init values DEFAULT_INIT_RIPPE_PARAMETERS = [1., 9.6, -1.5] d = 3. def log_residuals(p, y, x): kuhn, lm, slope, A = p rippe ...
[ "def", "estimate_param_rippe", "(", "measurements", ",", "bins", ",", "init", "=", "None", ",", "circ", "=", "False", ")", ":", "# Init values", "DEFAULT_INIT_RIPPE_PARAMETERS", "=", "[", "1.", ",", "9.6", ",", "-", "1.5", "]", "d", "=", "3.", "def", "lo...
Perform least square optimization needed for the rippe_parameters function.
[ "Perform", "least", "square", "optimization", "needed", "for", "the", "rippe_parameters", "function", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1098-L1164
train
Estimate the rippe parameter for the current class.
koszullab/metaTOR
metator/scripts/hicstuff.py
null_model
def null_model(matrix, positions=None, lengths=None, model="uniform", noisy=False, circ=False, sparsity=False): """Attempt to compute a 'null model' of the matrix given a model to base itself on. """ n, m = matrix.shape positions_supplied = True if positions is Non...
python
def null_model(matrix, positions=None, lengths=None, model="uniform", noisy=False, circ=False, sparsity=False): """Attempt to compute a 'null model' of the matrix given a model to base itself on. """ n, m = matrix.shape positions_supplied = True if positions is Non...
[ "def", "null_model", "(", "matrix", ",", "positions", "=", "None", ",", "lengths", "=", "None", ",", "model", "=", "\"uniform\"", ",", "noisy", "=", "False", ",", "circ", "=", "False", ",", "sparsity", "=", "False", ")", ":", "n", ",", "m", "=", "m...
Attempt to compute a 'null model' of the matrix given a model to base itself on.
[ "Attempt", "to", "compute", "a", "null", "model", "of", "the", "matrix", "given", "a", "model", "to", "base", "itself", "on", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1167-L1252
train
Compute a null model of the given matrix.
koszullab/metaTOR
metator/scripts/hicstuff.py
trim_structure
def trim_structure(struct, filtering="cube", n=2): """Remove outlier 'atoms' (aka bins) from a structure. """ X, Y, Z = (struct[:, i] for i in range(3)) if filtering == "sphere": R = (np.std(X)**2 + np.std(Y)**2 + np.std(Z)**2) * (n**2) f = (X - np.mean(X))**2 + (Y - np.mean(Y))**2 + (...
python
def trim_structure(struct, filtering="cube", n=2): """Remove outlier 'atoms' (aka bins) from a structure. """ X, Y, Z = (struct[:, i] for i in range(3)) if filtering == "sphere": R = (np.std(X)**2 + np.std(Y)**2 + np.std(Z)**2) * (n**2) f = (X - np.mean(X))**2 + (Y - np.mean(Y))**2 + (...
[ "def", "trim_structure", "(", "struct", ",", "filtering", "=", "\"cube\"", ",", "n", "=", "2", ")", ":", "X", ",", "Y", ",", "Z", "=", "(", "struct", "[", ":", ",", "i", "]", "for", "i", "in", "range", "(", "3", ")", ")", "if", "filtering", "...
Remove outlier 'atoms' (aka bins) from a structure.
[ "Remove", "outlier", "atoms", "(", "aka", "bins", ")", "from", "a", "structure", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1263-L1285
train
Removes outlier atoms from a structure.
koszullab/metaTOR
metator/scripts/hicstuff.py
scalogram
def scalogram(M, circ=False): """Computes so-called 'scalograms' used to easily visualize contacts at different distance scales. Edge cases have been painstakingly taken care of. """ # Sanity checks if not type(M) is np.ndarray: M = np.array(M) if M.shape[0] != M.shape[1]: ...
python
def scalogram(M, circ=False): """Computes so-called 'scalograms' used to easily visualize contacts at different distance scales. Edge cases have been painstakingly taken care of. """ # Sanity checks if not type(M) is np.ndarray: M = np.array(M) if M.shape[0] != M.shape[1]: ...
[ "def", "scalogram", "(", "M", ",", "circ", "=", "False", ")", ":", "# Sanity checks", "if", "not", "type", "(", "M", ")", "is", "np", ".", "ndarray", ":", "M", "=", "np", ".", "array", "(", "M", ")", "if", "M", ".", "shape", "[", "0", "]", "!...
Computes so-called 'scalograms' used to easily visualize contacts at different distance scales. Edge cases have been painstakingly taken care of.
[ "Computes", "so", "-", "called", "scalograms", "used", "to", "easily", "visualize", "contacts", "at", "different", "distance", "scales", ".", "Edge", "cases", "have", "been", "painstakingly", "taken", "care", "of", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1288-L1321
train
Computes so - called scalograms used to easily generate contacts at different distance scales.
koszullab/metaTOR
metator/scripts/hicstuff.py
asd
def asd(M1, M2): """Compute a Fourier transform based distance between two matrices. Inspired from Galiez et al., 2015 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4535829/) """ from scipy.fftpack import fft2 spectra1 = np.abs(fft2(M1)) spectra2 = np.abs(fft2(M2)) return np.linal...
python
def asd(M1, M2): """Compute a Fourier transform based distance between two matrices. Inspired from Galiez et al., 2015 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4535829/) """ from scipy.fftpack import fft2 spectra1 = np.abs(fft2(M1)) spectra2 = np.abs(fft2(M2)) return np.linal...
[ "def", "asd", "(", "M1", ",", "M2", ")", ":", "from", "scipy", ".", "fftpack", "import", "fft2", "spectra1", "=", "np", ".", "abs", "(", "fft2", "(", "M1", ")", ")", "spectra2", "=", "np", ".", "abs", "(", "fft2", "(", "M2", ")", ")", "return",...
Compute a Fourier transform based distance between two matrices. Inspired from Galiez et al., 2015 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4535829/)
[ "Compute", "a", "Fourier", "transform", "based", "distance", "between", "two", "matrices", "." ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1324-L1336
train
Compute a Fourier transform based distance between two matrices.
koszullab/metaTOR
metator/scripts/hicstuff.py
compartments
def compartments(M, normalize=True): """A/B compartment analysis Perform a PCA-based A/B compartment analysis on a normalized, single chromosome contact map. The results are two vectors whose values (negative or positive) should presumably correlate with the presence of 'active' vs. 'inert' chromat...
python
def compartments(M, normalize=True): """A/B compartment analysis Perform a PCA-based A/B compartment analysis on a normalized, single chromosome contact map. The results are two vectors whose values (negative or positive) should presumably correlate with the presence of 'active' vs. 'inert' chromat...
[ "def", "compartments", "(", "M", ",", "normalize", "=", "True", ")", ":", "if", "not", "type", "(", "M", ")", "is", "np", ".", "ndarray", ":", "M", "=", "np", ".", "array", "(", "M", ")", "if", "M", ".", "shape", "[", "0", "]", "!=", "M", "...
A/B compartment analysis Perform a PCA-based A/B compartment analysis on a normalized, single chromosome contact map. The results are two vectors whose values (negative or positive) should presumably correlate with the presence of 'active' vs. 'inert' chromatin. Parameters ---------- M : a...
[ "A", "/", "B", "compartment", "analysis" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1338-L1376
train
A B compartment analysis on a normalized contact map.
koszullab/metaTOR
metator/scripts/hicstuff.py
remove_intra
def remove_intra(M, contigs): """Remove intrachromosomal contacts Given a contact map and a list attributing each position to a given chromosome, set all contacts within each chromosome or contig to zero. Useful to perform calculations on interchromosomal contacts only. Parameters --------...
python
def remove_intra(M, contigs): """Remove intrachromosomal contacts Given a contact map and a list attributing each position to a given chromosome, set all contacts within each chromosome or contig to zero. Useful to perform calculations on interchromosomal contacts only. Parameters --------...
[ "def", "remove_intra", "(", "M", ",", "contigs", ")", ":", "N", "=", "np", ".", "copy", "(", "M", ")", "n", "=", "len", "(", "N", ")", "assert", "n", "==", "len", "(", "contigs", ")", "# Naive implmentation for now", "for", "(", "i", ",", "j", ")...
Remove intrachromosomal contacts Given a contact map and a list attributing each position to a given chromosome, set all contacts within each chromosome or contig to zero. Useful to perform calculations on interchromosomal contacts only. Parameters ---------- M : array_like The ini...
[ "Remove", "intrachromosomal", "contacts" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1378-L1412
train
Remove intrachromosomal contacts from a contact map given a list attributing each position to a given chromosome.
koszullab/metaTOR
metator/scripts/hicstuff.py
positions_to_contigs
def positions_to_contigs(positions): """Label contigs according to relative positions Given a list of positions, return an ordered list of labels reflecting where the positions array started over (and presumably a new contig began). Parameters ---------- positions : list or array_like ...
python
def positions_to_contigs(positions): """Label contigs according to relative positions Given a list of positions, return an ordered list of labels reflecting where the positions array started over (and presumably a new contig began). Parameters ---------- positions : list or array_like ...
[ "def", "positions_to_contigs", "(", "positions", ")", ":", "contig_labels", "=", "np", ".", "zeros_like", "(", "positions", ")", "contig_index", "=", "0", "for", "i", ",", "p", "in", "enumerate", "(", "positions", ")", ":", "if", "p", "==", "0", ":", "...
Label contigs according to relative positions Given a list of positions, return an ordered list of labels reflecting where the positions array started over (and presumably a new contig began). Parameters ---------- positions : list or array_like A piece-wise ordered list of integers re...
[ "Label", "contigs", "according", "to", "relative", "positions" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1452-L1480
train
Label contigs according to relative positions
koszullab/metaTOR
metator/scripts/hicstuff.py
contigs_to_positions
def contigs_to_positions(contigs, binning=10000): """Build positions from contig labels From a list of contig labels and a binning parameter, build a list of positions that's essentially a concatenation of linspaces with step equal to the binning. Parameters ---------- contigs : list o...
python
def contigs_to_positions(contigs, binning=10000): """Build positions from contig labels From a list of contig labels and a binning parameter, build a list of positions that's essentially a concatenation of linspaces with step equal to the binning. Parameters ---------- contigs : list o...
[ "def", "contigs_to_positions", "(", "contigs", ",", "binning", "=", "10000", ")", ":", "positions", "=", "np", ".", "zeros_like", "(", "contigs", ")", "index", "=", "0", "for", "_", ",", "chunk", "in", "itertools", ".", "groubpy", "(", "contigs", ")", ...
Build positions from contig labels From a list of contig labels and a binning parameter, build a list of positions that's essentially a concatenation of linspaces with step equal to the binning. Parameters ---------- contigs : list or array_like The list of contig labels, must be s...
[ "Build", "positions", "from", "contig", "labels" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1482-L1511
train
Build positions from contig labels and binning parameter
koszullab/metaTOR
metator/scripts/hicstuff.py
split_matrix
def split_matrix(M, contigs): """Split multiple chromosome matrix Split a labeled matrix with multiple chromosomes into unlabeled single-chromosome matrices. Inter chromosomal contacts are discarded. Parameters ---------- M : array_like The multiple chromosome matrix to be split ...
python
def split_matrix(M, contigs): """Split multiple chromosome matrix Split a labeled matrix with multiple chromosomes into unlabeled single-chromosome matrices. Inter chromosomal contacts are discarded. Parameters ---------- M : array_like The multiple chromosome matrix to be split ...
[ "def", "split_matrix", "(", "M", ",", "contigs", ")", ":", "index", "=", "0", "for", "_", ",", "chunk", "in", "itertools", ".", "groubpy", "(", "contigs", ")", ":", "l", "=", "len", "(", "chunk", ")", "yield", "M", "[", "index", ":", "index", "+"...
Split multiple chromosome matrix Split a labeled matrix with multiple chromosomes into unlabeled single-chromosome matrices. Inter chromosomal contacts are discarded. Parameters ---------- M : array_like The multiple chromosome matrix to be split contigs : list or array_like ...
[ "Split", "multiple", "chromosome", "matrix" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L1514-L1533
train
Split a labeled matrix with multiple chromosomes into unlabeled single - chromosome matrices.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.do
def do(self, method, url, url_params={}, query_params={}, request_params={}): """ - Method: method - URL: url.format(**url_params) - Parameter: query_params & apiKey=api_key - Request Body(data): request_params """ _url = url.format(**url_params).lstrip("/") ...
python
def do(self, method, url, url_params={}, query_params={}, request_params={}): """ - Method: method - URL: url.format(**url_params) - Parameter: query_params & apiKey=api_key - Request Body(data): request_params """ _url = url.format(**url_params).lstrip("/") ...
[ "def", "do", "(", "self", ",", "method", ",", "url", ",", "url_params", "=", "{", "}", ",", "query_params", "=", "{", "}", ",", "request_params", "=", "{", "}", ")", ":", "_url", "=", "url", ".", "format", "(", "*", "*", "url_params", ")", ".", ...
- Method: method - URL: url.format(**url_params) - Parameter: query_params & apiKey=api_key - Request Body(data): request_params
[ "-", "Method", ":", "method", "-", "URL", ":", "url", ".", "format", "(", "**", "url_params", ")", "-", "Parameter", ":", "query_params", "&", "apiKey", "=", "api_key", "-", "Request", "Body", "(", "data", ")", ":", "request_params" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L50-L89
train
This method is used to make a request to the Unreal - Time API.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.project_activities
def project_activities(self, project_id_or_key, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.project_activities("YOUR_PROJECT") client.project_activities("YOUR_PROJECT", {"activityTypeId[]": [1, 2],}) """ return self.do("get...
python
def project_activities(self, project_id_or_key, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.project_activities("YOUR_PROJECT") client.project_activities("YOUR_PROJECT", {"activityTypeId[]": [1, 2],}) """ return self.do("get...
[ "def", "project_activities", "(", "self", ",", "project_id_or_key", ",", "extra_query_params", "=", "{", "}", ")", ":", "return", "self", ".", "do", "(", "\"get\"", ",", "\"projects/{project_id_or_key}/activities\"", ",", "url_params", "=", "{", "\"project_id_or_key...
client = BacklogClient("your_space_name", "your_api_key") client.project_activities("YOUR_PROJECT") client.project_activities("YOUR_PROJECT", {"activityTypeId[]": [1, 2],})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "project_activities", "(", "YOUR_PROJECT", ")", "client", ".", "project_activities", "(", "YOUR_PROJECT", "{", "activityTypeId", "[]", ":", "[", "1", "2", "]", "}", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L137-L146
train
Get all activities for a project.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.create_version
def create_version(self, project_id_or_key, version_name, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.create_version("YOUR_PROJECT", "VERSION_NAME", {"description": "version descriptio...
python
def create_version(self, project_id_or_key, version_name, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.create_version("YOUR_PROJECT", "VERSION_NAME", {"description": "version descriptio...
[ "def", "create_version", "(", "self", ",", "project_id_or_key", ",", "version_name", ",", "extra_request_params", "=", "{", "}", ")", ":", "request_params", "=", "extra_request_params", "request_params", "[", "\"name\"", "]", "=", "version_name", "return", "self", ...
client = BacklogClient("your_space_name", "your_api_key") client.create_version("YOUR_PROJECT", "VERSION_NAME", {"description": "version description"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L166-L179
train
Create a version of the current project.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.update_version
def update_version(self, project_id_or_key, version_id, version_name, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.update_version("YOUR_PROJECT", 3, "VERSION_NAME" ...
python
def update_version(self, project_id_or_key, version_id, version_name, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.update_version("YOUR_PROJECT", 3, "VERSION_NAME" ...
[ "def", "update_version", "(", "self", ",", "project_id_or_key", ",", "version_id", ",", "version_name", ",", "extra_request_params", "=", "{", "}", ")", ":", "request_params", "=", "extra_request_params", "request_params", "[", "\"name\"", "]", "=", "version_name", ...
client = BacklogClient("your_space_name", "your_api_key") client.update_version("YOUR_PROJECT", 3, "VERSION_NAME" {"description": "updated description", "archived": "true"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "update_version", "(", "YOUR_PROJECT", "3", "VERSION_NAME", "{", "description", ":", "updated", "description", "archived", ":", "true", "}", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L181-L197
train
Update a version of a project.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.issue_comments
def issue_comments(self, issue_id_or_key, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.issue_comments("YOUR_PROJECT-999") """ return self.do("GET", "issues/{issue_id_or_key}/comments", url_params={"issue_id_o...
python
def issue_comments(self, issue_id_or_key, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.issue_comments("YOUR_PROJECT-999") """ return self.do("GET", "issues/{issue_id_or_key}/comments", url_params={"issue_id_o...
[ "def", "issue_comments", "(", "self", ",", "issue_id_or_key", ",", "extra_query_params", "=", "{", "}", ")", ":", "return", "self", ".", "do", "(", "\"GET\"", ",", "\"issues/{issue_id_or_key}/comments\"", ",", "url_params", "=", "{", "\"issue_id_or_key\"", ":", ...
client = BacklogClient("your_space_name", "your_api_key") client.issue_comments("YOUR_PROJECT-999")
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "issue_comments", "(", "YOUR_PROJECT", "-", "999", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L228-L236
train
Get all comments for a given issue.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.create_issue
def create_issue(self, project_id, summary, issue_type_id, priority_id, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") project_key = "YOUR_PROJECT" project_id = client.get_project_id(project_key) issue_type_id = client.project_issue_types...
python
def create_issue(self, project_id, summary, issue_type_id, priority_id, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") project_key = "YOUR_PROJECT" project_id = client.get_project_id(project_key) issue_type_id = client.project_issue_types...
[ "def", "create_issue", "(", "self", ",", "project_id", ",", "summary", ",", "issue_type_id", ",", "priority_id", ",", "extra_request_params", "=", "{", "}", ")", ":", "request_params", "=", "extra_request_params", "request_params", "[", "\"projectId\"", "]", "=", ...
client = BacklogClient("your_space_name", "your_api_key") project_key = "YOUR_PROJECT" project_id = client.get_project_id(project_key) issue_type_id = client.project_issue_types(project_key)[0][u"id"] priority_id = client.priorities()[0][u"id"] client.create_issue(project_id, ...
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "project_key", "=", "YOUR_PROJECT" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L254-L277
train
Create a new issue.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.add_issue_comment
def add_issue_comment(self, issue_id_or_key, content, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.add_issue_comment("YOUR_PROJECT-999", u"or ... else e.") """ request_params = extra_request_params request_params["content"...
python
def add_issue_comment(self, issue_id_or_key, content, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.add_issue_comment("YOUR_PROJECT-999", u"or ... else e.") """ request_params = extra_request_params request_params["content"...
[ "def", "add_issue_comment", "(", "self", ",", "issue_id_or_key", ",", "content", ",", "extra_request_params", "=", "{", "}", ")", ":", "request_params", "=", "extra_request_params", "request_params", "[", "\"content\"", "]", "=", "content", "return", "self", ".", ...
client = BacklogClient("your_space_name", "your_api_key") client.add_issue_comment("YOUR_PROJECT-999", u"or ... else e.")
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "add_issue_comment", "(", "YOUR_PROJECT", "-", "999", "u", "or", "...", "else", "e", ".", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L279-L289
train
Add a comment to an existing issue.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.user_activities
def user_activities(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_activities(3) client.user_activities(3, {"count": 2, "order": "asc"}) """ return self.do("GET", "users/{user_id}/activities", ...
python
def user_activities(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_activities(3) client.user_activities(3, {"count": 2, "order": "asc"}) """ return self.do("GET", "users/{user_id}/activities", ...
[ "def", "user_activities", "(", "self", ",", "user_id", ",", "extra_query_params", "=", "{", "}", ")", ":", "return", "self", ".", "do", "(", "\"GET\"", ",", "\"users/{user_id}/activities\"", ",", "url_params", "=", "{", "\"user_id\"", ":", "user_id", "}", ",...
client = BacklogClient("your_space_name", "your_api_key") client.user_activities(3) client.user_activities(3, {"count": 2, "order": "asc"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "user_activities", "(", "3", ")", "client", ".", "user_activities", "(", "3", "{", "count", ":", "2", "order", ":", "asc", "}", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L305-L313
train
Get all user activities for a user.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.user_stars
def user_stars(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_stars(5) client.user_stars(5, {"count": 100, "order": "asc"}) """ return self.do("GET", "users/{user_id}/stars", url_para...
python
def user_stars(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_stars(5) client.user_stars(5, {"count": 100, "order": "asc"}) """ return self.do("GET", "users/{user_id}/stars", url_para...
[ "def", "user_stars", "(", "self", ",", "user_id", ",", "extra_query_params", "=", "{", "}", ")", ":", "return", "self", ".", "do", "(", "\"GET\"", ",", "\"users/{user_id}/stars\"", ",", "url_params", "=", "{", "\"user_id\"", ":", "user_id", "}", ",", "quer...
client = BacklogClient("your_space_name", "your_api_key") client.user_stars(5) client.user_stars(5, {"count": 100, "order": "asc"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "user_stars", "(", "5", ")", "client", ".", "user_stars", "(", "5", "{", "count", ":", "100", "order", ":", "asc", "}", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L329-L337
train
Get the user s list of stars.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.user_stars_count
def user_stars_count(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_stars_count(5) client.user_stars_count(5, {"since": "2017-05-01", "until": "2017-05-31"}) """ return self.do("GET", "users/{user_id}/stars...
python
def user_stars_count(self, user_id, extra_query_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.user_stars_count(5) client.user_stars_count(5, {"since": "2017-05-01", "until": "2017-05-31"}) """ return self.do("GET", "users/{user_id}/stars...
[ "def", "user_stars_count", "(", "self", ",", "user_id", ",", "extra_query_params", "=", "{", "}", ")", ":", "return", "self", ".", "do", "(", "\"GET\"", ",", "\"users/{user_id}/stars/count\"", ",", "url_params", "=", "{", "\"user_id\"", ":", "user_id", "}", ...
client = BacklogClient("your_space_name", "your_api_key") client.user_stars_count(5) client.user_stars_count(5, {"since": "2017-05-01", "until": "2017-05-31"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "user_stars_count", "(", "5", ")", "client", ".", "user_stars_count", "(", "5", "{", "since", ":", "2017", "-", "05", "-", "01", "until", ":", "2017", "-", "05", ...
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L339-L347
train
Get the number of stars for a user.
netmarkjp/pybacklog
pybacklog/__init__.py
BacklogClient.update_wiki
def update_wiki(self, wiki_id, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.update_wiki(3, {"name": "test", "content": "content test", "mailNotify": "true"}) """ request_params = extra_request_params return self.do("PATCH"...
python
def update_wiki(self, wiki_id, extra_request_params={}): """ client = BacklogClient("your_space_name", "your_api_key") client.update_wiki(3, {"name": "test", "content": "content test", "mailNotify": "true"}) """ request_params = extra_request_params return self.do("PATCH"...
[ "def", "update_wiki", "(", "self", ",", "wiki_id", ",", "extra_request_params", "=", "{", "}", ")", ":", "request_params", "=", "extra_request_params", "return", "self", ".", "do", "(", "\"PATCH\"", ",", "\"wikis/{wiki_id}\"", ",", "url_params", "=", "{", "\"w...
client = BacklogClient("your_space_name", "your_api_key") client.update_wiki(3, {"name": "test", "content": "content test", "mailNotify": "true"})
[ "client", "=", "BacklogClient", "(", "your_space_name", "your_api_key", ")", "client", ".", "update_wiki", "(", "3", "{", "name", ":", "test", "content", ":", "content", "test", "mailNotify", ":", "true", "}", ")" ]
b92cc649c8d776577f567a92b218613b41f8850e
https://github.com/netmarkjp/pybacklog/blob/b92cc649c8d776577f567a92b218613b41f8850e/pybacklog/__init__.py#L372-L378
train
Update wiki with new content
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_index
def find_index(array, x): """ Locate the leftmost value exactly equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value **中文文档** 返回第一个值等于x的元素的索引。 """ i = bisect.bisect_left(array, x) if i != len(array) and array[i] == x: ...
python
def find_index(array, x): """ Locate the leftmost value exactly equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value **中文文档** 返回第一个值等于x的元素的索引。 """ i = bisect.bisect_left(array, x) if i != len(array) and array[i] == x: ...
[ "def", "find_index", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "array", ",", "x", ")", "if", "i", "!=", "len", "(", "array", ")", "and", "array", "[", "i", "]", "==", "x", ":", "return", "i", "raise", "Value...
Locate the leftmost value exactly equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value **中文文档** 返回第一个值等于x的元素的索引。
[ "Locate", "the", "leftmost", "value", "exactly", "equal", "to", "x", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L31-L47
train
Locate the leftmost value exactly equal to x.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_lt
def find_lt(array, x): """ Find rightmost value less than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_lt([0, 1, 2, 3], 2.5) 2 **中文文档** 寻找最大的小于x的数。 """ i = bisect.bisect_left(array, x...
python
def find_lt(array, x): """ Find rightmost value less than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_lt([0, 1, 2, 3], 2.5) 2 **中文文档** 寻找最大的小于x的数。 """ i = bisect.bisect_left(array, x...
[ "def", "find_lt", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "array", ",", "x", ")", "if", "i", ":", "return", "array", "[", "i", "-", "1", "]", "raise", "ValueError" ]
Find rightmost value less than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_lt([0, 1, 2, 3], 2.5) 2 **中文文档** 寻找最大的小于x的数。
[ "Find", "rightmost", "value", "less", "than", "x", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L50-L71
train
Find rightmost value less than x.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_le
def find_le(array, x): """ Find rightmost value less than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_le([0, 1, 2, 3], 2.0) 2 **中文文档** 寻找最大的小于等于x的数。 """ i = bisect.bisect...
python
def find_le(array, x): """ Find rightmost value less than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_le([0, 1, 2, 3], 2.0) 2 **中文文档** 寻找最大的小于等于x的数。 """ i = bisect.bisect...
[ "def", "find_le", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_right", "(", "array", ",", "x", ")", "if", "i", ":", "return", "array", "[", "i", "-", "1", "]", "raise", "ValueError" ]
Find rightmost value less than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_le([0, 1, 2, 3], 2.0) 2 **中文文档** 寻找最大的小于等于x的数。
[ "Find", "rightmost", "value", "less", "than", "or", "equal", "to", "x", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L74-L95
train
Find the rightmost value less than or equal to x.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_gt
def find_gt(array, x): """ Find leftmost value greater than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_gt([0, 1, 2, 3], 0.5) 1 **中文文档** 寻找最小的大于x的数。 """ i = bisect.bisect_right(array...
python
def find_gt(array, x): """ Find leftmost value greater than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_gt([0, 1, 2, 3], 0.5) 1 **中文文档** 寻找最小的大于x的数。 """ i = bisect.bisect_right(array...
[ "def", "find_gt", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_right", "(", "array", ",", "x", ")", "if", "i", "!=", "len", "(", "array", ")", ":", "return", "array", "[", "i", "]", "raise", "ValueError" ]
Find leftmost value greater than x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_gt([0, 1, 2, 3], 0.5) 1 **中文文档** 寻找最小的大于x的数。
[ "Find", "leftmost", "value", "greater", "than", "x", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L98-L119
train
Find the first value greater than x.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_ge
def find_ge(array, x): """ Find leftmost item greater than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_ge([0, 1, 2, 3], 1.0) 1 **中文文档** 寻找最小的大于等于x的数。 """ i = bisect.bisec...
python
def find_ge(array, x): """ Find leftmost item greater than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_ge([0, 1, 2, 3], 1.0) 1 **中文文档** 寻找最小的大于等于x的数。 """ i = bisect.bisec...
[ "def", "find_ge", "(", "array", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "array", ",", "x", ")", "if", "i", "!=", "len", "(", "array", ")", ":", "return", "array", "[", "i", "]", "raise", "ValueError" ]
Find leftmost item greater than or equal to x. :type array: list :param array: an iterable object that support inex :param x: a comparable value Example:: >>> find_ge([0, 1, 2, 3], 1.0) 1 **中文文档** 寻找最小的大于等于x的数。
[ "Find", "leftmost", "item", "greater", "than", "or", "equal", "to", "x", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L122-L143
train
Find the leftmost item greater than or equal to x.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_nearest
def find_nearest(sorted_list, x): """ Find the nearest item of x from sorted array. :type array: list :param array: an iterable object that support inex :param x: a comparable value note: for finding the nearest item from a descending array, I recommend find_nearest(sorted_list[::-1], x)....
python
def find_nearest(sorted_list, x): """ Find the nearest item of x from sorted array. :type array: list :param array: an iterable object that support inex :param x: a comparable value note: for finding the nearest item from a descending array, I recommend find_nearest(sorted_list[::-1], x)....
[ "def", "find_nearest", "(", "sorted_list", ",", "x", ")", ":", "if", "x", "<=", "sorted_list", "[", "0", "]", ":", "return", "sorted_list", "[", "0", "]", "elif", "x", ">=", "sorted_list", "[", "-", "1", "]", ":", "return", "sorted_list", "[", "-", ...
Find the nearest item of x from sorted array. :type array: list :param array: an iterable object that support inex :param x: a comparable value note: for finding the nearest item from a descending array, I recommend find_nearest(sorted_list[::-1], x). Because the built-in list[::-1] method is...
[ "Find", "the", "nearest", "item", "of", "x", "from", "sorted", "array", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L146-L178
train
Find the nearest item of x from sorted array.
MacHu-GWU/single_file_module-project
sfm/binarysearch.py
find_last_true
def find_last_true(sorted_list, true_criterion): """ Suppose we have a list of item [item1, item2, ..., itemN]. :type array: list :param array: an iterable object that support inex :param x: a comparable value If we do a mapping:: >>> def true_criterion(item): ... return ...
python
def find_last_true(sorted_list, true_criterion): """ Suppose we have a list of item [item1, item2, ..., itemN]. :type array: list :param array: an iterable object that support inex :param x: a comparable value If we do a mapping:: >>> def true_criterion(item): ... return ...
[ "def", "find_last_true", "(", "sorted_list", ",", "true_criterion", ")", ":", "# exam first item, if not true, then impossible to find result", "if", "not", "true_criterion", "(", "sorted_list", "[", "0", "]", ")", ":", "raise", "ValueError", "# exam last item, if true, it ...
Suppose we have a list of item [item1, item2, ..., itemN]. :type array: list :param array: an iterable object that support inex :param x: a comparable value If we do a mapping:: >>> def true_criterion(item): ... return item <= 6 >>> [true_criterion(item) for item in sorte...
[ "Suppose", "we", "have", "a", "list", "of", "item", "[", "item1", "item2", "...", "itemN", "]", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/binarysearch.py#L181-L268
train
This function will find the last true item in a list that is not in the list.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
format_x_tick
def format_x_tick(axis, major_locator=None, major_formatter=None, minor_locator=None, minor_formatter=None): """Set x axis's format. This method is designed for time axis. **中文文档** 设置X轴格式。 """ if major_locator: ax...
python
def format_x_tick(axis, major_locator=None, major_formatter=None, minor_locator=None, minor_formatter=None): """Set x axis's format. This method is designed for time axis. **中文文档** 设置X轴格式。 """ if major_locator: ax...
[ "def", "format_x_tick", "(", "axis", ",", "major_locator", "=", "None", ",", "major_formatter", "=", "None", ",", "minor_locator", "=", "None", ",", "minor_formatter", "=", "None", ")", ":", "if", "major_locator", ":", "axis", ".", "xaxis", ".", "set_major_l...
Set x axis's format. This method is designed for time axis. **中文文档** 设置X轴格式。
[ "Set", "x", "axis", "s", "format", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L60-L85
train
Set x axis s format.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
set_legend
def set_legend(axis, lines, legend): """Set line legend. **中文文档** 设置图例。 """ try: if legend: axis.legend(lines, legend) except Exception as e: raise ValueError("invalid 'legend', Error: %s" % e)
python
def set_legend(axis, lines, legend): """Set line legend. **中文文档** 设置图例。 """ try: if legend: axis.legend(lines, legend) except Exception as e: raise ValueError("invalid 'legend', Error: %s" % e)
[ "def", "set_legend", "(", "axis", ",", "lines", ",", "legend", ")", ":", "try", ":", "if", "legend", ":", "axis", ".", "legend", "(", "lines", ",", "legend", ")", "except", "Exception", "as", "e", ":", "raise", "ValueError", "(", "\"invalid 'legend', Err...
Set line legend. **中文文档** 设置图例。
[ "Set", "line", "legend", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L119-L130
train
Set line legend.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
get_max
def get_max(array): """Get maximum value of an array. Automatically ignore invalid data. **中文文档** 获得最大值。 """ largest = -np.inf for i in array: try: if i > largest: largest = i except: pass if np.isinf(largest): raise ValueErro...
python
def get_max(array): """Get maximum value of an array. Automatically ignore invalid data. **中文文档** 获得最大值。 """ largest = -np.inf for i in array: try: if i > largest: largest = i except: pass if np.isinf(largest): raise ValueErro...
[ "def", "get_max", "(", "array", ")", ":", "largest", "=", "-", "np", ".", "inf", "for", "i", "in", "array", ":", "try", ":", "if", "i", ">", "largest", ":", "largest", "=", "i", "except", ":", "pass", "if", "np", ".", "isinf", "(", "largest", "...
Get maximum value of an array. Automatically ignore invalid data. **中文文档** 获得最大值。
[ "Get", "maximum", "value", "of", "an", "array", ".", "Automatically", "ignore", "invalid", "data", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L133-L150
train
Get maximum value of an array. Automatically ignore invalid data.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
get_min
def get_min(array): """Get minimum value of an array. Automatically ignore invalid data. **中文文档** 获得最小值。 """ smallest = np.inf for i in array: try: if i < smallest: smallest = i except: pass if np.isinf(smallest): raise ValueE...
python
def get_min(array): """Get minimum value of an array. Automatically ignore invalid data. **中文文档** 获得最小值。 """ smallest = np.inf for i in array: try: if i < smallest: smallest = i except: pass if np.isinf(smallest): raise ValueE...
[ "def", "get_min", "(", "array", ")", ":", "smallest", "=", "np", ".", "inf", "for", "i", "in", "array", ":", "try", ":", "if", "i", "<", "smallest", ":", "smallest", "=", "i", "except", ":", "pass", "if", "np", ".", "isinf", "(", "smallest", ")",...
Get minimum value of an array. Automatically ignore invalid data. **中文文档** 获得最小值。
[ "Get", "minimum", "value", "of", "an", "array", ".", "Automatically", "ignore", "invalid", "data", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L153-L170
train
Get minimum value of an array. Automatically ignore invalid data.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
get_yAxis_limit
def get_yAxis_limit(y, lower=0.05, upper=0.2): """Find optimal y_min and y_max that guarantee enough space for legend and plot. **中文文档** 计算y坐标轴的最小和最大坐标。 :params lower: ymin为 y的最小值再减去gap的一定倍率 :params upper: ymax为 y的最大值再加上gap的一定倍率 """ smallest = get_min(y) largest = get_max(y) ...
python
def get_yAxis_limit(y, lower=0.05, upper=0.2): """Find optimal y_min and y_max that guarantee enough space for legend and plot. **中文文档** 计算y坐标轴的最小和最大坐标。 :params lower: ymin为 y的最小值再减去gap的一定倍率 :params upper: ymax为 y的最大值再加上gap的一定倍率 """ smallest = get_min(y) largest = get_max(y) ...
[ "def", "get_yAxis_limit", "(", "y", ",", "lower", "=", "0.05", ",", "upper", "=", "0.2", ")", ":", "smallest", "=", "get_min", "(", "y", ")", "largest", "=", "get_max", "(", "y", ")", "gap", "=", "largest", "-", "smallest", "if", "gap", ">=", "0.00...
Find optimal y_min and y_max that guarantee enough space for legend and plot. **中文文档** 计算y坐标轴的最小和最大坐标。 :params lower: ymin为 y的最小值再减去gap的一定倍率 :params upper: ymax为 y的最大值再加上gap的一定倍率
[ "Find", "optimal", "y_min", "and", "y_max", "that", "guarantee", "enough", "space", "for", "legend", "and", "plot", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L173-L193
train
Find optimal y_min and y_max that guarantee enough space for legend and plot.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
create_figure
def create_figure(width=20, height=10): """Create a figure instance. :params width: figure width :params height: figure height """ figure = plt.figure(figsize=(width, height)) axis = figure.add_subplot(1, 1, 1) return figure, axis
python
def create_figure(width=20, height=10): """Create a figure instance. :params width: figure width :params height: figure height """ figure = plt.figure(figsize=(width, height)) axis = figure.add_subplot(1, 1, 1) return figure, axis
[ "def", "create_figure", "(", "width", "=", "20", ",", "height", "=", "10", ")", ":", "figure", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "width", ",", "height", ")", ")", "axis", "=", "figure", ".", "add_subplot", "(", "1", ",", "1", "...
Create a figure instance. :params width: figure width :params height: figure height
[ "Create", "a", "figure", "instance", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L196-L204
train
Create a figure instance.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
preprocess_x_y
def preprocess_x_y(x, y): """Preprocess x, y input data. Returns list of list style. **中文文档** 预处理输入的x, y数据。 """ def is_iterable_slicable(a): if hasattr(a, "__iter__") and hasattr(a, "__getitem__"): return True else: return False if is_iterable_slicable(...
python
def preprocess_x_y(x, y): """Preprocess x, y input data. Returns list of list style. **中文文档** 预处理输入的x, y数据。 """ def is_iterable_slicable(a): if hasattr(a, "__iter__") and hasattr(a, "__getitem__"): return True else: return False if is_iterable_slicable(...
[ "def", "preprocess_x_y", "(", "x", ",", "y", ")", ":", "def", "is_iterable_slicable", "(", "a", ")", ":", "if", "hasattr", "(", "a", ",", "\"__iter__\"", ")", "and", "hasattr", "(", "a", ",", "\"__getitem__\"", ")", ":", "return", "True", "else", ":", ...
Preprocess x, y input data. Returns list of list style. **中文文档** 预处理输入的x, y数据。
[ "Preprocess", "x", "y", "input", "data", ".", "Returns", "list", "of", "list", "style", "." ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L207-L226
train
Preprocess x y input data. Returns list of list style.
MacHu-GWU/single_file_module-project
sfm/matplot_mate.py
plot_time_series
def plot_time_series(x, y, linewidth=1, linestyle="-", xlabel=None, ylabel=None, x_major_locattor=None, x_major_formatter=None, x_minor_locattor=None, x_minor_formatter=None, title=None, legend=None, cycol=None): ...
python
def plot_time_series(x, y, linewidth=1, linestyle="-", xlabel=None, ylabel=None, x_major_locattor=None, x_major_formatter=None, x_minor_locattor=None, x_minor_formatter=None, title=None, legend=None, cycol=None): ...
[ "def", "plot_time_series", "(", "x", ",", "y", ",", "linewidth", "=", "1", ",", "linestyle", "=", "\"-\"", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "x_major_locattor", "=", "None", ",", "x_major_formatter", "=", "None", ",", "x_minor_...
:param x: time array or tuple :param y: time array or tuple **中文文档** 为时间序列数据画图。
[ ":", "param", "x", ":", "time", "array", "or", "tuple", ":", "param", "y", ":", "time", "array", "or", "tuple" ]
01f7a6b250853bebfd73de275895bf274325cfc1
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/matplot_mate.py#L229-L269
train
Plot a series of time values.
envi-idl/envipyengine
envipyengine/taskengine/taskengine.py
execute
def execute(input_params, engine, cwd=None): """ Execute a task with the provided input parameters :param input_params: Python dictionary containg all input parameters. This will be converted to JSON before being passed to the task engine. :param engine...
python
def execute(input_params, engine, cwd=None): """ Execute a task with the provided input parameters :param input_params: Python dictionary containg all input parameters. This will be converted to JSON before being passed to the task engine. :param engine...
[ "def", "execute", "(", "input_params", ",", "engine", ",", "cwd", "=", "None", ")", ":", "try", ":", "taskengine_exe", "=", "config", ".", "get", "(", "'engine'", ")", "except", "NoConfigOptionError", ":", "raise", "TaskEngineNotFoundError", "(", "\"Task Engin...
Execute a task with the provided input parameters :param input_params: Python dictionary containg all input parameters. This will be converted to JSON before being passed to the task engine. :param engine: String specifying Task Engine type to run (ENVI, IDL, e...
[ "Execute", "a", "task", "with", "the", "provided", "input", "parameters" ]
567b639d6592deec3289f6122a9e3d18f2f98432
https://github.com/envi-idl/envipyengine/blob/567b639d6592deec3289f6122a9e3d18f2f98432/envipyengine/taskengine/taskengine.py#L17-L84
train
Execute a task with the provided input parameters and return the output as a JSON string.
Godley/MuseParse
MuseParse/classes/Output/LilypondOutput.py
LilypondRenderer.run
def run(self, wrappers=["", ""]): ''' run the lilypond script on the hierarchy class :param wrappers: this is useful for testing: use wrappers to put something around the outputted "lilypond string" from the hierarchy class. For example if you're testing a pitch, you might put \relative...
python
def run(self, wrappers=["", ""]): ''' run the lilypond script on the hierarchy class :param wrappers: this is useful for testing: use wrappers to put something around the outputted "lilypond string" from the hierarchy class. For example if you're testing a pitch, you might put \relative...
[ "def", "run", "(", "self", ",", "wrappers", "=", "[", "\"\"", ",", "\"\"", "]", ")", ":", "opened_file", "=", "open", "(", "self", ".", "lyfile", ",", "'w'", ")", "lilystring", "=", "self", ".", "piece_obj", ".", "toLily", "(", ")", "opened_file", ...
run the lilypond script on the hierarchy class :param wrappers: this is useful for testing: use wrappers to put something around the outputted "lilypond string" from the hierarchy class. For example if you're testing a pitch, you might put \relative c {} around the note so that lilypond handles it prop...
[ "run", "the", "lilypond", "script", "on", "the", "hierarchy", "class" ]
23cecafa1fdc0f2d6a87760553572b459f3c9904
https://github.com/Godley/MuseParse/blob/23cecafa1fdc0f2d6a87760553572b459f3c9904/MuseParse/classes/Output/LilypondOutput.py#L42-L64
train
run the lilypond script on the hierarchy class
koszullab/metaTOR
metator/scripts/bins.py
extract_subnetworks
def extract_subnetworks( partition_file, network_file, output_dir, max_cores=DEFAULT_MAX_CORES, max_size_matrix=DEFAULT_MAX_SIZE_MATRIX, saturation_threshold=DEFAULT_SATURATION_THRESHOLD, ): """Extract bin subnetworks from the main network Identify bins, extract subnets, draws the adjac...
python
def extract_subnetworks( partition_file, network_file, output_dir, max_cores=DEFAULT_MAX_CORES, max_size_matrix=DEFAULT_MAX_SIZE_MATRIX, saturation_threshold=DEFAULT_SATURATION_THRESHOLD, ): """Extract bin subnetworks from the main network Identify bins, extract subnets, draws the adjac...
[ "def", "extract_subnetworks", "(", "partition_file", ",", "network_file", ",", "output_dir", ",", "max_cores", "=", "DEFAULT_MAX_CORES", ",", "max_size_matrix", "=", "DEFAULT_MAX_SIZE_MATRIX", ",", "saturation_threshold", "=", "DEFAULT_SATURATION_THRESHOLD", ",", ")", ":"...
Extract bin subnetworks from the main network Identify bins, extract subnets, draws the adjacency matrices, saves it all in a specified output directory. Parameters ---------- partition_file : file, str or pathlib.Path The file containing, for each chunk, the communities it was ass...
[ "Extract", "bin", "subnetworks", "from", "the", "main", "network" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/bins.py#L37-L180
train
Extract bin subnetworks from the main network and save them in a specified output directory.
koszullab/metaTOR
metator/scripts/bins.py
extract_fasta
def extract_fasta( partition_file, fasta_file, output_dir, chunk_size=DEFAULT_CHUNK_SIZE, max_cores=DEFAULT_MAX_CORES, ): """Extract sequences from bins Identify bins, extract chunks belonging to each bins and gather them in a single FASTA file. Parameters ---------- parti...
python
def extract_fasta( partition_file, fasta_file, output_dir, chunk_size=DEFAULT_CHUNK_SIZE, max_cores=DEFAULT_MAX_CORES, ): """Extract sequences from bins Identify bins, extract chunks belonging to each bins and gather them in a single FASTA file. Parameters ---------- parti...
[ "def", "extract_fasta", "(", "partition_file", ",", "fasta_file", ",", "output_dir", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ",", "max_cores", "=", "DEFAULT_MAX_CORES", ",", ")", ":", "genome", "=", "{", "record", ".", "id", ":", "record", ".", "seq", ...
Extract sequences from bins Identify bins, extract chunks belonging to each bins and gather them in a single FASTA file. Parameters ---------- partition_file : file, str or pathlib.Path The file containing, for each chunk, the communities it was assigned to at each iteration. f...
[ "Extract", "sequences", "from", "bins" ]
0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/bins.py#L183-L243
train
Extract sequences from a set of bins and produce a single FASTA file.