repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData._parse_segments
def _parse_segments(self): """ Read the segment output file and parse into an SQLite database. """ reader = csv.reader(open(self._segment_file, 'rU'), delimiter='\t') for row in reader: if reader.line_num == 1: # skip header contin...
python
def _parse_segments(self): """ Read the segment output file and parse into an SQLite database. """ reader = csv.reader(open(self._segment_file, 'rU'), delimiter='\t') for row in reader: if reader.line_num == 1: # skip header contin...
[ "def", "_parse_segments", "(", "self", ")", ":", "reader", "=", "csv", ".", "reader", "(", "open", "(", "self", ".", "_segment_file", ",", "'rU'", ")", ",", "delimiter", "=", "'\\t'", ")", "for", "row", "in", "reader", ":", "if", "reader", ".", "line...
Read the segment output file and parse into an SQLite database.
[ "Read", "the", "segment", "output", "file", "and", "parse", "into", "an", "SQLite", "database", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L122-L134
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicon_leaves
def get_multiplicon_leaves(self, redundant=False): """ Return a generator of the IDs of multiplicons found at leaves of the tree (i.e. from which no further multiplicons were derived). Arguments: o redundant - if true, report redundant multiplicons """ for n...
python
def get_multiplicon_leaves(self, redundant=False): """ Return a generator of the IDs of multiplicons found at leaves of the tree (i.e. from which no further multiplicons were derived). Arguments: o redundant - if true, report redundant multiplicons """ for n...
[ "def", "get_multiplicon_leaves", "(", "self", ",", "redundant", "=", "False", ")", ":", "for", "node", "in", "self", ".", "_multiplicon_graph", ".", "nodes", "(", ")", ":", "if", "not", "len", "(", "self", ".", "_multiplicon_graph", ".", "out_edges", "(", ...
Return a generator of the IDs of multiplicons found at leaves of the tree (i.e. from which no further multiplicons were derived). Arguments: o redundant - if true, report redundant multiplicons
[ "Return", "a", "generator", "of", "the", "IDs", "of", "multiplicons", "found", "at", "leaves", "of", "the", "tree", "(", "i", ".", "e", ".", "from", "which", "no", "further", "multiplicons", "were", "derived", ")", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L136-L153
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicon_seeds
def get_multiplicon_seeds(self, redundant=False): """ Return a generator of the IDs of multiplicons that are initial seeding 'pairs' in level 2 multiplicons. Arguments: o redundant - if true, report redundant multiplicons """ for node in self._multiplicon_gr...
python
def get_multiplicon_seeds(self, redundant=False): """ Return a generator of the IDs of multiplicons that are initial seeding 'pairs' in level 2 multiplicons. Arguments: o redundant - if true, report redundant multiplicons """ for node in self._multiplicon_gr...
[ "def", "get_multiplicon_seeds", "(", "self", ",", "redundant", "=", "False", ")", ":", "for", "node", "in", "self", ".", "_multiplicon_graph", ".", "nodes", "(", ")", ":", "if", "not", "len", "(", "self", ".", "_multiplicon_graph", ".", "in_edges", "(", ...
Return a generator of the IDs of multiplicons that are initial seeding 'pairs' in level 2 multiplicons. Arguments: o redundant - if true, report redundant multiplicons
[ "Return", "a", "generator", "of", "the", "IDs", "of", "multiplicons", "that", "are", "initial", "seeding", "pairs", "in", "level", "2", "multiplicons", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L155-L172
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicon_intermediates
def get_multiplicon_intermediates(self, redundant=False): """ Return a generator of the IDs of multiplicons that are neither seeding 'pairs' in level 2 multiplicons, nor leaves. Arguments: o redundant - if true, report redundant multiplicons """ for node in ...
python
def get_multiplicon_intermediates(self, redundant=False): """ Return a generator of the IDs of multiplicons that are neither seeding 'pairs' in level 2 multiplicons, nor leaves. Arguments: o redundant - if true, report redundant multiplicons """ for node in ...
[ "def", "get_multiplicon_intermediates", "(", "self", ",", "redundant", "=", "False", ")", ":", "for", "node", "in", "self", ".", "_multiplicon_graph", ".", "nodes", "(", ")", ":", "if", "len", "(", "self", ".", "_multiplicon_graph", ".", "in_edges", "(", "...
Return a generator of the IDs of multiplicons that are neither seeding 'pairs' in level 2 multiplicons, nor leaves. Arguments: o redundant - if true, report redundant multiplicons
[ "Return", "a", "generator", "of", "the", "IDs", "of", "multiplicons", "that", "are", "neither", "seeding", "pairs", "in", "level", "2", "multiplicons", "nor", "leaves", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L174-L192
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicon_properties
def get_multiplicon_properties(self, value): """ Return a dictionary describing multiplicon data: id, parent, level, number_of_anchorpoints, profile_length, is_redundant and the contributing genome segments """ sql = '''SELECT id, parent, level, number_of_anchorpoints, ...
python
def get_multiplicon_properties(self, value): """ Return a dictionary describing multiplicon data: id, parent, level, number_of_anchorpoints, profile_length, is_redundant and the contributing genome segments """ sql = '''SELECT id, parent, level, number_of_anchorpoints, ...
[ "def", "get_multiplicon_properties", "(", "self", ",", "value", ")", ":", "sql", "=", "'''SELECT id, parent, level, number_of_anchorpoints,\n profile_length, is_redundant\n FROM multiplicons WHERE id=:id'''", "cur", "=", "self", ".", "_dbconn",...
Return a dictionary describing multiplicon data: id, parent, level, number_of_anchorpoints, profile_length, is_redundant and the contributing genome segments
[ "Return", "a", "dictionary", "describing", "multiplicon", "data", ":", "id", "parent", "level", "number_of_anchorpoints", "profile_length", "is_redundant", "and", "the", "contributing", "genome", "segments" ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L194-L212
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicon_segments
def get_multiplicon_segments(self, value): """ Return a dictionary describing the genome segments that contribute to the named multiplicon, keyed by genome, with (start feature, end feature) tuples. """ sql = '''SELECT genome, first, last FROM segments ...
python
def get_multiplicon_segments(self, value): """ Return a dictionary describing the genome segments that contribute to the named multiplicon, keyed by genome, with (start feature, end feature) tuples. """ sql = '''SELECT genome, first, last FROM segments ...
[ "def", "get_multiplicon_segments", "(", "self", ",", "value", ")", ":", "sql", "=", "'''SELECT genome, first, last FROM segments\n WHERE multiplicon=:mp'''", "cur", "=", "self", ".", "_dbconn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "sq...
Return a dictionary describing the genome segments that contribute to the named multiplicon, keyed by genome, with (start feature, end feature) tuples.
[ "Return", "a", "dictionary", "describing", "the", "genome", "segments", "that", "contribute", "to", "the", "named", "multiplicon", "keyed", "by", "genome", "with", "(", "start", "feature", "end", "feature", ")", "tuples", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L214-L228
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.get_multiplicons_at_level
def get_multiplicons_at_level(self, level, redundant=False): """ Return a list of IDs of multiplicons at the requested level """ sql = '''SELECT id FROM multiplicons WHERE level=:level''' cur = self._dbconn.cursor() cur.execute(sql, {'level': str(level)}) ...
python
def get_multiplicons_at_level(self, level, redundant=False): """ Return a list of IDs of multiplicons at the requested level """ sql = '''SELECT id FROM multiplicons WHERE level=:level''' cur = self._dbconn.cursor() cur.execute(sql, {'level': str(level)}) ...
[ "def", "get_multiplicons_at_level", "(", "self", ",", "level", ",", "redundant", "=", "False", ")", ":", "sql", "=", "'''SELECT id FROM multiplicons\n WHERE level=:level'''", "cur", "=", "self", ".", "_dbconn", ".", "cursor", "(", ")", "cur", ".", ...
Return a list of IDs of multiplicons at the requested level
[ "Return", "a", "list", "of", "IDs", "of", "multiplicons", "at", "the", "requested", "level" ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L230-L242
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.is_redundant_multiplicon
def is_redundant_multiplicon(self, value): """ Returns True if the passed multiplicon ID is redundant, False otherwise. - value, (int) multiplicon ID """ if not hasattr(self, '_redundant_multiplicon_cache'): sql = '''SELECT id FROM multiplicons WHERE is_redun...
python
def is_redundant_multiplicon(self, value): """ Returns True if the passed multiplicon ID is redundant, False otherwise. - value, (int) multiplicon ID """ if not hasattr(self, '_redundant_multiplicon_cache'): sql = '''SELECT id FROM multiplicons WHERE is_redun...
[ "def", "is_redundant_multiplicon", "(", "self", ",", "value", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_redundant_multiplicon_cache'", ")", ":", "sql", "=", "'''SELECT id FROM multiplicons WHERE is_redundant=\"-1\"'''", "cur", "=", "self", ".", "_dbconn",...
Returns True if the passed multiplicon ID is redundant, False otherwise. - value, (int) multiplicon ID
[ "Returns", "True", "if", "the", "passed", "multiplicon", "ID", "is", "redundant", "False", "otherwise", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L244-L259
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.write
def write(self, mfile="multiplicons.txt", sfile="segments.txt", clobber=False): """ Writes multiplicon and segment files to the named locations. - mfile, (str) location for multiplicons file - sfile, (str) location for segments file - clobber, (Boolean) True if...
python
def write(self, mfile="multiplicons.txt", sfile="segments.txt", clobber=False): """ Writes multiplicon and segment files to the named locations. - mfile, (str) location for multiplicons file - sfile, (str) location for segments file - clobber, (Boolean) True if...
[ "def", "write", "(", "self", ",", "mfile", "=", "\"multiplicons.txt\"", ",", "sfile", "=", "\"segments.txt\"", ",", "clobber", "=", "False", ")", ":", "if", "not", "clobber", ":", "if", "os", ".", "path", ".", "isfile", "(", "mfile", ")", ":", "raise",...
Writes multiplicon and segment files to the named locations. - mfile, (str) location for multiplicons file - sfile, (str) location for segments file - clobber, (Boolean) True if we overwrite target files
[ "Writes", "multiplicon", "and", "segment", "files", "to", "the", "named", "locations", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L261-L275
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData._write_multiplicons
def _write_multiplicons(self, filename): """ Write multiplicons to file. - filename, (str) location of output file """ # Column headers mhead = '\t'.join(['id', 'genome_x', 'list_x', 'parent', 'genome_y', 'list_y', 'level', 'number_of_anchorpoints'...
python
def _write_multiplicons(self, filename): """ Write multiplicons to file. - filename, (str) location of output file """ # Column headers mhead = '\t'.join(['id', 'genome_x', 'list_x', 'parent', 'genome_y', 'list_y', 'level', 'number_of_anchorpoints'...
[ "def", "_write_multiplicons", "(", "self", ",", "filename", ")", ":", "# Column headers", "mhead", "=", "'\\t'", ".", "join", "(", "[", "'id'", ",", "'genome_x'", ",", "'list_x'", ",", "'parent'", ",", "'genome_y'", ",", "'list_y'", ",", "'level'", ",", "'...
Write multiplicons to file. - filename, (str) location of output file
[ "Write", "multiplicons", "to", "file", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L277-L290
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData._write_segments
def _write_segments(self, filename): """ Write segments to file. - filename, (str) location of output file """ # Column headers shead = '\t'.join(['id', 'multiplicon', 'genome', 'list', 'first', 'last', 'order']) with open(filename, 'w') as...
python
def _write_segments(self, filename): """ Write segments to file. - filename, (str) location of output file """ # Column headers shead = '\t'.join(['id', 'multiplicon', 'genome', 'list', 'first', 'last', 'order']) with open(filename, 'w') as...
[ "def", "_write_segments", "(", "self", ",", "filename", ")", ":", "# Column headers", "shead", "=", "'\\t'", ".", "join", "(", "[", "'id'", ",", "'multiplicon'", ",", "'genome'", ",", "'list'", ",", "'first'", ",", "'last'", ",", "'order'", "]", ")", "wi...
Write segments to file. - filename, (str) location of output file
[ "Write", "segments", "to", "file", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L292-L303
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.multiplicon_file
def multiplicon_file(self, value): """ Setter for _multiplicon_file attribute """ assert os.path.isfile(value), "%s is not a valid file" % value self._multiplicon_file = value
python
def multiplicon_file(self, value): """ Setter for _multiplicon_file attribute """ assert os.path.isfile(value), "%s is not a valid file" % value self._multiplicon_file = value
[ "def", "multiplicon_file", "(", "self", ",", "value", ")", ":", "assert", "os", ".", "path", ".", "isfile", "(", "value", ")", ",", "\"%s is not a valid file\"", "%", "value", "self", ".", "_multiplicon_file", "=", "value" ]
Setter for _multiplicon_file attribute
[ "Setter", "for", "_multiplicon_file", "attribute" ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L311-L314
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.segment_file
def segment_file(self, value): """ Setter for _segment_file attribute """ assert os.path.isfile(value), "%s is not a valid file" % value self._segment_file = value
python
def segment_file(self, value): """ Setter for _segment_file attribute """ assert os.path.isfile(value), "%s is not a valid file" % value self._segment_file = value
[ "def", "segment_file", "(", "self", ",", "value", ")", ":", "assert", "os", ".", "path", ".", "isfile", "(", "value", ")", ",", "\"%s is not a valid file\"", "%", "value", "self", ".", "_segment_file", "=", "value" ]
Setter for _segment_file attribute
[ "Setter", "for", "_segment_file", "attribute" ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L322-L325
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.db_file
def db_file(self, value): """ Setter for _db_file attribute """ assert not os.path.isfile(value), "%s already exists" % value self._db_file = value
python
def db_file(self, value): """ Setter for _db_file attribute """ assert not os.path.isfile(value), "%s already exists" % value self._db_file = value
[ "def", "db_file", "(", "self", ",", "value", ")", ":", "assert", "not", "os", ".", "path", ".", "isfile", "(", "value", ")", ",", "\"%s already exists\"", "%", "value", "self", ".", "_db_file", "=", "value" ]
Setter for _db_file attribute
[ "Setter", "for", "_db_file", "attribute" ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L333-L336
widdowquinn/pyADHoRe
pyadhore/iadhore.py
IadhoreData.multiplicons
def multiplicons(self): """ Multiplicon table from SQLite database. """ sql = '''SELECT * FROM multiplicons''' cur = self._dbconn.cursor() cur.execute(sql) data = [r for r in cur.fetchall()] cur.close() return data
python
def multiplicons(self): """ Multiplicon table from SQLite database. """ sql = '''SELECT * FROM multiplicons''' cur = self._dbconn.cursor() cur.execute(sql) data = [r for r in cur.fetchall()] cur.close() return data
[ "def", "multiplicons", "(", "self", ")", ":", "sql", "=", "'''SELECT * FROM multiplicons'''", "cur", "=", "self", ".", "_dbconn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "sql", ")", "data", "=", "[", "r", "for", "r", "in", "cur", ".", "f...
Multiplicon table from SQLite database.
[ "Multiplicon", "table", "from", "SQLite", "database", "." ]
train
https://github.com/widdowquinn/pyADHoRe/blob/b2ebbf6ae9c6afe9262eb0e3d9cf395970e38533/pyadhore/iadhore.py#L344-L351
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/compare_bim.py
main
def main(): """ The main function of the module. The purpose of this module is to find markers that were removed by Plink. When Plinks exclude some markers from binary files, there are no easy way to find the list of removed markers, except by comparing the two BIM files (before and after modificat...
python
def main(): """ The main function of the module. The purpose of this module is to find markers that were removed by Plink. When Plinks exclude some markers from binary files, there are no easy way to find the list of removed markers, except by comparing the two BIM files (before and after modificat...
[ "def", "main", "(", ")", ":", "# Getting and checking the options", "args", "=", "parseArgs", "(", ")", "checkArgs", "(", "args", ")", "# Reading the bim files", "beforeBIM", "=", "readBIM", "(", "args", ".", "before", ")", "afterBIM", "=", "readBIM", "(", "ar...
The main function of the module. The purpose of this module is to find markers that were removed by Plink. When Plinks exclude some markers from binary files, there are no easy way to find the list of removed markers, except by comparing the two BIM files (before and after modification). Here are ...
[ "The", "main", "function", "of", "the", "module", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/compare_bim.py#L36-L66
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/compare_bim.py
compareSNPs
def compareSNPs(before, after, outFileName): """Compares two set of SNPs. :param before: the names of the markers in the ``before`` file. :param after: the names of the markers in the ``after`` file. :param outFileName: the name of the output file. :type before: set :type after: set :type ...
python
def compareSNPs(before, after, outFileName): """Compares two set of SNPs. :param before: the names of the markers in the ``before`` file. :param after: the names of the markers in the ``after`` file. :param outFileName: the name of the output file. :type before: set :type after: set :type ...
[ "def", "compareSNPs", "(", "before", ",", "after", ",", "outFileName", ")", ":", "# First, check that \"before\" is larger than \"after\"", "if", "len", "(", "after", ")", ">", "len", "(", "before", ")", ":", "msg", "=", "\"there are more SNPs after than before\"", ...
Compares two set of SNPs. :param before: the names of the markers in the ``before`` file. :param after: the names of the markers in the ``after`` file. :param outFileName: the name of the output file. :type before: set :type after: set :type outFileName: str Finds the difference between t...
[ "Compares", "two", "set", "of", "SNPs", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/compare_bim.py#L69-L110
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/compare_bim.py
readBIM
def readBIM(fileName): """Reads a BIM file. :param fileName: the name of the BIM file to read. :type fileName: str :returns: the set of markers in the BIM file. Reads a Plink BIM file and extract the name of the markers. There is one marker per line, and the name of the marker is in the seco...
python
def readBIM(fileName): """Reads a BIM file. :param fileName: the name of the BIM file to read. :type fileName: str :returns: the set of markers in the BIM file. Reads a Plink BIM file and extract the name of the markers. There is one marker per line, and the name of the marker is in the seco...
[ "def", "readBIM", "(", "fileName", ")", ":", "# Reading the first BIM file", "snps", "=", "set", "(", ")", "with", "open", "(", "fileName", ",", "\"r\"", ")", "as", "inputFile", ":", "for", "line", "in", "inputFile", ":", "row", "=", "line", ".", "rstrip...
Reads a BIM file. :param fileName: the name of the BIM file to read. :type fileName: str :returns: the set of markers in the BIM file. Reads a Plink BIM file and extract the name of the markers. There is one marker per line, and the name of the marker is in the second column. There is no hea...
[ "Reads", "a", "BIM", "file", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/compare_bim.py#L113-L135
lemieuxl/pyGenClean
pyGenClean/PlinkUtils/compare_bim.py
checkArgs
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
python
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
[ "def", "checkArgs", "(", "args", ")", ":", "# Check the \"before\" file", "if", "not", "args", ".", "before", ".", "endswith", "(", "\".bim\"", ")", ":", "msg", "=", "\"%s: not a BIM file (extension must be .bim)\"", "%", "args", ".", "before", "raise", "ProgramEr...
Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t...
[ "Checks", "the", "arguments", "and", "options", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/PlinkUtils/compare_bim.py#L138-L168
emdb-empiar/ahds
ahds/header.py
Block.add_attr
def add_attr(self, name, value): """Add an attribute to an ``Block`` object""" setattr(self, name, value) self.attrs.append(name)
python
def add_attr(self, name, value): """Add an attribute to an ``Block`` object""" setattr(self, name, value) self.attrs.append(name)
[ "def", "add_attr", "(", "self", ",", "name", ",", "value", ")", ":", "setattr", "(", "self", ",", "name", ",", "value", ")", "self", ".", "attrs", ".", "append", "(", "name", ")" ]
Add an attribute to an ``Block`` object
[ "Add", "an", "attribute", "to", "an", "Block", "object" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/header.py#L55-L58
emdb-empiar/ahds
ahds/header.py
Block.ids
def ids(self): """Convenience method to get the ids for Materials present""" assert self.name == "Materials" ids = list() for attr in self.attrs: attr_obj = getattr(self, attr) if hasattr(attr_obj, 'Id'): ids.append(getattr(attr_obj, 'Id')) ...
python
def ids(self): """Convenience method to get the ids for Materials present""" assert self.name == "Materials" ids = list() for attr in self.attrs: attr_obj = getattr(self, attr) if hasattr(attr_obj, 'Id'): ids.append(getattr(attr_obj, 'Id')) ...
[ "def", "ids", "(", "self", ")", ":", "assert", "self", ".", "name", "==", "\"Materials\"", "ids", "=", "list", "(", ")", "for", "attr", "in", "self", ".", "attrs", ":", "attr_obj", "=", "getattr", "(", "self", ",", "attr", ")", "if", "hasattr", "("...
Convenience method to get the ids for Materials present
[ "Convenience", "method", "to", "get", "the", "ids", "for", "Materials", "present" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/header.py#L70-L78
emdb-empiar/ahds
ahds/header.py
AmiraHeader.from_file
def from_file(cls, fn, *args, **kwargs): """Constructor to build an AmiraHeader object from a file :param str fn: Amira file :return ah: object of class ``AmiraHeader`` containing header metadata :rtype: ah: :py:class:`ahds.header.AmiraHeader` """ return AmiraHea...
python
def from_file(cls, fn, *args, **kwargs): """Constructor to build an AmiraHeader object from a file :param str fn: Amira file :return ah: object of class ``AmiraHeader`` containing header metadata :rtype: ah: :py:class:`ahds.header.AmiraHeader` """ return AmiraHea...
[ "def", "from_file", "(", "cls", ",", "fn", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "AmiraHeader", "(", "get_parsed_data", "(", "fn", ",", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
Constructor to build an AmiraHeader object from a file :param str fn: Amira file :return ah: object of class ``AmiraHeader`` containing header metadata :rtype: ah: :py:class:`ahds.header.AmiraHeader`
[ "Constructor", "to", "build", "an", "AmiraHeader", "object", "from", "a", "file", ":", "param", "str", "fn", ":", "Amira", "file", ":", "return", "ah", ":", "object", "of", "class", "AmiraHeader", "containing", "header", "metadata", ":", "rtype", ":", "ah"...
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/header.py#L102-L109
wolfhong/formic
formic/formic.py
get_version
def get_version(): """Returns the version of formic. This method retrieves the version from VERSION.txt, and it should be exactly the same as the version retrieved from the package manager""" try: # Try with the package manager, if present from pkg_resources import resource_string ...
python
def get_version(): """Returns the version of formic. This method retrieves the version from VERSION.txt, and it should be exactly the same as the version retrieved from the package manager""" try: # Try with the package manager, if present from pkg_resources import resource_string ...
[ "def", "get_version", "(", ")", ":", "try", ":", "# Try with the package manager, if present", "from", "pkg_resources", "import", "resource_string", "return", "resource_string", "(", "__name__", ",", "\"VERSION.txt\"", ")", ".", "decode", "(", "'utf8'", ")", ".", "s...
Returns the version of formic. This method retrieves the version from VERSION.txt, and it should be exactly the same as the version retrieved from the package manager
[ "Returns", "the", "version", "of", "formic", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L46-L59
wolfhong/formic
formic/formic.py
get_path_components
def get_path_components(directory): """Breaks a path to a directory into a (drive, list-of-folders) tuple :param directory: :return: a tuple consisting of the drive (if any) and an ordered list of folder names """ drive, dirs = os.path.splitdrive(directory) folders = [] previou...
python
def get_path_components(directory): """Breaks a path to a directory into a (drive, list-of-folders) tuple :param directory: :return: a tuple consisting of the drive (if any) and an ordered list of folder names """ drive, dirs = os.path.splitdrive(directory) folders = [] previou...
[ "def", "get_path_components", "(", "directory", ")", ":", "drive", ",", "dirs", "=", "os", ".", "path", ".", "splitdrive", "(", "directory", ")", "folders", "=", "[", "]", "previous", "=", "\"\"", "while", "dirs", "!=", "previous", "and", "dirs", "!=", ...
Breaks a path to a directory into a (drive, list-of-folders) tuple :param directory: :return: a tuple consisting of the drive (if any) and an ordered list of folder names
[ "Breaks", "a", "path", "to", "a", "directory", "into", "a", "(", "drive", "list", "-", "of", "-", "folders", ")", "tuple" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L62-L78
wolfhong/formic
formic/formic.py
reconstitute_path
def reconstitute_path(drive, folders): """Reverts a tuple from `get_path_components` into a path. :param drive: A drive (eg 'c:'). Only applicable for NT systems :param folders: A list of folder names :return: A path comprising the drive and list of folder names. The path terminate with a ...
python
def reconstitute_path(drive, folders): """Reverts a tuple from `get_path_components` into a path. :param drive: A drive (eg 'c:'). Only applicable for NT systems :param folders: A list of folder names :return: A path comprising the drive and list of folder names. The path terminate with a ...
[ "def", "reconstitute_path", "(", "drive", ",", "folders", ")", ":", "reconstituted", "=", "os", ".", "path", ".", "join", "(", "drive", ",", "os", ".", "path", ".", "sep", ",", "*", "folders", ")", "return", "reconstituted" ]
Reverts a tuple from `get_path_components` into a path. :param drive: A drive (eg 'c:'). Only applicable for NT systems :param folders: A list of folder names :return: A path comprising the drive and list of folder names. The path terminate with a `os.path.sep` *only* if it is a root directory
[ "Reverts", "a", "tuple", "from", "get_path_components", "into", "a", "path", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L81-L90
wolfhong/formic
formic/formic.py
Matcher.create
def create(pattern, casesensitive=True): """Factory for :class:`Matcher` instances; returns a :class:`Matcher` suitable for matching the supplied pattern""" casesensitive = determine_casesensitive(casesensitive) if "?" in pattern or "*" in pattern: return FNMatcher(pattern, c...
python
def create(pattern, casesensitive=True): """Factory for :class:`Matcher` instances; returns a :class:`Matcher` suitable for matching the supplied pattern""" casesensitive = determine_casesensitive(casesensitive) if "?" in pattern or "*" in pattern: return FNMatcher(pattern, c...
[ "def", "create", "(", "pattern", ",", "casesensitive", "=", "True", ")", ":", "casesensitive", "=", "determine_casesensitive", "(", "casesensitive", ")", "if", "\"?\"", "in", "pattern", "or", "\"*\"", "in", "pattern", ":", "return", "FNMatcher", "(", "pattern"...
Factory for :class:`Matcher` instances; returns a :class:`Matcher` suitable for matching the supplied pattern
[ "Factory", "for", ":", "class", ":", "Matcher", "instances", ";", "returns", "a", ":", "class", ":", "Matcher", "suitable", "for", "matching", "the", "supplied", "pattern" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L120-L127
wolfhong/formic
formic/formic.py
FNMatcher.match
def match(self, string): """Returns True if the pattern matches the string""" if self.casesensitive: return fnmatch.fnmatch(string, self.pattern) else: return fnmatch.fnmatch(string.lower(), self.pattern.lower())
python
def match(self, string): """Returns True if the pattern matches the string""" if self.casesensitive: return fnmatch.fnmatch(string, self.pattern) else: return fnmatch.fnmatch(string.lower(), self.pattern.lower())
[ "def", "match", "(", "self", ",", "string", ")", ":", "if", "self", ".", "casesensitive", ":", "return", "fnmatch", ".", "fnmatch", "(", "string", ",", "self", ".", "pattern", ")", "else", ":", "return", "fnmatch", ".", "fnmatch", "(", "string", ".", ...
Returns True if the pattern matches the string
[ "Returns", "True", "if", "the", "pattern", "matches", "the", "string" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L168-L173
wolfhong/formic
formic/formic.py
ConstantMatcher.match
def match(self, string): """Returns True if the argument matches the constant.""" if self.casesensitive: return self.pattern == os.path.normcase(string) else: return self.pattern.lower() == os.path.normcase(string).lower()
python
def match(self, string): """Returns True if the argument matches the constant.""" if self.casesensitive: return self.pattern == os.path.normcase(string) else: return self.pattern.lower() == os.path.normcase(string).lower()
[ "def", "match", "(", "self", ",", "string", ")", ":", "if", "self", ".", "casesensitive", ":", "return", "self", ".", "pattern", "==", "os", ".", "path", ".", "normcase", "(", "string", ")", "else", ":", "return", "self", ".", "pattern", ".", "lower"...
Returns True if the argument matches the constant.
[ "Returns", "True", "if", "the", "argument", "matches", "the", "constant", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L182-L187
wolfhong/formic
formic/formic.py
Section.match_iter
def match_iter(self, path_elements, start_at): """A generator that searches over *path_elements* (starting from the index *start_at*), yielding for each match. Each value yielded is the index into *path_elements* to the first element *after* each match. In other words, the returned inde...
python
def match_iter(self, path_elements, start_at): """A generator that searches over *path_elements* (starting from the index *start_at*), yielding for each match. Each value yielded is the index into *path_elements* to the first element *after* each match. In other words, the returned inde...
[ "def", "match_iter", "(", "self", ",", "path_elements", ",", "start_at", ")", ":", "if", "self", ".", "length", "==", "1", ":", "return", "self", ".", "_match_iter_single", "(", "path_elements", ",", "start_at", ")", "else", ":", "return", "self", ".", "...
A generator that searches over *path_elements* (starting from the index *start_at*), yielding for each match. Each value yielded is the index into *path_elements* to the first element *after* each match. In other words, the returned index has already consumed the matching path elements ...
[ "A", "generator", "that", "searches", "over", "*", "path_elements", "*", "(", "starting", "from", "the", "index", "*", "start_at", "*", ")", "yielding", "for", "each", "match", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L216-L235
wolfhong/formic
formic/formic.py
Section._match_iter_generic
def _match_iter_generic(self, path_elements, start_at): """Implementation of match_iter for >1 self.elements""" length = len(path_elements) # If bound to start, we stop searching at the first element if self.bound_start: end = 1 else: end = length - self....
python
def _match_iter_generic(self, path_elements, start_at): """Implementation of match_iter for >1 self.elements""" length = len(path_elements) # If bound to start, we stop searching at the first element if self.bound_start: end = 1 else: end = length - self....
[ "def", "_match_iter_generic", "(", "self", ",", "path_elements", ",", "start_at", ")", ":", "length", "=", "len", "(", "path_elements", ")", "# If bound to start, we stop searching at the first element", "if", "self", ".", "bound_start", ":", "end", "=", "1", "else"...
Implementation of match_iter for >1 self.elements
[ "Implementation", "of", "match_iter", "for", ">", "1", "self", ".", "elements" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L237-L272
wolfhong/formic
formic/formic.py
Section._match_iter_single
def _match_iter_single(self, path_elements, start_at): """Implementation of match_iter optimized for self.elements of length 1""" length = len(path_elements) if length == 0: return # If bound to end, we start searching as late as possible if self.bound_end: ...
python
def _match_iter_single(self, path_elements, start_at): """Implementation of match_iter optimized for self.elements of length 1""" length = len(path_elements) if length == 0: return # If bound to end, we start searching as late as possible if self.bound_end: ...
[ "def", "_match_iter_single", "(", "self", ",", "path_elements", ",", "start_at", ")", ":", "length", "=", "len", "(", "path_elements", ")", "if", "length", "==", "0", ":", "return", "# If bound to end, we start searching as late as possible", "if", "self", ".", "b...
Implementation of match_iter optimized for self.elements of length 1
[ "Implementation", "of", "match_iter", "optimized", "for", "self", ".", "elements", "of", "length", "1" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L274-L304
wolfhong/formic
formic/formic.py
Pattern._simplify
def _simplify(elements): """Simplifies and normalizes the list of elements removing redundant/repeated elements and normalising upper/lower case so case sensitivity is resolved here.""" simplified = [] previous = None for element in elements: if element == ".....
python
def _simplify(elements): """Simplifies and normalizes the list of elements removing redundant/repeated elements and normalising upper/lower case so case sensitivity is resolved here.""" simplified = [] previous = None for element in elements: if element == ".....
[ "def", "_simplify", "(", "elements", ")", ":", "simplified", "=", "[", "]", "previous", "=", "None", "for", "element", "in", "elements", ":", "if", "element", "==", "\"..\"", ":", "raise", "FormicError", "(", "\"Invalid glob:\"", "\" Cannot have '..' in a glob: ...
Simplifies and normalizes the list of elements removing redundant/repeated elements and normalising upper/lower case so case sensitivity is resolved here.
[ "Simplifies", "and", "normalizes", "the", "list", "of", "elements", "removing", "redundant", "/", "repeated", "elements", "and", "normalising", "upper", "/", "lower", "case", "so", "case", "sensitivity", "is", "resolved", "here", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L382-L417
wolfhong/formic
formic/formic.py
Pattern.match_directory
def match_directory(self, path_elements): """Returns a :class:`MatchType` for the directory, expressed as a list of path elements, match for the :class:`Pattern`. If ``self.bound_start`` is True, the first :class:`Section` must match from the first directory element. If ``self....
python
def match_directory(self, path_elements): """Returns a :class:`MatchType` for the directory, expressed as a list of path elements, match for the :class:`Pattern`. If ``self.bound_start`` is True, the first :class:`Section` must match from the first directory element. If ``self....
[ "def", "match_directory", "(", "self", ",", "path_elements", ")", ":", "def", "match_recurse", "(", "is_start", ",", "sections", ",", "path_elements", ",", "location", ")", ":", "\"\"\"A private function for implementing the recursive search.\n\n The function takes...
Returns a :class:`MatchType` for the directory, expressed as a list of path elements, match for the :class:`Pattern`. If ``self.bound_start`` is True, the first :class:`Section` must match from the first directory element. If ``self.bound_end`` is True, the last :class:`Section` must m...
[ "Returns", "a", ":", "class", ":", "MatchType", "for", "the", "directory", "expressed", "as", "a", "list", "of", "path", "elements", "match", "for", "the", ":", "class", ":", "Pattern", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L472-L560
wolfhong/formic
formic/formic.py
Pattern.match_files
def match_files(self, matched, unmatched): """Moves all matching files from the set *unmatched* to the set *matched*. Both *matched* and *unmatched* are sets of string, the strings being unqualified file names""" this_match = set(self.file_filter(unmatched)) matched |= t...
python
def match_files(self, matched, unmatched): """Moves all matching files from the set *unmatched* to the set *matched*. Both *matched* and *unmatched* are sets of string, the strings being unqualified file names""" this_match = set(self.file_filter(unmatched)) matched |= t...
[ "def", "match_files", "(", "self", ",", "matched", ",", "unmatched", ")", ":", "this_match", "=", "set", "(", "self", ".", "file_filter", "(", "unmatched", ")", ")", "matched", "|=", "this_match", "unmatched", "-=", "this_match" ]
Moves all matching files from the set *unmatched* to the set *matched*. Both *matched* and *unmatched* are sets of string, the strings being unqualified file names
[ "Moves", "all", "matching", "files", "from", "the", "set", "*", "unmatched", "*", "to", "the", "set", "*", "matched", "*", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L569-L577
wolfhong/formic
formic/formic.py
Pattern._to_string
def _to_string(self): """Implemented a function for __str__ and __repr__ to use, but which prevents infinite recursion when migrating to Python 3""" if self.sections: start = "/" if self.bound_start else "**/" sections = "/**/".join(str(section) for section in self.sectio...
python
def _to_string(self): """Implemented a function for __str__ and __repr__ to use, but which prevents infinite recursion when migrating to Python 3""" if self.sections: start = "/" if self.bound_start else "**/" sections = "/**/".join(str(section) for section in self.sectio...
[ "def", "_to_string", "(", "self", ")", ":", "if", "self", ".", "sections", ":", "start", "=", "\"/\"", "if", "self", ".", "bound_start", "else", "\"**/\"", "sections", "=", "\"/**/\"", ".", "join", "(", "str", "(", "section", ")", "for", "section", "in...
Implemented a function for __str__ and __repr__ to use, but which prevents infinite recursion when migrating to Python 3
[ "Implemented", "a", "function", "for", "__str__", "and", "__repr__", "to", "use", "but", "which", "prevents", "infinite", "recursion", "when", "migrating", "to", "Python", "3" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L579-L590
wolfhong/formic
formic/formic.py
PatternSet._compute_all_files
def _compute_all_files(self): """Handles lazy evaluation of self.all_files""" self._all_files = any(pat.all_files() for pat in self.patterns)
python
def _compute_all_files(self): """Handles lazy evaluation of self.all_files""" self._all_files = any(pat.all_files() for pat in self.patterns)
[ "def", "_compute_all_files", "(", "self", ")", ":", "self", ".", "_all_files", "=", "any", "(", "pat", ".", "all_files", "(", ")", "for", "pat", "in", "self", ".", "patterns", ")" ]
Handles lazy evaluation of self.all_files
[ "Handles", "lazy", "evaluation", "of", "self", ".", "all_files" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L612-L614
wolfhong/formic
formic/formic.py
PatternSet.append
def append(self, pattern): """Adds a :class:`Pattern` to the :class:`PatternSet`""" assert isinstance(pattern, Pattern) self.patterns.append(pattern) if self._all_files is not None: self._all_files = self._all_files or pattern.all_files()
python
def append(self, pattern): """Adds a :class:`Pattern` to the :class:`PatternSet`""" assert isinstance(pattern, Pattern) self.patterns.append(pattern) if self._all_files is not None: self._all_files = self._all_files or pattern.all_files()
[ "def", "append", "(", "self", ",", "pattern", ")", ":", "assert", "isinstance", "(", "pattern", ",", "Pattern", ")", "self", ".", "patterns", ".", "append", "(", "pattern", ")", "if", "self", ".", "_all_files", "is", "not", "None", ":", "self", ".", ...
Adds a :class:`Pattern` to the :class:`PatternSet`
[ "Adds", "a", ":", "class", ":", "Pattern", "to", "the", ":", "class", ":", "PatternSet" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L627-L632
wolfhong/formic
formic/formic.py
PatternSet.extend
def extend(self, patterns): """Extend a :class:`PatternSet` with addition *patterns* *patterns* can either be: * A single :class:`Pattern` * Another :class:`PatternSet` or * A list of :class:`Pattern` instances""" assert patterns is not None if isinstance(patter...
python
def extend(self, patterns): """Extend a :class:`PatternSet` with addition *patterns* *patterns* can either be: * A single :class:`Pattern` * Another :class:`PatternSet` or * A list of :class:`Pattern` instances""" assert patterns is not None if isinstance(patter...
[ "def", "extend", "(", "self", ",", "patterns", ")", ":", "assert", "patterns", "is", "not", "None", "if", "isinstance", "(", "patterns", ",", "Pattern", ")", ":", "self", ".", "append", "(", "patterns", ")", "return", "if", "isinstance", "(", "patterns",...
Extend a :class:`PatternSet` with addition *patterns* *patterns* can either be: * A single :class:`Pattern` * Another :class:`PatternSet` or * A list of :class:`Pattern` instances
[ "Extend", "a", ":", "class", ":", "PatternSet", "with", "addition", "*", "patterns", "*" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L634-L652
wolfhong/formic
formic/formic.py
PatternSet.remove
def remove(self, pattern): """Remove a :class:`Pattern` from the :class:`PatternSet`""" assert isinstance(pattern, Pattern) self.patterns.remove(pattern) self._all_files = None
python
def remove(self, pattern): """Remove a :class:`Pattern` from the :class:`PatternSet`""" assert isinstance(pattern, Pattern) self.patterns.remove(pattern) self._all_files = None
[ "def", "remove", "(", "self", ",", "pattern", ")", ":", "assert", "isinstance", "(", "pattern", ",", "Pattern", ")", "self", ".", "patterns", ".", "remove", "(", "pattern", ")", "self", ".", "_all_files", "=", "None" ]
Remove a :class:`Pattern` from the :class:`PatternSet`
[ "Remove", "a", ":", "class", ":", "Pattern", "from", "the", ":", "class", ":", "PatternSet" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L654-L658
wolfhong/formic
formic/formic.py
PatternSet.match_files
def match_files(self, matched, unmatched): """Apply the include and exclude filters to those files in *unmatched*, moving those that are included, but not excluded, into the *matched* set. Both *matched* and *unmatched* are sets of unqualified file names.""" for pattern in self....
python
def match_files(self, matched, unmatched): """Apply the include and exclude filters to those files in *unmatched*, moving those that are included, but not excluded, into the *matched* set. Both *matched* and *unmatched* are sets of unqualified file names.""" for pattern in self....
[ "def", "match_files", "(", "self", ",", "matched", ",", "unmatched", ")", ":", "for", "pattern", "in", "self", ".", "iter", "(", ")", ":", "pattern", ".", "match_files", "(", "matched", ",", "unmatched", ")", "if", "not", "unmatched", ":", "# Optimizatio...
Apply the include and exclude filters to those files in *unmatched*, moving those that are included, but not excluded, into the *matched* set. Both *matched* and *unmatched* are sets of unqualified file names.
[ "Apply", "the", "include", "and", "exclude", "filters", "to", "those", "files", "in", "*", "unmatched", "*", "moving", "those", "that", "are", "included", "but", "not", "excluded", "into", "the", "*", "matched", "*", "set", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L660-L671
wolfhong/formic
formic/formic.py
PatternSet.iter
def iter(self): """An iteration generator that allows the loop to modify the :class:`PatternSet` during the loop""" if self.patterns: patterns = list(self.patterns) for pattern in patterns: yield pattern
python
def iter(self): """An iteration generator that allows the loop to modify the :class:`PatternSet` during the loop""" if self.patterns: patterns = list(self.patterns) for pattern in patterns: yield pattern
[ "def", "iter", "(", "self", ")", ":", "if", "self", ".", "patterns", ":", "patterns", "=", "list", "(", "self", ".", "patterns", ")", "for", "pattern", "in", "patterns", ":", "yield", "pattern" ]
An iteration generator that allows the loop to modify the :class:`PatternSet` during the loop
[ "An", "iteration", "generator", "that", "allows", "the", "loop", "to", "modify", "the", ":", "class", ":", "PatternSet", "during", "the", "loop" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L677-L683
wolfhong/formic
formic/formic.py
FileSetState._find_parent
def _find_parent(self, path_elements): """Recurse up the tree of FileSetStates until we find a parent, i.e. one whose path_elements member is the start of the path_element argument""" if not self.path_elements: # Automatically terminate on root return self ...
python
def _find_parent(self, path_elements): """Recurse up the tree of FileSetStates until we find a parent, i.e. one whose path_elements member is the start of the path_element argument""" if not self.path_elements: # Automatically terminate on root return self ...
[ "def", "_find_parent", "(", "self", ",", "path_elements", ")", ":", "if", "not", "self", ".", "path_elements", ":", "# Automatically terminate on root", "return", "self", "elif", "self", ".", "path_elements", "==", "path_elements", "[", "0", ":", "len", "(", "...
Recurse up the tree of FileSetStates until we find a parent, i.e. one whose path_elements member is the start of the path_element argument
[ "Recurse", "up", "the", "tree", "of", "FileSetStates", "until", "we", "find", "a", "parent", "i", ".", "e", ".", "one", "whose", "path_elements", "member", "is", "the", "start", "of", "the", "path_element", "argument" ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L801-L811
wolfhong/formic
formic/formic.py
FileSetState._matching_pattern_sets
def _matching_pattern_sets(self): """Returns an iterator containing all PatternSets that match this directory. This is build by chaining the this-directory specific PatternSet (self.matched_and_subdir), the local (non-inheriting) PatternSet (self.matched_no_subdir) with all the ...
python
def _matching_pattern_sets(self): """Returns an iterator containing all PatternSets that match this directory. This is build by chaining the this-directory specific PatternSet (self.matched_and_subdir), the local (non-inheriting) PatternSet (self.matched_no_subdir) with all the ...
[ "def", "_matching_pattern_sets", "(", "self", ")", ":", "gather", "=", "[", "]", "if", "self", ".", "matched_and_subdir", ":", "gather", ".", "append", "(", "self", ".", "matched_and_subdir", ".", "iter", "(", ")", ")", "gather", ".", "append", "(", "sel...
Returns an iterator containing all PatternSets that match this directory. This is build by chaining the this-directory specific PatternSet (self.matched_and_subdir), the local (non-inheriting) PatternSet (self.matched_no_subdir) with all the inherited PatternSets that match this...
[ "Returns", "an", "iterator", "containing", "all", "PatternSets", "that", "match", "this", "directory", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L813-L833
wolfhong/formic
formic/formic.py
FileSetState.match
def match(self, files): """Given a set of files in this directory, returns all the files that match the :class:`Pattern` instances which match this directory.""" if not files: return set() if (self.matched_inherit.all_files() or self.matched_and_subdir.all_fi...
python
def match(self, files): """Given a set of files in this directory, returns all the files that match the :class:`Pattern` instances which match this directory.""" if not files: return set() if (self.matched_inherit.all_files() or self.matched_and_subdir.all_fi...
[ "def", "match", "(", "self", ",", "files", ")", ":", "if", "not", "files", ":", "return", "set", "(", ")", "if", "(", "self", ".", "matched_inherit", ".", "all_files", "(", ")", "or", "self", ".", "matched_and_subdir", ".", "all_files", "(", ")", "or...
Given a set of files in this directory, returns all the files that match the :class:`Pattern` instances which match this directory.
[ "Given", "a", "set", "of", "files", "in", "this", "directory", "returns", "all", "the", "files", "that", "match", "the", ":", "class", ":", "Pattern", "instances", "which", "match", "this", "directory", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L835-L857
wolfhong/formic
formic/formic.py
FileSetState.no_possible_matches_in_subdirs
def no_possible_matches_in_subdirs(self): """Returns True if there are no possible matches for any subdirectories of this :class:`FileSetState`. When this :class:FileSetState is used for an 'include', a return of `True` means we can exclude all subdirectories.""" return (not sel...
python
def no_possible_matches_in_subdirs(self): """Returns True if there are no possible matches for any subdirectories of this :class:`FileSetState`. When this :class:FileSetState is used for an 'include', a return of `True` means we can exclude all subdirectories.""" return (not sel...
[ "def", "no_possible_matches_in_subdirs", "(", "self", ")", ":", "return", "(", "not", "self", ".", "parent_has_patterns", "and", "self", ".", "matched_inherit", ".", "empty", "(", ")", "and", "self", ".", "matched_and_subdir", ".", "empty", "(", ")", "and", ...
Returns True if there are no possible matches for any subdirectories of this :class:`FileSetState`. When this :class:FileSetState is used for an 'include', a return of `True` means we can exclude all subdirectories.
[ "Returns", "True", "if", "there", "are", "no", "possible", "matches", "for", "any", "subdirectories", "of", "this", ":", "class", ":", "FileSetState", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L870-L877
wolfhong/formic
formic/formic.py
FileSet._preprocess
def _preprocess(argument, casesensitive): """Receives the argument (from the constructor), and normalizes it into a list of Pattern objects.""" pattern_set = PatternSet() if argument is not None: if isinstance(argument, STRING_TYPES): argument = [argument, ] ...
python
def _preprocess(argument, casesensitive): """Receives the argument (from the constructor), and normalizes it into a list of Pattern objects.""" pattern_set = PatternSet() if argument is not None: if isinstance(argument, STRING_TYPES): argument = [argument, ] ...
[ "def", "_preprocess", "(", "argument", ",", "casesensitive", ")", ":", "pattern_set", "=", "PatternSet", "(", ")", "if", "argument", "is", "not", "None", ":", "if", "isinstance", "(", "argument", ",", "STRING_TYPES", ")", ":", "argument", "=", "[", "argume...
Receives the argument (from the constructor), and normalizes it into a list of Pattern objects.
[ "Receives", "the", "argument", "(", "from", "the", "constructor", ")", "and", "normalizes", "it", "into", "a", "list", "of", "Pattern", "objects", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L1031-L1047
wolfhong/formic
formic/formic.py
FileSet.get_directory
def get_directory(self): """Returns the directory in which the :class:`FileSet` will be run. If the directory was set with None in the constructor, get_directory() will return the current working directory. The returned result is normalized so it never contains a trailing path ...
python
def get_directory(self): """Returns the directory in which the :class:`FileSet` will be run. If the directory was set with None in the constructor, get_directory() will return the current working directory. The returned result is normalized so it never contains a trailing path ...
[ "def", "get_directory", "(", "self", ")", ":", "directory", "=", "self", ".", "directory", "if", "self", ".", "directory", "else", "os", ".", "getcwd", "(", ")", "drive", ",", "folders", "=", "get_path_components", "(", "directory", ")", "return", "reconst...
Returns the directory in which the :class:`FileSet` will be run. If the directory was set with None in the constructor, get_directory() will return the current working directory. The returned result is normalized so it never contains a trailing path separator
[ "Returns", "the", "directory", "in", "which", "the", ":", "class", ":", "FileSet", "will", "be", "run", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L1049-L1059
wolfhong/formic
formic/formic.py
FileSet._receive
def _receive(self, root, directory, dirs, files, include, exclude): """Internal function processing each yield from os.walk.""" self._received += 1 if not self.symlinks: where = root + os.path.sep + directory + os.path.sep files = [ file_name for file_na...
python
def _receive(self, root, directory, dirs, files, include, exclude): """Internal function processing each yield from os.walk.""" self._received += 1 if not self.symlinks: where = root + os.path.sep + directory + os.path.sep files = [ file_name for file_na...
[ "def", "_receive", "(", "self", ",", "root", ",", "directory", ",", "dirs", ",", "files", ",", "include", ",", "exclude", ")", ":", "self", ".", "_received", "+=", "1", "if", "not", "self", ".", "symlinks", ":", "where", "=", "root", "+", "os", "."...
Internal function processing each yield from os.walk.
[ "Internal", "function", "processing", "each", "yield", "from", "os", ".", "walk", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L1061-L1089
wolfhong/formic
formic/formic.py
FileSet.files
def files(self): """A generator function for iterating over the individual files of the FileSet. The generator yields a tuple of ``(rel_dir_name, file_name)``: 1. *rel_dir_name*: The path relative to the starting directory 2. *file_name*: The unqualified file name """ ...
python
def files(self): """A generator function for iterating over the individual files of the FileSet. The generator yields a tuple of ``(rel_dir_name, file_name)``: 1. *rel_dir_name*: The path relative to the starting directory 2. *file_name*: The unqualified file name """ ...
[ "def", "files", "(", "self", ")", ":", "directory", "=", "self", ".", "get_directory", "(", ")", "prefix", "=", "len", "(", "directory", ")", "+", "(", "0", "if", "is_root", "(", "directory", ")", "else", "1", ")", "include", "=", "None", "exclude", ...
A generator function for iterating over the individual files of the FileSet. The generator yields a tuple of ``(rel_dir_name, file_name)``: 1. *rel_dir_name*: The path relative to the starting directory 2. *file_name*: The unqualified file name
[ "A", "generator", "function", "for", "iterating", "over", "the", "individual", "files", "of", "the", "FileSet", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L1091-L1111
wolfhong/formic
formic/formic.py
FileSet.qualified_files
def qualified_files(self, absolute=True): """An alternative generator that yields files rather than directory/file tuples. If *absolute* is false, paths relative to the starting directory are returned, otherwise files are fully qualified.""" prefix = self.get_directory() if abso...
python
def qualified_files(self, absolute=True): """An alternative generator that yields files rather than directory/file tuples. If *absolute* is false, paths relative to the starting directory are returned, otherwise files are fully qualified.""" prefix = self.get_directory() if abso...
[ "def", "qualified_files", "(", "self", ",", "absolute", "=", "True", ")", ":", "prefix", "=", "self", ".", "get_directory", "(", ")", "if", "absolute", "else", "\".\"", "for", "rel_dir_name", ",", "file_name", "in", "self", ".", "files", "(", ")", ":", ...
An alternative generator that yields files rather than directory/file tuples. If *absolute* is false, paths relative to the starting directory are returned, otherwise files are fully qualified.
[ "An", "alternative", "generator", "that", "yields", "files", "rather", "than", "directory", "/", "file", "tuples", "." ]
train
https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/formic/formic.py#L1113-L1121
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
main
def main(argString=None): """The main function of this module. :param argString: the options. :type argString: list of strings """ # Getting and checking the options args = parseArgs(argString) checkArgs(args) logger.info("Options used:") for key, value in vars(args).iteritems():...
python
def main(argString=None): """The main function of this module. :param argString: the options. :type argString: list of strings """ # Getting and checking the options args = parseArgs(argString) checkArgs(args) logger.info("Options used:") for key, value in vars(args).iteritems():...
[ "def", "main", "(", "argString", "=", "None", ")", ":", "# Getting and checking the options", "args", "=", "parseArgs", "(", "argString", ")", "checkArgs", "(", "args", ")", "logger", ".", "info", "(", "\"Options used:\"", ")", "for", "key", ",", "value", "i...
The main function of this module. :param argString: the options. :type argString: list of strings
[ "The", "main", "function", "of", "this", "module", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L34-L75
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
order_qc_dir
def order_qc_dir(dirnames): """Order the QC directory names according to their date. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: the sorted list of directories :rtype: list """ return sorted( dirnames, key=lambda dn: time.strptime( ...
python
def order_qc_dir(dirnames): """Order the QC directory names according to their date. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: the sorted list of directories :rtype: list """ return sorted( dirnames, key=lambda dn: time.strptime( ...
[ "def", "order_qc_dir", "(", "dirnames", ")", ":", "return", "sorted", "(", "dirnames", ",", "key", "=", "lambda", "dn", ":", "time", ".", "strptime", "(", "os", ".", "path", ".", "basename", "(", "dn", ".", "rstrip", "(", "\"/\"", ")", ")", "[", "1...
Order the QC directory names according to their date. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: the sorted list of directories :rtype: list
[ "Order", "the", "QC", "directory", "names", "according", "to", "their", "date", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L78-L94
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
merge_required_files
def merge_required_files(dirnames, out_dir): """Merges the required files from each of the directories. :param dirnames: the list of directories to merge data from. :param out_dir: the name of the output directory. :type dirnames: list :type out_dir: str """ # The list of files to merge ...
python
def merge_required_files(dirnames, out_dir): """Merges the required files from each of the directories. :param dirnames: the list of directories to merge data from. :param out_dir: the name of the output directory. :type dirnames: list :type out_dir: str """ # The list of files to merge ...
[ "def", "merge_required_files", "(", "dirnames", ",", "out_dir", ")", ":", "# The list of files to merge", "fn_to_merge", "=", "(", "\"steps_summary.tex\"", ",", "\"excluded_markers.txt\"", ",", "\"excluded_samples.txt\"", ")", "# Merging the files", "for", "fn", "in", "fn...
Merges the required files from each of the directories. :param dirnames: the list of directories to merge data from. :param out_dir: the name of the output directory. :type dirnames: list :type out_dir: str
[ "Merges", "the", "required", "files", "from", "each", "of", "the", "directories", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L97-L144
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
get_final_numbers
def get_final_numbers(filename, out_dir): """Copy the final_files file and get the number of markers and samples. :param filename: the name of the file. :param out_dir: the output directory. :type filename: str :type out_dir: str :returns: the final number of markers and samples :rtype: t...
python
def get_final_numbers(filename, out_dir): """Copy the final_files file and get the number of markers and samples. :param filename: the name of the file. :param out_dir: the output directory. :type filename: str :type out_dir: str :returns: the final number of markers and samples :rtype: t...
[ "def", "get_final_numbers", "(", "filename", ",", "out_dir", ")", ":", "# Copying the file", "shutil", ".", "copy", "(", "filename", ",", "out_dir", ")", "# Reading the number of markers and samples", "nb_samples", "=", "None", "nb_markers", "=", "None", "with", "op...
Copy the final_files file and get the number of markers and samples. :param filename: the name of the file. :param out_dir: the output directory. :type filename: str :type out_dir: str :returns: the final number of markers and samples :rtype: tuple
[ "Copy", "the", "final_files", "file", "and", "get", "the", "number", "of", "markers", "and", "samples", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L160-L193
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
get_summary_files
def get_summary_files(dirnames): """Gets the TeX summary files for each test. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: a list of summary file names. :rtype: list """ # A useful regular expression to get step number in the current directo...
python
def get_summary_files(dirnames): """Gets the TeX summary files for each test. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: a list of summary file names. :rtype: list """ # A useful regular expression to get step number in the current directo...
[ "def", "get_summary_files", "(", "dirnames", ")", ":", "# A useful regular expression to get step number in the current directory", "step_nb_re", "=", "re", ".", "compile", "(", "r\"^([0-9]+)_\\S+\"", ")", "# The final list of summary files", "final_summary_files", "=", "[", "]...
Gets the TeX summary files for each test. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: a list of summary file names. :rtype: list
[ "Gets", "the", "TeX", "summary", "files", "for", "each", "test", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L196-L243
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
generate_report
def generate_report(out_dir, latex_summaries, nb_markers, nb_samples, options): """Generates the report. :param out_dir: the output directory. :param latex_summaries: the list of LaTeX summaries. :param nb_markers: the final number of markers. :param nb_samples: the final number of samples. :pa...
python
def generate_report(out_dir, latex_summaries, nb_markers, nb_samples, options): """Generates the report. :param out_dir: the output directory. :param latex_summaries: the list of LaTeX summaries. :param nb_markers: the final number of markers. :param nb_samples: the final number of samples. :pa...
[ "def", "generate_report", "(", "out_dir", ",", "latex_summaries", ",", "nb_markers", ",", "nb_samples", ",", "options", ")", ":", "# Getting the graphic paths file", "graphic_paths_fn", "=", "None", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path",...
Generates the report. :param out_dir: the output directory. :param latex_summaries: the list of LaTeX summaries. :param nb_markers: the final number of markers. :param nb_samples: the final number of samples. :param options: the list of options. :type out_dir: str :type latex_summaries: li...
[ "Generates", "the", "report", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L246-L285
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
checkArgs
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
python
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
[ "def", "checkArgs", "(", "args", ")", ":", "# For all input directories", "for", "dn", "in", "args", ".", "qc_dir", ":", "# Checking that all the directories exists", "if", "not", "os", ".", "path", ".", "isdir", "(", "dn", ")", ":", "raise", "ProgramError", "...
Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t...
[ "Checks", "the", "arguments", "and", "options", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L288-L321
lemieuxl/pyGenClean
pyGenClean/LaTeX/merge_reports.py
add_custom_options
def add_custom_options(parser): """Adds custom options to a parser. :param parser: the parser to which to add options. :type parser: argparse.ArgumentParser """ parser.add_argument("--report-title", type=str, metavar="TITLE", default="Genetic Data Clean Up", ...
python
def add_custom_options(parser): """Adds custom options to a parser. :param parser: the parser to which to add options. :type parser: argparse.ArgumentParser """ parser.add_argument("--report-title", type=str, metavar="TITLE", default="Genetic Data Clean Up", ...
[ "def", "add_custom_options", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "\"--report-title\"", ",", "type", "=", "str", ",", "metavar", "=", "\"TITLE\"", ",", "default", "=", "\"Genetic Data Clean Up\"", ",", "help", "=", "\"The report title. [def...
Adds custom options to a parser. :param parser: the parser to which to add options. :type parser: argparse.ArgumentParser
[ "Adds", "custom", "options", "to", "a", "parser", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/merge_reports.py#L358-L381
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
main
def main(argString=None): """The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAccordingToLD`). 3. Checks if ther...
python
def main(argString=None): """The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAccordingToLD`). 3. Checks if ther...
[ "def", "main", "(", "argString", "=", "None", ")", ":", "# Getting and checking the options", "args", "=", "parseArgs", "(", "argString", ")", "checkArgs", "(", "args", ")", "logger", ".", "info", "(", "\"Options used:\"", ")", "for", "key", ",", "value", "i...
The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAccordingToLD`). 3. Checks if there is enough markers after pruning...
[ "The", "main", "function", "of", "this", "module", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L37-L109
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
plot_related_data
def plot_related_data(x, y, code, ylabel, fileName, options): """Plot Z1 and Z2 in function of IBS2* ratio. :param x: the x axis of the plot (``IBS2 ratio``). :param y: the y axis of the plot (either ``z1`` or ``z2``). :param code: the code of the relatedness of each sample pair. :param ylabel: the...
python
def plot_related_data(x, y, code, ylabel, fileName, options): """Plot Z1 and Z2 in function of IBS2* ratio. :param x: the x axis of the plot (``IBS2 ratio``). :param y: the y axis of the plot (either ``z1`` or ``z2``). :param code: the code of the relatedness of each sample pair. :param ylabel: the...
[ "def", "plot_related_data", "(", "x", ",", "y", ",", "code", ",", "ylabel", ",", "fileName", ",", "options", ")", ":", "import", "matplotlib", "as", "mpl", "if", "mpl", ".", "get_backend", "(", ")", "!=", "\"agg\"", ":", "mpl", ".", "use", "(", "\"Ag...
Plot Z1 and Z2 in function of IBS2* ratio. :param x: the x axis of the plot (``IBS2 ratio``). :param y: the y axis of the plot (either ``z1`` or ``z2``). :param code: the code of the relatedness of each sample pair. :param ylabel: the label of the y axis (either ``z1`` or ``z2``). :param fileName: ...
[ "Plot", "Z1", "and", "Z2", "in", "function", "of", "IBS2", "*", "ratio", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L112-L195
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
extractRelatedIndividuals
def extractRelatedIndividuals(fileName, outPrefix, ibs2_ratio_threshold): """Extract related individuals according IBS2* ratio. :param fileName: the name of the input file. :param outPrefix: the prefix of the output files. :param ibs2_ratio_threshold: the ibs2 ratio threshold (tells if sample pair ...
python
def extractRelatedIndividuals(fileName, outPrefix, ibs2_ratio_threshold): """Extract related individuals according IBS2* ratio. :param fileName: the name of the input file. :param outPrefix: the prefix of the output files. :param ibs2_ratio_threshold: the ibs2 ratio threshold (tells if sample pair ...
[ "def", "extractRelatedIndividuals", "(", "fileName", ",", "outPrefix", ",", "ibs2_ratio_threshold", ")", ":", "# The output file", "outputFile", "=", "None", "try", ":", "outputFile", "=", "open", "(", "outPrefix", "+", "\".related_individuals\"", ",", "\"w\"", ")",...
Extract related individuals according IBS2* ratio. :param fileName: the name of the input file. :param outPrefix: the prefix of the output files. :param ibs2_ratio_threshold: the ibs2 ratio threshold (tells if sample pair is related or not). :type fileName: str :ty...
[ "Extract", "related", "individuals", "according", "IBS2", "*", "ratio", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L198-L375
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
checkNumberOfSNP
def checkNumberOfSNP(fileName, minimumNumber): """Check there is enough SNPs in the file (with minimum). :param fileName: the name of the file. :param minimumNumber: the minimum number of markers that needs to be in the file. :type fileName: str :type minimumNumber: int ...
python
def checkNumberOfSNP(fileName, minimumNumber): """Check there is enough SNPs in the file (with minimum). :param fileName: the name of the file. :param minimumNumber: the minimum number of markers that needs to be in the file. :type fileName: str :type minimumNumber: int ...
[ "def", "checkNumberOfSNP", "(", "fileName", ",", "minimumNumber", ")", ":", "nbSNP", "=", "0", "try", ":", "with", "open", "(", "fileName", ",", "'r'", ")", "as", "inputFile", ":", "for", "line", "in", "inputFile", ":", "nbSNP", "+=", "1", "except", "I...
Check there is enough SNPs in the file (with minimum). :param fileName: the name of the file. :param minimumNumber: the minimum number of markers that needs to be in the file. :type fileName: str :type minimumNumber: int :returns: ``True`` if there is enough markers in t...
[ "Check", "there", "is", "enough", "SNPs", "in", "the", "file", "(", "with", "minimum", ")", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L378-L405
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
splitFile
def splitFile(inputFileName, linePerFile, outPrefix): """Split a file. :param inputFileName: the name of the input file. :param linePerFile: the number of line per file (after splitting). :param outPrefix: the prefix of the output files. :type inputFileName: str :type linePerFile: int :typ...
python
def splitFile(inputFileName, linePerFile, outPrefix): """Split a file. :param inputFileName: the name of the input file. :param linePerFile: the number of line per file (after splitting). :param outPrefix: the prefix of the output files. :type inputFileName: str :type linePerFile: int :typ...
[ "def", "splitFile", "(", "inputFileName", ",", "linePerFile", ",", "outPrefix", ")", ":", "nbTmpFile", "=", "1", "nbLine", "=", "0", "tmpFile", "=", "None", "try", ":", "with", "open", "(", "inputFileName", ",", "\"r\"", ")", "as", "inputFile", ":", "for...
Split a file. :param inputFileName: the name of the input file. :param linePerFile: the number of line per file (after splitting). :param outPrefix: the prefix of the output files. :type inputFileName: str :type linePerFile: int :type outPrefix: str :returns: the number of created tempora...
[ "Split", "a", "file", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L408-L472
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
runGenome
def runGenome(bfile, options): """Runs the genome command from plink. :param bfile: the input file prefix. :param options: the options. :type bfile: str :type options: argparse.Namespace :returns: the name of the ``genome`` file. Runs Plink with the ``genome`` option. If the user asks fo...
python
def runGenome(bfile, options): """Runs the genome command from plink. :param bfile: the input file prefix. :param options: the options. :type bfile: str :type options: argparse.Namespace :returns: the name of the ``genome`` file. Runs Plink with the ``genome`` option. If the user asks fo...
[ "def", "runGenome", "(", "bfile", ",", "options", ")", ":", "outPrefix", "=", "options", ".", "out", "+", "\".genome\"", "if", "options", ".", "sge", ":", "# We run genome using SGE", "# We need to create a frequency file using plink", "plinkCommand", "=", "[", "\"p...
Runs the genome command from plink. :param bfile: the input file prefix. :param options: the options. :type bfile: str :type options: argparse.Namespace :returns: the name of the ``genome`` file. Runs Plink with the ``genome`` option. If the user asks for SGE (``options.sge`` is True), a...
[ "Runs", "the", "genome", "command", "from", "plink", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L475-L517
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
mergeGenomeLogFiles
def mergeGenomeLogFiles(outPrefix, nbSet): """Merge genome and log files together. :param outPrefix: the prefix of the output files. :param nbSet: The number of set of files to merge together. :type outPrefix: str :type nbSet: int :returns: the name of the output file (the ``genome`` file). ...
python
def mergeGenomeLogFiles(outPrefix, nbSet): """Merge genome and log files together. :param outPrefix: the prefix of the output files. :param nbSet: The number of set of files to merge together. :type outPrefix: str :type nbSet: int :returns: the name of the output file (the ``genome`` file). ...
[ "def", "mergeGenomeLogFiles", "(", "outPrefix", ",", "nbSet", ")", ":", "outputFile", "=", "None", "try", ":", "outputFile", "=", "open", "(", "outPrefix", "+", "\".genome\"", ",", "\"w\"", ")", "outputLog", "=", "open", "(", "outPrefix", "+", "\".log\"", ...
Merge genome and log files together. :param outPrefix: the prefix of the output files. :param nbSet: The number of set of files to merge together. :type outPrefix: str :type nbSet: int :returns: the name of the output file (the ``genome`` file). After merging, the files are deleted to save s...
[ "Merge", "genome", "and", "log", "files", "together", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L520-L609
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
runGenomeSGE
def runGenomeSGE(bfile, freqFile, nbJob, outPrefix, options): """Runs the genome command from plink, on SGE. :param bfile: the prefix of the input file. :param freqFile: the name of the frequency file (from Plink). :param nbJob: the number of jobs to launch. :param outPrefix: the prefix of all the ...
python
def runGenomeSGE(bfile, freqFile, nbJob, outPrefix, options): """Runs the genome command from plink, on SGE. :param bfile: the prefix of the input file. :param freqFile: the name of the frequency file (from Plink). :param nbJob: the number of jobs to launch. :param outPrefix: the prefix of all the ...
[ "def", "runGenomeSGE", "(", "bfile", ",", "freqFile", ",", "nbJob", ",", "outPrefix", ",", "options", ")", ":", "# Add the environment variable for DRMAA package", "if", "\"DRMAA_LIBRARY_PATH\"", "not", "in", "os", ".", "environ", ":", "msg", "=", "\"could not load ...
Runs the genome command from plink, on SGE. :param bfile: the prefix of the input file. :param freqFile: the name of the frequency file (from Plink). :param nbJob: the number of jobs to launch. :param outPrefix: the prefix of all the output files. :param options: the options. :type bfile: str ...
[ "Runs", "the", "genome", "command", "from", "plink", "on", "SGE", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L612-L694
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
extractSNPs
def extractSNPs(snpsToExtract, options): """Extract markers using Plink. :param snpsToExtract: the name of the file containing markers to extract. :param options: the options :type snpsToExtract: str :type options: argparse.Namespace :returns: the prefix of the output files. """ outP...
python
def extractSNPs(snpsToExtract, options): """Extract markers using Plink. :param snpsToExtract: the name of the file containing markers to extract. :param options: the options :type snpsToExtract: str :type options: argparse.Namespace :returns: the prefix of the output files. """ outP...
[ "def", "extractSNPs", "(", "snpsToExtract", ",", "options", ")", ":", "outPrefix", "=", "options", ".", "out", "+", "\".pruned_data\"", "plinkCommand", "=", "[", "\"plink\"", ",", "\"--noweb\"", ",", "\"--bfile\"", ",", "options", ".", "bfile", ",", "\"--extra...
Extract markers using Plink. :param snpsToExtract: the name of the file containing markers to extract. :param options: the options :type snpsToExtract: str :type options: argparse.Namespace :returns: the prefix of the output files.
[ "Extract", "markers", "using", "Plink", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L697-L713
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
selectSNPsAccordingToLD
def selectSNPsAccordingToLD(options): """Compute LD using Plink. :param options: the options. :type options: argparse.Namespace :returns: the name of the output file (from Plink). """ # The plink command outPrefix = options.out + ".pruning_" + options.indep_pairwise[2] plinkCommand =...
python
def selectSNPsAccordingToLD(options): """Compute LD using Plink. :param options: the options. :type options: argparse.Namespace :returns: the name of the output file (from Plink). """ # The plink command outPrefix = options.out + ".pruning_" + options.indep_pairwise[2] plinkCommand =...
[ "def", "selectSNPsAccordingToLD", "(", "options", ")", ":", "# The plink command", "outPrefix", "=", "options", ".", "out", "+", "\".pruning_\"", "+", "options", ".", "indep_pairwise", "[", "2", "]", "plinkCommand", "=", "[", "\"plink\"", ",", "\"--noweb\"", ","...
Compute LD using Plink. :param options: the options. :type options: argparse.Namespace :returns: the name of the output file (from Plink).
[ "Compute", "LD", "using", "Plink", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L716-L757
lemieuxl/pyGenClean
pyGenClean/RelatedSamples/find_related_samples.py
checkArgs
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
python
def checkArgs(args): """Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` clas...
[ "def", "checkArgs", "(", "args", ")", ":", "# Check if we have the tped and the tfam files", "for", "fileName", "in", "[", "args", ".", "bfile", "+", "i", "for", "i", "in", "[", "\".bed\"", ",", "\".bim\"", ",", "\".fam\"", "]", "]", ":", "if", "not", "os"...
Checks the arguments and options. :param args: an object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:`ProgramError` class, a message is printed to t...
[ "Checks", "the", "arguments", "and", "options", "." ]
train
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/RelatedSamples/find_related_samples.py#L783-L835
OTL/jps
jps/subscriber.py
Subscriber.spin_once
def spin_once(self, polling_sec=0.010): '''Read the queued data and call the callback for them. You have to handle KeyboardInterrupt (\C-c) manually. Example: >>> def callback(msg): ... print msg >>> sub = jps.Subscriber('topic_name', callback) >>> try: ...
python
def spin_once(self, polling_sec=0.010): '''Read the queued data and call the callback for them. You have to handle KeyboardInterrupt (\C-c) manually. Example: >>> def callback(msg): ... print msg >>> sub = jps.Subscriber('topic_name', callback) >>> try: ...
[ "def", "spin_once", "(", "self", ",", "polling_sec", "=", "0.010", ")", ":", "# parse all data", "while", "True", ":", "socks", "=", "dict", "(", "self", ".", "_poller", ".", "poll", "(", "polling_sec", "*", "1000", ")", ")", "if", "socks", ".", "get",...
Read the queued data and call the callback for them. You have to handle KeyboardInterrupt (\C-c) manually. Example: >>> def callback(msg): ... print msg >>> sub = jps.Subscriber('topic_name', callback) >>> try: ... while True: ... sub.spin_once()...
[ "Read", "the", "queued", "data", "and", "call", "the", "callback", "for", "them", ".", "You", "have", "to", "handle", "KeyboardInterrupt", "(", "\\", "C", "-", "c", ")", "manually", "." ]
train
https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/subscriber.py#L102-L126
OTL/jps
jps/subscriber.py
Subscriber.next
def next(self): '''receive next data (block until next data)''' try: raw_msg = self._socket.recv() except KeyboardInterrupt: raise StopIteration() msg, topic_name = self._strip_topic_name_if_not_wildcard(raw_msg) if msg is None: return self.nex...
python
def next(self): '''receive next data (block until next data)''' try: raw_msg = self._socket.recv() except KeyboardInterrupt: raise StopIteration() msg, topic_name = self._strip_topic_name_if_not_wildcard(raw_msg) if msg is None: return self.nex...
[ "def", "next", "(", "self", ")", ":", "try", ":", "raw_msg", "=", "self", ".", "_socket", ".", "recv", "(", ")", "except", "KeyboardInterrupt", ":", "raise", "StopIteration", "(", ")", "msg", ",", "topic_name", "=", "self", ".", "_strip_topic_name_if_not_w...
receive next data (block until next data)
[ "receive", "next", "data", "(", "block", "until", "next", "data", ")" ]
train
https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/subscriber.py#L152-L164
vinitkumar/pycrawler
linkfetcher.py
Linkfetcher.open
def open(self): """Open the URL with urllib.request.""" url = self.url try: request = urllib.request.Request(url) handle = urllib.request.build_opener() except IOError: return None return (request, handle)
python
def open(self): """Open the URL with urllib.request.""" url = self.url try: request = urllib.request.Request(url) handle = urllib.request.build_opener() except IOError: return None return (request, handle)
[ "def", "open", "(", "self", ")", ":", "url", "=", "self", ".", "url", "try", ":", "request", "=", "urllib", ".", "request", ".", "Request", "(", "url", ")", "handle", "=", "urllib", ".", "request", ".", "build_opener", "(", ")", "except", "IOError", ...
Open the URL with urllib.request.
[ "Open", "the", "URL", "with", "urllib", ".", "request", "." ]
train
https://github.com/vinitkumar/pycrawler/blob/d3fe6d2da1469fc701c4fe04df88cee9cc8cd9c3/linkfetcher.py#L38-L46
vinitkumar/pycrawler
linkfetcher.py
Linkfetcher._get_crawled_urls
def _get_crawled_urls(self, handle, request): """ Main method where the crawler html content is parsed with beautiful soup and out of the DOM, we get the urls """ try: content = six.text_type(handle.open(request).read(), "utf-8", er...
python
def _get_crawled_urls(self, handle, request): """ Main method where the crawler html content is parsed with beautiful soup and out of the DOM, we get the urls """ try: content = six.text_type(handle.open(request).read(), "utf-8", er...
[ "def", "_get_crawled_urls", "(", "self", ",", "handle", ",", "request", ")", ":", "try", ":", "content", "=", "six", ".", "text_type", "(", "handle", ".", "open", "(", "request", ")", ".", "read", "(", ")", ",", "\"utf-8\"", ",", "errors", "=", "\"re...
Main method where the crawler html content is parsed with beautiful soup and out of the DOM, we get the urls
[ "Main", "method", "where", "the", "crawler", "html", "content", "is", "parsed", "with", "beautiful", "soup", "and", "out", "of", "the", "DOM", "we", "get", "the", "urls" ]
train
https://github.com/vinitkumar/pycrawler/blob/d3fe6d2da1469fc701c4fe04df88cee9cc8cd9c3/linkfetcher.py#L48-L73
vinitkumar/pycrawler
linkfetcher.py
Linkfetcher.linkfetch
def linkfetch(self): """" Public method to call the internal methods """ request, handle = self.open() self._add_headers(request) if handle: self._get_crawled_urls(handle, request)
python
def linkfetch(self): """" Public method to call the internal methods """ request, handle = self.open() self._add_headers(request) if handle: self._get_crawled_urls(handle, request)
[ "def", "linkfetch", "(", "self", ")", ":", "request", ",", "handle", "=", "self", ".", "open", "(", ")", "self", ".", "_add_headers", "(", "request", ")", "if", "handle", ":", "self", ".", "_get_crawled_urls", "(", "handle", ",", "request", ")" ]
Public method to call the internal methods
[ "Public", "method", "to", "call", "the", "internal", "methods" ]
train
https://github.com/vinitkumar/pycrawler/blob/d3fe6d2da1469fc701c4fe04df88cee9cc8cd9c3/linkfetcher.py#L76-L83
photo/openphoto-python
trovebox/objects/album.py
Album._update_fields_with_objects
def _update_fields_with_objects(self): """ Convert dict fields into objects, where appropriate """ # Update the cover with a photo object if isinstance(self.cover, dict): self.cover = Photo(self._client, self.cover) # Update the photo list with photo objects try: ...
python
def _update_fields_with_objects(self): """ Convert dict fields into objects, where appropriate """ # Update the cover with a photo object if isinstance(self.cover, dict): self.cover = Photo(self._client, self.cover) # Update the photo list with photo objects try: ...
[ "def", "_update_fields_with_objects", "(", "self", ")", ":", "# Update the cover with a photo object", "if", "isinstance", "(", "self", ".", "cover", ",", "dict", ")", ":", "self", ".", "cover", "=", "Photo", "(", "self", ".", "_client", ",", "self", ".", "c...
Convert dict fields into objects, where appropriate
[ "Convert", "dict", "fields", "into", "objects", "where", "appropriate" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/album.py#L17-L29
photo/openphoto-python
trovebox/objects/album.py
Album.cover_update
def cover_update(self, photo, **kwds): """ Endpoint: /album/<album_id>/cover/<photo_id>/update.json Update the cover photo of this album. """ result = self._client.album.cover_update(self, photo, **kwds) self._replace_fields(result.get_fields()) self._update_fiel...
python
def cover_update(self, photo, **kwds): """ Endpoint: /album/<album_id>/cover/<photo_id>/update.json Update the cover photo of this album. """ result = self._client.album.cover_update(self, photo, **kwds) self._replace_fields(result.get_fields()) self._update_fiel...
[ "def", "cover_update", "(", "self", ",", "photo", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "album", ".", "cover_update", "(", "self", ",", "photo", ",", "*", "*", "kwds", ")", "self", ".", "_replace_fields", "(", ...
Endpoint: /album/<album_id>/cover/<photo_id>/update.json Update the cover photo of this album.
[ "Endpoint", ":", "/", "album", "/", "<album_id", ">", "/", "cover", "/", "<photo_id", ">", "/", "update", ".", "json" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/album.py#L31-L39
photo/openphoto-python
trovebox/objects/album.py
Album.delete
def delete(self, **kwds): """ Endpoint: /album/<id>/delete.json Deletes this album. Returns True if successful. Raises a TroveboxError if not. """ result = self._client.album.delete(self, **kwds) self._delete_fields() return result
python
def delete(self, **kwds): """ Endpoint: /album/<id>/delete.json Deletes this album. Returns True if successful. Raises a TroveboxError if not. """ result = self._client.album.delete(self, **kwds) self._delete_fields() return result
[ "def", "delete", "(", "self", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "album", ".", "delete", "(", "self", ",", "*", "*", "kwds", ")", "self", ".", "_delete_fields", "(", ")", "return", "result" ]
Endpoint: /album/<id>/delete.json Deletes this album. Returns True if successful. Raises a TroveboxError if not.
[ "Endpoint", ":", "/", "album", "/", "<id", ">", "/", "delete", ".", "json" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/album.py#L41-L51
photo/openphoto-python
trovebox/objects/album.py
Album.add
def add(self, objects, object_type=None, **kwds): """ Endpoint: /album/<id>/<type>/add.json Add objects (eg. Photos) to this album. The objects are a list of either IDs or Trovebox objects. If Trovebox objects are used, the object type is inferred automatically. ...
python
def add(self, objects, object_type=None, **kwds): """ Endpoint: /album/<id>/<type>/add.json Add objects (eg. Photos) to this album. The objects are a list of either IDs or Trovebox objects. If Trovebox objects are used, the object type is inferred automatically. ...
[ "def", "add", "(", "self", ",", "objects", ",", "object_type", "=", "None", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "album", ".", "add", "(", "self", ",", "objects", ",", "object_type", ",", "*", "*", "kwds", ...
Endpoint: /album/<id>/<type>/add.json Add objects (eg. Photos) to this album. The objects are a list of either IDs or Trovebox objects. If Trovebox objects are used, the object type is inferred automatically. Updates the album's fields with the response.
[ "Endpoint", ":", "/", "album", "/", "<id", ">", "/", "<type", ">", "/", "add", ".", "json" ]
train
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/objects/album.py#L53-L65
ilblackdragon/django-misc
misc/management/utils.py
handle_lock
def handle_lock(handle): """ Decorate the handle method with a file lock to ensure there is only ever one process running at any one time. """ def wrapper(self, *args, **options): def on_interrupt(signum, frame): # It's necessary to release lockfile sys.exit() ...
python
def handle_lock(handle): """ Decorate the handle method with a file lock to ensure there is only ever one process running at any one time. """ def wrapper(self, *args, **options): def on_interrupt(signum, frame): # It's necessary to release lockfile sys.exit() ...
[ "def", "handle_lock", "(", "handle", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "def", "on_interrupt", "(", "signum", ",", "frame", ")", ":", "# It's necessary to release lockfile", "sys", ".", "exit", ...
Decorate the handle method with a file lock to ensure there is only ever one process running at any one time.
[ "Decorate", "the", "handle", "method", "with", "a", "file", "lock", "to", "ensure", "there", "is", "only", "ever", "one", "process", "running", "at", "any", "one", "time", "." ]
train
https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/management/utils.py#L24-L83
radjkarl/fancyWidgets
fancywidgets/pyQtBased/highlighter.py
Highlighter.highlightBlock
def highlightBlock(self, text): """Takes a block, applies format to the document. according to what's in it. """ # I need to know where in the document we are, # because our formatting info is global to # the document cb = self.currentBlock() p = cb.posit...
python
def highlightBlock(self, text): """Takes a block, applies format to the document. according to what's in it. """ # I need to know where in the document we are, # because our formatting info is global to # the document cb = self.currentBlock() p = cb.posit...
[ "def", "highlightBlock", "(", "self", ",", "text", ")", ":", "# I need to know where in the document we are,", "# because our formatting info is global to", "# the document", "cb", "=", "self", ".", "currentBlock", "(", ")", "p", "=", "cb", ".", "position", "(", ")", ...
Takes a block, applies format to the document. according to what's in it.
[ "Takes", "a", "block", "applies", "format", "to", "the", "document", ".", "according", "to", "what", "s", "in", "it", "." ]
train
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/highlighter.py#L84-L116
jtmoulia/switchboard-python
examples/listener.py
main
def main(url): """Create, connect, and block on the listener worker.""" try: listener = ListenerWorker(url) listener.connect() listener.run_forever() except KeyboardInterrupt: listener.close()
python
def main(url): """Create, connect, and block on the listener worker.""" try: listener = ListenerWorker(url) listener.connect() listener.run_forever() except KeyboardInterrupt: listener.close()
[ "def", "main", "(", "url", ")", ":", "try", ":", "listener", "=", "ListenerWorker", "(", "url", ")", "listener", ".", "connect", "(", ")", "listener", ".", "run_forever", "(", ")", "except", "KeyboardInterrupt", ":", "listener", ".", "close", "(", ")" ]
Create, connect, and block on the listener worker.
[ "Create", "connect", "and", "block", "on", "the", "listener", "worker", "." ]
train
https://github.com/jtmoulia/switchboard-python/blob/c9b0cb74cb12a64385465091be633e78d39f08b1/examples/listener.py#L59-L66
emdb-empiar/ahds
ahds/data_stream.py
hxbyterle_decode
def hxbyterle_decode(output_size, data): """Decode HxRLE data stream If C-extension is not compiled it will use a (slower) Python equivalent :param int output_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array ou...
python
def hxbyterle_decode(output_size, data): """Decode HxRLE data stream If C-extension is not compiled it will use a (slower) Python equivalent :param int output_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array ou...
[ "def", "hxbyterle_decode", "(", "output_size", ",", "data", ")", ":", "output", "=", "byterle_decoder", "(", "data", ",", "output_size", ")", "assert", "len", "(", "output", ")", "==", "output_size", "return", "output" ]
Decode HxRLE data stream If C-extension is not compiled it will use a (slower) Python equivalent :param int output_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array output: an array of ``numpy.uint8``
[ "Decode", "HxRLE", "data", "stream", "If", "C", "-", "extension", "is", "not", "compiled", "it", "will", "use", "a", "(", "slower", ")", "Python", "equivalent", ":", "param", "int", "output_size", ":", "the", "number", "of", "items", "when", "data", "is"...
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L79-L90
emdb-empiar/ahds
ahds/data_stream.py
hxzip_decode
def hxzip_decode(data_size, data): """Decode HxZip data stream :param int data_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array output: an array of ``numpy.uint8`` """ import zlib data_stream = zlib.decompre...
python
def hxzip_decode(data_size, data): """Decode HxZip data stream :param int data_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array output: an array of ``numpy.uint8`` """ import zlib data_stream = zlib.decompre...
[ "def", "hxzip_decode", "(", "data_size", ",", "data", ")", ":", "import", "zlib", "data_stream", "=", "zlib", ".", "decompress", "(", "data", ")", "output", "=", "numpy", ".", "array", "(", "struct", ".", "unpack", "(", "'<{}B'", ".", "format", "(", "l...
Decode HxZip data stream :param int data_size: the number of items when ``data`` is uncompressed :param str data: a raw stream of data to be unpacked :return numpy.array output: an array of ``numpy.uint8``
[ "Decode", "HxZip", "data", "stream", ":", "param", "int", "data_size", ":", "the", "number", "of", "items", "when", "data", "is", "uncompressed", ":", "param", "str", "data", ":", "a", "raw", "stream", "of", "data", "to", "be", "unpacked", ":", "return",...
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L93-L104
emdb-empiar/ahds
ahds/data_stream.py
unpack_binary
def unpack_binary(data_pointer, definitions, data): """Unpack binary data using ``struct.unpack`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definit...
python
def unpack_binary(data_pointer, definitions, data): """Unpack binary data using ``struct.unpack`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definit...
[ "def", "unpack_binary", "(", "data_pointer", ",", "definitions", ",", "data", ")", ":", "if", "data_pointer", ".", "data_dimension", ":", "data_dimension", "=", "data_pointer", ".", "data_dimension", "else", ":", "data_dimension", "=", "1", "# if data_dimension is N...
Unpack binary data using ``struct.unpack`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definitions: ``ahds.header.Block`` :param bytes data: raw bina...
[ "Unpack", "binary", "data", "using", "struct", ".", "unpack", ":", "param", "data_pointer", ":", "metadata", "for", "the", "data_pointer", "attribute", "for", "this", "data", "stream", ":", "type", "data_pointer", ":", "ahds", ".", "header", ".", "Block", ":...
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L107-L146
emdb-empiar/ahds
ahds/data_stream.py
unpack_ascii
def unpack_ascii(data): """Unpack ASCII data using string methods`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definitions: ``ahds.header.Block`` ...
python
def unpack_ascii(data): """Unpack ASCII data using string methods`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definitions: ``ahds.header.Block`` ...
[ "def", "unpack_ascii", "(", "data", ")", ":", "# string: split at newlines -> exclude last list item -> strip space from each ", "numstrings", "=", "map", "(", "lambda", "s", ":", "s", ".", "strip", "(", ")", ",", "data", ".", "split", "(", "'\\n'", ")", "[", ":...
Unpack ASCII data using string methods`` :param data_pointer: metadata for the ``data_pointer`` attribute for this data stream :type data_pointer: ``ahds.header.Block`` :param definitions: definitions specified in the header :type definitions: ``ahds.header.Block`` :param bytes data: raw binary...
[ "Unpack", "ASCII", "data", "using", "string", "methods", ":", "param", "data_pointer", ":", "metadata", "for", "the", "data_pointer", "attribute", "for", "this", "data", "stream", ":", "type", "data_pointer", ":", "ahds", ".", "header", ".", "Block", ":", "p...
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L149-L167
emdb-empiar/ahds
ahds/data_stream.py
Image.as_contours
def as_contours(self): """A dictionary of lists of contours keyed by byte_value""" contours = dict() for byte_value in self.__byte_values: if byte_value == 0: continue mask = (self.__array == byte_value) * 255 found_contours = find_contours(mas...
python
def as_contours(self): """A dictionary of lists of contours keyed by byte_value""" contours = dict() for byte_value in self.__byte_values: if byte_value == 0: continue mask = (self.__array == byte_value) * 255 found_contours = find_contours(mas...
[ "def", "as_contours", "(", "self", ")", ":", "contours", "=", "dict", "(", ")", "for", "byte_value", "in", "self", ".", "__byte_values", ":", "if", "byte_value", "==", "0", ":", "continue", "mask", "=", "(", "self", ".", "__array", "==", "byte_value", ...
A dictionary of lists of contours keyed by byte_value
[ "A", "dictionary", "of", "lists", "of", "contours", "keyed", "by", "byte_value" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L188-L197
emdb-empiar/ahds
ahds/data_stream.py
Image.show
def show(self): """Display the image""" with_matplotlib = True try: import matplotlib.pyplot as plt except RuntimeError: import skimage.io as io with_matplotlib = False if with_matplotlib: equalised_img = self.equalise(...
python
def show(self): """Display the image""" with_matplotlib = True try: import matplotlib.pyplot as plt except RuntimeError: import skimage.io as io with_matplotlib = False if with_matplotlib: equalised_img = self.equalise(...
[ "def", "show", "(", "self", ")", ":", "with_matplotlib", "=", "True", "try", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "except", "RuntimeError", ":", "import", "skimage", ".", "io", "as", "io", "with_matplotlib", "=", "False", "if", "with_ma...
Display the image
[ "Display", "the", "image" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L201-L230
emdb-empiar/ahds
ahds/data_stream.py
ImageSet.segments
def segments(self): """A dictionary of lists of contours keyed by z-index""" segments = dict() for i in xrange(len(self)): image = self[i] for z, contour in image.as_segments.iteritems(): for byte_value, contour_set in contour.iteritems(): ...
python
def segments(self): """A dictionary of lists of contours keyed by z-index""" segments = dict() for i in xrange(len(self)): image = self[i] for z, contour in image.as_segments.iteritems(): for byte_value, contour_set in contour.iteritems(): ...
[ "def", "segments", "(", "self", ")", ":", "segments", "=", "dict", "(", ")", "for", "i", "in", "xrange", "(", "len", "(", "self", ")", ")", ":", "image", "=", "self", "[", "i", "]", "for", "z", ",", "contour", "in", "image", ".", "as_segments", ...
A dictionary of lists of contours keyed by z-index
[ "A", "dictionary", "of", "lists", "of", "contours", "keyed", "by", "z", "-", "index" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L242-L256
emdb-empiar/ahds
ahds/data_stream.py
AmiraMeshDataStream.to_volume
def to_volume(self): """Return a 3D volume of the data""" if hasattr(self.header.definitions, "Lattice"): X, Y, Z = self.header.definitions.Lattice else: raise ValueError("Unable to determine data size") volume = self.decoded_data.reshape(Z, Y, X) ...
python
def to_volume(self): """Return a 3D volume of the data""" if hasattr(self.header.definitions, "Lattice"): X, Y, Z = self.header.definitions.Lattice else: raise ValueError("Unable to determine data size") volume = self.decoded_data.reshape(Z, Y, X) ...
[ "def", "to_volume", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "header", ".", "definitions", ",", "\"Lattice\"", ")", ":", "X", ",", "Y", ",", "Z", "=", "self", ".", "header", ".", "definitions", ".", "Lattice", "else", ":", "raise", ...
Return a 3D volume of the data
[ "Return", "a", "3D", "volume", "of", "the", "data" ]
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L381-L389
sveetch/django-icomoon
icomoon/store.py
WebfontStore.parse_manifest
def parse_manifest(self, fp): """ Open manifest JSON file and build icon map Args: fp (string or fileobject): Either manifest filepath to open or manifest File object. Returns: dict: Webfont icon map. Contains: * ``class_name``: Buil...
python
def parse_manifest(self, fp): """ Open manifest JSON file and build icon map Args: fp (string or fileobject): Either manifest filepath to open or manifest File object. Returns: dict: Webfont icon map. Contains: * ``class_name``: Buil...
[ "def", "parse_manifest", "(", "self", ",", "fp", ")", ":", "# Given a string for file path to open", "if", "isinstance", "(", "fp", ",", "string_types", ")", ":", "fp", "=", "io", ".", "open", "(", "fp", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", ...
Open manifest JSON file and build icon map Args: fp (string or fileobject): Either manifest filepath to open or manifest File object. Returns: dict: Webfont icon map. Contains: * ``class_name``: Builded icon classname with prefix configured ...
[ "Open", "manifest", "JSON", "file", "and", "build", "icon", "map" ]
train
https://github.com/sveetch/django-icomoon/blob/39f363ad3fbf53400be64a6c9413bf80c6308edf/icomoon/store.py#L42-L86
sveetch/django-icomoon
icomoon/store.py
WebfontStore.get
def get(self, webfont_name, webfont_settings): """ Get a manifest file, parse and store it. Args: webfont_name (string): Webfont key name. Used to store manifest and potentially its parser error. webfont_settings (dict): Webfont settings (an item value fr...
python
def get(self, webfont_name, webfont_settings): """ Get a manifest file, parse and store it. Args: webfont_name (string): Webfont key name. Used to store manifest and potentially its parser error. webfont_settings (dict): Webfont settings (an item value fr...
[ "def", "get", "(", "self", ",", "webfont_name", ",", "webfont_settings", ")", ":", "try", ":", "webfont_settings", "=", "extend_webfont_settings", "(", "webfont_settings", ")", "except", "IcomoonSettingsError", "as", "e", ":", "msg", "=", "\"Invalid webfont settings...
Get a manifest file, parse and store it. Args: webfont_name (string): Webfont key name. Used to store manifest and potentially its parser error. webfont_settings (dict): Webfont settings (an item value from ``settings.ICOMOON_WEBFONTS``).
[ "Get", "a", "manifest", "file", "parse", "and", "store", "it", "." ]
train
https://github.com/sveetch/django-icomoon/blob/39f363ad3fbf53400be64a6c9413bf80c6308edf/icomoon/store.py#L88-L114
sveetch/django-icomoon
icomoon/store.py
WebfontStore.fetch
def fetch(self, webfonts): """ Store every defined webfonts. Webfont are stored with sort on their name. Args: webfonts (dict): Dictionnary of webfont settings from ``settings.ICOMOON_WEBFONTS``. """ sorted_keys = sorted(webfonts.keys()) ...
python
def fetch(self, webfonts): """ Store every defined webfonts. Webfont are stored with sort on their name. Args: webfonts (dict): Dictionnary of webfont settings from ``settings.ICOMOON_WEBFONTS``. """ sorted_keys = sorted(webfonts.keys()) ...
[ "def", "fetch", "(", "self", ",", "webfonts", ")", ":", "sorted_keys", "=", "sorted", "(", "webfonts", ".", "keys", "(", ")", ")", "for", "webfont_name", "in", "sorted_keys", ":", "self", ".", "get", "(", "webfont_name", ",", "webfonts", "[", "webfont_na...
Store every defined webfonts. Webfont are stored with sort on their name. Args: webfonts (dict): Dictionnary of webfont settings from ``settings.ICOMOON_WEBFONTS``.
[ "Store", "every", "defined", "webfonts", "." ]
train
https://github.com/sveetch/django-icomoon/blob/39f363ad3fbf53400be64a6c9413bf80c6308edf/icomoon/store.py#L116-L128
winkidney/cmdtree
src/cmdtree/shortcuts.py
_apply2parser
def _apply2parser(arguments, options, parser): """ :return the parser itself :type arguments: list[list[T], dict[str, T]] :type options: list[list[T], dict[str, T]] :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser """ for args, kwargs in options: parser.option(...
python
def _apply2parser(arguments, options, parser): """ :return the parser itself :type arguments: list[list[T], dict[str, T]] :type options: list[list[T], dict[str, T]] :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser """ for args, kwargs in options: parser.option(...
[ "def", "_apply2parser", "(", "arguments", ",", "options", ",", "parser", ")", ":", "for", "args", ",", "kwargs", "in", "options", ":", "parser", ".", "option", "(", "*", "args", ",", "*", "*", "kwargs", ")", "for", "args", ",", "kwargs", "in", "argum...
:return the parser itself :type arguments: list[list[T], dict[str, T]] :type options: list[list[T], dict[str, T]] :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser
[ ":", "return", "the", "parser", "itself", ":", "type", "arguments", ":", "list", "[", "list", "[", "T", "]", "dict", "[", "str", "T", "]]", ":", "type", "options", ":", "list", "[", "list", "[", "T", "]", "dict", "[", "str", "T", "]]", ":", "ty...
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/shortcuts.py#L15-L27
winkidney/cmdtree
src/cmdtree/shortcuts.py
apply2parser
def apply2parser(cmd_proxy, parser): """ Apply a CmdProxy's arguments and options to a parser of argparse. :type cmd_proxy: callable or CmdProxy :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser """ if isinstance(cmd_proxy, CmdProxy): parser_proxy = cmd_proxy.me...
python
def apply2parser(cmd_proxy, parser): """ Apply a CmdProxy's arguments and options to a parser of argparse. :type cmd_proxy: callable or CmdProxy :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser """ if isinstance(cmd_proxy, CmdProxy): parser_proxy = cmd_proxy.me...
[ "def", "apply2parser", "(", "cmd_proxy", ",", "parser", ")", ":", "if", "isinstance", "(", "cmd_proxy", ",", "CmdProxy", ")", ":", "parser_proxy", "=", "cmd_proxy", ".", "meta", ".", "parser", "_apply2parser", "(", "parser_proxy", ".", "arguments", ",", "par...
Apply a CmdProxy's arguments and options to a parser of argparse. :type cmd_proxy: callable or CmdProxy :type parser: cmdtree.parser.AParser :rtype: cmdtree.parser.AParser
[ "Apply", "a", "CmdProxy", "s", "arguments", "and", "options", "to", "a", "parser", "of", "argparse", ".", ":", "type", "cmd_proxy", ":", "callable", "or", "CmdProxy", ":", "type", "parser", ":", "cmdtree", ".", "parser", ".", "AParser", ":", "rtype", ":"...
train
https://github.com/winkidney/cmdtree/blob/8558be856f4c3044cf13d2d07a86b69877bb6491/src/cmdtree/shortcuts.py#L30-L45
radujica/baloo
baloo/io/csv.py
read_csv
def read_csv(filepath, sep=',', header='infer', names=None, usecols=None, dtype=None, converters=None, skiprows=None, nrows=None): """Read CSV into DataFrame. Eager implementation using pandas, i.e. entire file is read at this point. Only common/relevant parameters available at the moment; for...
python
def read_csv(filepath, sep=',', header='infer', names=None, usecols=None, dtype=None, converters=None, skiprows=None, nrows=None): """Read CSV into DataFrame. Eager implementation using pandas, i.e. entire file is read at this point. Only common/relevant parameters available at the moment; for...
[ "def", "read_csv", "(", "filepath", ",", "sep", "=", "','", ",", "header", "=", "'infer'", ",", "names", "=", "None", ",", "usecols", "=", "None", ",", "dtype", "=", "None", ",", "converters", "=", "None", ",", "skiprows", "=", "None", ",", "nrows", ...
Read CSV into DataFrame. Eager implementation using pandas, i.e. entire file is read at this point. Only common/relevant parameters available at the moment; for full list, could use pandas directly and then convert to baloo. Parameters ---------- filepath : str sep : str, optional Sepa...
[ "Read", "CSV", "into", "DataFrame", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/io/csv.py#L6-L52
radujica/baloo
baloo/io/csv.py
to_csv
def to_csv(df, filepath, sep=',', header=True, index=True): """Save DataFrame as csv. Note data is expected to be evaluated. Currently delegates to Pandas. Parameters ---------- df : DataFrame filepath : str sep : str, optional Separator used between values. header : bool,...
python
def to_csv(df, filepath, sep=',', header=True, index=True): """Save DataFrame as csv. Note data is expected to be evaluated. Currently delegates to Pandas. Parameters ---------- df : DataFrame filepath : str sep : str, optional Separator used between values. header : bool,...
[ "def", "to_csv", "(", "df", ",", "filepath", ",", "sep", "=", "','", ",", "header", "=", "True", ",", "index", "=", "True", ")", ":", "df", ".", "to_pandas", "(", ")", ".", "to_csv", "(", "filepath", ",", "sep", "=", "sep", ",", "header", "=", ...
Save DataFrame as csv. Note data is expected to be evaluated. Currently delegates to Pandas. Parameters ---------- df : DataFrame filepath : str sep : str, optional Separator used between values. header : bool, optional Whether to save the header. index : bool, opt...
[ "Save", "DataFrame", "as", "csv", "." ]
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/io/csv.py#L56-L86
bede/tictax
tictax/cli.py
kmer_lca
def kmer_lca(seqs_path: 'path to (optionally gzipped) fasta/fastq input', fastq: 'input is fastq; disable autodetection' = False, progress: 'show progress bar (sent to stderr)' = False): ''' Lowest common ancestor sequence assignment using the One Codex API. Streams annotated recor...
python
def kmer_lca(seqs_path: 'path to (optionally gzipped) fasta/fastq input', fastq: 'input is fastq; disable autodetection' = False, progress: 'show progress bar (sent to stderr)' = False): ''' Lowest common ancestor sequence assignment using the One Codex API. Streams annotated recor...
[ "def", "kmer_lca", "(", "seqs_path", ":", "'path to (optionally gzipped) fasta/fastq input'", ",", "fastq", ":", "'input is fastq; disable autodetection'", "=", "False", ",", "progress", ":", "'show progress bar (sent to stderr)'", "=", "False", ")", ":", "conf", "=", "ti...
Lowest common ancestor sequence assignment using the One Codex API. Streams annotated records to stdout in fasta format. Taxa assigned using the One Codex 31mer LCA database.
[ "Lowest", "common", "ancestor", "sequence", "assignment", "using", "the", "One", "Codex", "API", ".", "Streams", "annotated", "records", "to", "stdout", "in", "fasta", "format", ".", "Taxa", "assigned", "using", "the", "One", "Codex", "31mer", "LCA", "database...
train
https://github.com/bede/tictax/blob/acc9811be3a8b5ad905daf4b5d413f2c5e6ad06c/tictax/cli.py#L20-L35
bede/tictax
tictax/cli.py
annotate_diamond
def annotate_diamond(fasta_path: 'path to fasta input', diamond_path: 'path to Diamond taxonomic classification output'): ''' Annotate fasta headers with taxonomy information from Diamond ''' records = tictax.parse_seqs(fasta_path) annotated_records = tictax.annotate_diamond(rec...
python
def annotate_diamond(fasta_path: 'path to fasta input', diamond_path: 'path to Diamond taxonomic classification output'): ''' Annotate fasta headers with taxonomy information from Diamond ''' records = tictax.parse_seqs(fasta_path) annotated_records = tictax.annotate_diamond(rec...
[ "def", "annotate_diamond", "(", "fasta_path", ":", "'path to fasta input'", ",", "diamond_path", ":", "'path to Diamond taxonomic classification output'", ")", ":", "records", "=", "tictax", ".", "parse_seqs", "(", "fasta_path", ")", "annotated_records", "=", "tictax", ...
Annotate fasta headers with taxonomy information from Diamond
[ "Annotate", "fasta", "headers", "with", "taxonomy", "information", "from", "Diamond" ]
train
https://github.com/bede/tictax/blob/acc9811be3a8b5ad905daf4b5d413f2c5e6ad06c/tictax/cli.py#L38-L45
bede/tictax
tictax/cli.py
filter_taxa
def filter_taxa(fasta_path: 'path to fasta input', taxids: 'comma delimited list of taxon IDs', unclassified: 'pass sequences unclassified at superkingdom level >(0)' = False, discard: 'discard specified taxa' = False, warnings: 'show warnings' = False): ...
python
def filter_taxa(fasta_path: 'path to fasta input', taxids: 'comma delimited list of taxon IDs', unclassified: 'pass sequences unclassified at superkingdom level >(0)' = False, discard: 'discard specified taxa' = False, warnings: 'show warnings' = False): ...
[ "def", "filter_taxa", "(", "fasta_path", ":", "'path to fasta input'", ",", "taxids", ":", "'comma delimited list of taxon IDs'", ",", "unclassified", ":", "'pass sequences unclassified at superkingdom level >(0)'", "=", "False", ",", "discard", ":", "'discard specified taxa'",...
Customisable filtering of tictax flavoured fasta files
[ "Customisable", "filtering", "of", "tictax", "flavoured", "fasta", "files" ]
train
https://github.com/bede/tictax/blob/acc9811be3a8b5ad905daf4b5d413f2c5e6ad06c/tictax/cli.py#L49-L63
bede/tictax
tictax/cli.py
matrix
def matrix(fasta_path: 'path to tictax annotated fasta input', scafstats_path: 'path to BBMap scaftstats file'): ''' Generate taxonomic count matrix from tictax classified contigs ''' records = SeqIO.parse(fasta_path, 'fasta') df = tictax.matrix(records, scafstats_path) df.to_csv(sys....
python
def matrix(fasta_path: 'path to tictax annotated fasta input', scafstats_path: 'path to BBMap scaftstats file'): ''' Generate taxonomic count matrix from tictax classified contigs ''' records = SeqIO.parse(fasta_path, 'fasta') df = tictax.matrix(records, scafstats_path) df.to_csv(sys....
[ "def", "matrix", "(", "fasta_path", ":", "'path to tictax annotated fasta input'", ",", "scafstats_path", ":", "'path to BBMap scaftstats file'", ")", ":", "records", "=", "SeqIO", ".", "parse", "(", "fasta_path", ",", "'fasta'", ")", "df", "=", "tictax", ".", "ma...
Generate taxonomic count matrix from tictax classified contigs
[ "Generate", "taxonomic", "count", "matrix", "from", "tictax", "classified", "contigs" ]
train
https://github.com/bede/tictax/blob/acc9811be3a8b5ad905daf4b5d413f2c5e6ad06c/tictax/cli.py#L66-L73