partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
concat_chunks
Concatenate chunks. If multiple chunk files match to the same sample name but with different barcodes (i.e., they are technical replicates) then this will assign all the files to the same sample name file.
ipyrad/assemble/demultiplex.py
def concat_chunks(data, ipyclient): """ Concatenate chunks. If multiple chunk files match to the same sample name but with different barcodes (i.e., they are technical replicates) then this will assign all the files to the same sample name file. """ ## collate files progress bar start = ti...
def concat_chunks(data, ipyclient): """ Concatenate chunks. If multiple chunk files match to the same sample name but with different barcodes (i.e., they are technical replicates) then this will assign all the files to the same sample name file. """ ## collate files progress bar start = ti...
[ "Concatenate", "chunks", ".", "If", "multiple", "chunk", "files", "match", "to", "the", "same", "sample", "name", "but", "with", "different", "barcodes", "(", "i", ".", "e", ".", "they", "are", "technical", "replicates", ")", "then", "this", "will", "assig...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1069-L1124
[ "def", "concat_chunks", "(", "data", ",", "ipyclient", ")", ":", "## collate files progress bar", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "' writing/compressing | {} | s1 |'", "lbview", "=", "ipyclient", ".", "load_balanced_view", "(", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
demux2
Submit chunks to be sorted by the barmatch() function then calls putstats().
ipyrad/assemble/demultiplex.py
def demux2(data, chunkfiles, cutters, longbar, matchdict, ipyclient): """ Submit chunks to be sorted by the barmatch() function then calls putstats(). """ ## parallel stuff, limit to 1/4 of available cores for RAM limits. start = time.time() printstr = ' sorting reads | {} | s1 |'...
def demux2(data, chunkfiles, cutters, longbar, matchdict, ipyclient): """ Submit chunks to be sorted by the barmatch() function then calls putstats(). """ ## parallel stuff, limit to 1/4 of available cores for RAM limits. start = time.time() printstr = ' sorting reads | {} | s1 |'...
[ "Submit", "chunks", "to", "be", "sorted", "by", "the", "barmatch", "()", "function", "then", "calls", "putstats", "()", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1273-L1341
[ "def", "demux2", "(", "data", ",", "chunkfiles", ",", "cutters", ",", "longbar", ",", "matchdict", ",", "ipyclient", ")", ":", "## parallel stuff, limit to 1/4 of available cores for RAM limits.", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "' so...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
demux
submit chunks to be sorted
ipyrad/assemble/demultiplex.py
def demux(data, chunkfiles, cutters, longbar, matchdict, ipyclient): """ submit chunks to be sorted """ ## parallel stuff start = time.time() printstr = ' sorting reads | {} | s1 |' lbview = ipyclient.load_balanced_view() ## store statcounters and async results in dicts perfile = {...
def demux(data, chunkfiles, cutters, longbar, matchdict, ipyclient): """ submit chunks to be sorted """ ## parallel stuff start = time.time() printstr = ' sorting reads | {} | s1 |' lbview = ipyclient.load_balanced_view() ## store statcounters and async results in dicts perfile = {...
[ "submit", "chunks", "to", "be", "sorted" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1346-L1476
[ "def", "demux", "(", "data", ",", "chunkfiles", ",", "cutters", ",", "longbar", ",", "matchdict", ",", "ipyclient", ")", ":", "## parallel stuff", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "' sorting reads | {} | s1 |'", "lbview", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
putstats
puts stats from pickles into a dictionary
ipyrad/assemble/demultiplex.py
def putstats(pfile, handle, statdicts): """ puts stats from pickles into a dictionary """ ## load in stats with open(pfile, 'r') as infile: filestats, samplestats = pickle.load(infile) ## get dicts from statdicts tuple perfile, fsamplehits, fbarhits, fmisses, fdbars = statdicts ## pul...
def putstats(pfile, handle, statdicts): """ puts stats from pickles into a dictionary """ ## load in stats with open(pfile, 'r') as infile: filestats, samplestats = pickle.load(infile) ## get dicts from statdicts tuple perfile, fsamplehits, fbarhits, fmisses, fdbars = statdicts ## pul...
[ "puts", "stats", "from", "pickles", "into", "a", "dictionary" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1479-L1502
[ "def", "putstats", "(", "pfile", ",", "handle", ",", "statdicts", ")", ":", "## load in stats", "with", "open", "(", "pfile", ",", "'r'", ")", "as", "infile", ":", "filestats", ",", "samplestats", "=", "pickle", ".", "load", "(", "infile", ")", "## get d...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
zcat_make_temps
Call bash command 'cat' and 'split' to split large files. The goal is to create N splitfiles where N is a multiple of the number of processors so that each processor can work on a file in parallel.
ipyrad/assemble/demultiplex.py
def zcat_make_temps(data, raws, num, tmpdir, optim, njobs, start): """ Call bash command 'cat' and 'split' to split large files. The goal is to create N splitfiles where N is a multiple of the number of processors so that each processor can work on a file in parallel. """ printstr = ' chunking...
def zcat_make_temps(data, raws, num, tmpdir, optim, njobs, start): """ Call bash command 'cat' and 'split' to split large files. The goal is to create N splitfiles where N is a multiple of the number of processors so that each processor can work on a file in parallel. """ printstr = ' chunking...
[ "Call", "bash", "command", "cat", "and", "split", "to", "split", "large", "files", ".", "The", "goal", "is", "to", "create", "N", "splitfiles", "where", "N", "is", "a", "multiple", "of", "the", "number", "of", "processors", "so", "that", "each", "process...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1506-L1600
[ "def", "zcat_make_temps", "(", "data", ",", "raws", ",", "num", ",", "tmpdir", ",", "optim", ",", "njobs", ",", "start", ")", ":", "printstr", "=", "' chunking large files | {} | s1 |'", "## split args", "tmpdir", "=", "os", ".", "path", ".", "realpath", "(...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_plotshare
make toyplot matrix fig
ipyrad/plotting/share_plot.py
def _plotshare(share, names, **kwargs): """ make toyplot matrix fig""" ## set the colormap colormap = toyplot.color.LinearMap(toyplot.color.brewer.palette("Spectral"), domain_min=share.min(), domain_max=share.max()) ## set up canvas if not kwargs.get('width'): ...
def _plotshare(share, names, **kwargs): """ make toyplot matrix fig""" ## set the colormap colormap = toyplot.color.LinearMap(toyplot.color.brewer.palette("Spectral"), domain_min=share.min(), domain_max=share.max()) ## set up canvas if not kwargs.get('width'): ...
[ "make", "toyplot", "matrix", "fig" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/share_plot.py#L54-L122
[ "def", "_plotshare", "(", "share", ",", "names", ",", "*", "*", "kwargs", ")", ":", "## set the colormap", "colormap", "=", "toyplot", ".", "color", ".", "LinearMap", "(", "toyplot", ".", "color", ".", "brewer", ".", "palette", "(", "\"Spectral\"", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_getarray
parse the loci file list and return presence/absence matrix ordered by the tips on the tree
ipyrad/plotting/share_plot.py
def _getarray(loci, tree): """ parse the loci file list and return presence/absence matrix ordered by the tips on the tree """ ## order tips tree.ladderize() ## get tip names snames = tree.get_leaf_names() ## make an empty matrix lxs = np.zeros((len(snames), len(loci)), dtype...
def _getarray(loci, tree): """ parse the loci file list and return presence/absence matrix ordered by the tips on the tree """ ## order tips tree.ladderize() ## get tip names snames = tree.get_leaf_names() ## make an empty matrix lxs = np.zeros((len(snames), len(loci)), dtype...
[ "parse", "the", "loci", "file", "list", "and", "return", "presence", "/", "absence", "matrix", "ordered", "by", "the", "tips", "on", "the", "tree" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/share_plot.py#L126-L146
[ "def", "_getarray", "(", "loci", ",", "tree", ")", ":", "## order tips", "tree", ".", "ladderize", "(", ")", "## get tip names", "snames", "=", "tree", ".", "get_leaf_names", "(", ")", "## make an empty matrix", "lxs", "=", "np", ".", "zeros", "(", "(", "l...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_countmatrix
fill a matrix with pairwise data sharing
ipyrad/plotting/share_plot.py
def _countmatrix(lxs): """ fill a matrix with pairwise data sharing """ ## an empty matrix share = np.zeros((lxs.shape[0], lxs.shape[0])) ## fill above names = range(lxs.shape[0]) for row in lxs: for samp1, samp2 in itertools.combinations(names, 2): shared = lxs[samp1, ...
def _countmatrix(lxs): """ fill a matrix with pairwise data sharing """ ## an empty matrix share = np.zeros((lxs.shape[0], lxs.shape[0])) ## fill above names = range(lxs.shape[0]) for row in lxs: for samp1, samp2 in itertools.combinations(names, 2): shared = lxs[samp1, ...
[ "fill", "a", "matrix", "with", "pairwise", "data", "sharing" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/share_plot.py#L150-L170
[ "def", "_countmatrix", "(", "lxs", ")", ":", "## an empty matrix", "share", "=", "np", ".", "zeros", "(", "(", "lxs", ".", "shape", "[", "0", "]", ",", "lxs", ".", "shape", "[", "0", "]", ")", ")", "## fill above", "names", "=", "range", "(", "lxs"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
paramname
Get the param name from the dict index value.
ipyrad/core/paramsinfo.py
def paramname(param=""): """ Get the param name from the dict index value. """ try: name = pinfo[str(param)][0].strip().split(" ")[1] except (KeyError, ValueError) as err: ## TODO: paramsinfo get description by param string not working. ## It would be cool to have an assembly o...
def paramname(param=""): """ Get the param name from the dict index value. """ try: name = pinfo[str(param)][0].strip().split(" ")[1] except (KeyError, ValueError) as err: ## TODO: paramsinfo get description by param string not working. ## It would be cool to have an assembly o...
[ "Get", "the", "param", "name", "from", "the", "dict", "index", "value", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/paramsinfo.py#L415-L430
[ "def", "paramname", "(", "param", "=", "\"\"", ")", ":", "try", ":", "name", "=", "pinfo", "[", "str", "(", "param", ")", "]", "[", "0", "]", ".", "strip", "(", ")", ".", "split", "(", "\" \"", ")", "[", "1", "]", "except", "(", "KeyError", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
paraminfo
Returns detailed information for the numbered parameter. Further information is available in the tutorial. Unlike params() this function doesn't deal well with * It only takes one parameter at a time and returns the desc
ipyrad/core/paramsinfo.py
def paraminfo(param="", short=False): """ Returns detailed information for the numbered parameter. Further information is available in the tutorial. Unlike params() this function doesn't deal well with * It only takes one parameter at a time and returns the desc """ ## If the short...
def paraminfo(param="", short=False): """ Returns detailed information for the numbered parameter. Further information is available in the tutorial. Unlike params() this function doesn't deal well with * It only takes one parameter at a time and returns the desc """ ## If the short...
[ "Returns", "detailed", "information", "for", "the", "numbered", "parameter", ".", "Further", "information", "is", "available", "in", "the", "tutorial", ".", "Unlike", "params", "()", "this", "function", "doesn", "t", "deal", "well", "with", "*", "It", "only", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/paramsinfo.py#L433-L458
[ "def", "paraminfo", "(", "param", "=", "\"\"", ",", "short", "=", "False", ")", ":", "## If the short flag is set return the short description, otherwise", "## return the long.", "if", "short", ":", "desc", "=", "1", "else", ":", "desc", "=", "0", "try", ":", "d...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
paramsinfo
This is the human readable version of the paramsinfo() function. You give it a param and it prints to stdout.
ipyrad/core/paramsinfo.py
def paramsinfo(param="", short=False): """ This is the human readable version of the paramsinfo() function. You give it a param and it prints to stdout. """ if short: desc = 1 else: desc = 0 if param == "*": for key in pinfo: print(pinfo[str(key)][desc]) ...
def paramsinfo(param="", short=False): """ This is the human readable version of the paramsinfo() function. You give it a param and it prints to stdout. """ if short: desc = 1 else: desc = 0 if param == "*": for key in pinfo: print(pinfo[str(key)][desc]) ...
[ "This", "is", "the", "human", "readable", "version", "of", "the", "paramsinfo", "()", "function", ".", "You", "give", "it", "a", "param", "and", "it", "prints", "to", "stdout", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/paramsinfo.py#L461-L487
[ "def", "paramsinfo", "(", "param", "=", "\"\"", ",", "short", "=", "False", ")", ":", "if", "short", ":", "desc", "=", "1", "else", ":", "desc", "=", "0", "if", "param", "==", "\"*\"", ":", "for", "key", "in", "pinfo", ":", "print", "(", "pinfo",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
update_assembly
Create a new Assembly() and convert as many of our old params to the new version as we can. Also report out any parameters that are removed and what their values are.
ipyrad/load/load.py
def update_assembly(data): """ Create a new Assembly() and convert as many of our old params to the new version as we can. Also report out any parameters that are removed and what their values are. """ print("##############################################################") print("Updating...
def update_assembly(data): """ Create a new Assembly() and convert as many of our old params to the new version as we can. Also report out any parameters that are removed and what their values are. """ print("##############################################################") print("Updating...
[ "Create", "a", "new", "Assembly", "()", "and", "convert", "as", "many", "of", "our", "old", "params", "to", "the", "new", "version", "as", "we", "can", ".", "Also", "report", "out", "any", "parameters", "that", "are", "removed", "and", "what", "their", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L53-L100
[ "def", "update_assembly", "(", "data", ")", ":", "print", "(", "\"##############################################################\"", ")", "print", "(", "\"Updating assembly to current version\"", ")", "## New assembly object to update pdate from.", "new_assembly", "=", "ip", ".",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
save_json2
save to json.
ipyrad/load/load.py
def save_json2(data): """ save to json.""" ## convert everything to dicts ## skip _ipcluster cuz it's made new. datadict = OrderedDict([ ("outfiles", data.__dict__["outfiles"]), ("stats_files", dict(data.__dict__["stats_files"])), ("stats_dfs", data.__dict__["stats_dfs"]) ...
def save_json2(data): """ save to json.""" ## convert everything to dicts ## skip _ipcluster cuz it's made new. datadict = OrderedDict([ ("outfiles", data.__dict__["outfiles"]), ("stats_files", dict(data.__dict__["stats_files"])), ("stats_dfs", data.__dict__["stats_dfs"]) ...
[ "save", "to", "json", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L104-L113
[ "def", "save_json2", "(", "data", ")", ":", "## convert everything to dicts", "## skip _ipcluster cuz it's made new.", "datadict", "=", "OrderedDict", "(", "[", "(", "\"outfiles\"", ",", "data", ".", "__dict__", "[", "\"outfiles\"", "]", ")", ",", "(", "\"stats_file...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
save_json
Save assembly and samples as json
ipyrad/load/load.py
def save_json(data): """ Save assembly and samples as json """ ## data as dict #### skip _ipcluster because it's made new #### skip _headers because it's loaded new #### statsfiles save only keys #### samples save only keys datadict = OrderedDict([ ("_version", data.__dict__["_versi...
def save_json(data): """ Save assembly and samples as json """ ## data as dict #### skip _ipcluster because it's made new #### skip _headers because it's loaded new #### statsfiles save only keys #### samples save only keys datadict = OrderedDict([ ("_version", data.__dict__["_versi...
[ "Save", "assembly", "and", "samples", "as", "json" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L117-L169
[ "def", "save_json", "(", "data", ")", ":", "## data as dict", "#### skip _ipcluster because it's made new", "#### skip _headers because it's loaded new", "#### statsfiles save only keys", "#### samples save only keys", "datadict", "=", "OrderedDict", "(", "[", "(", "\"_version\"", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
load_json
Load a json serialized object and ensure it matches to the current Assembly object format
ipyrad/load/load.py
def load_json(path, quiet=False, cli=False): """ Load a json serialized object and ensure it matches to the current Assembly object format """ ## load the JSON string and try with name+.json checkfor = [path+".json", path] for inpath in checkfor: inpath = inpath.replace("~", os.p...
def load_json(path, quiet=False, cli=False): """ Load a json serialized object and ensure it matches to the current Assembly object format """ ## load the JSON string and try with name+.json checkfor = [path+".json", path] for inpath in checkfor: inpath = inpath.replace("~", os.p...
[ "Load", "a", "json", "serialized", "object", "and", "ensure", "it", "matches", "to", "the", "current", "Assembly", "object", "format" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L173-L377
[ "def", "load_json", "(", "path", ",", "quiet", "=", "False", ",", "cli", "=", "False", ")", ":", "## load the JSON string and try with name+.json", "checkfor", "=", "[", "path", "+", "\".json\"", ",", "path", "]", "for", "inpath", "in", "checkfor", ":", "inp...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_tup_and_byte
wat
ipyrad/load/load.py
def _tup_and_byte(obj): """ wat """ # if this is a unicode string, return its string representation if isinstance(obj, unicode): return obj.encode('utf-8') # if this is a list of values, return list of byteified values if isinstance(obj, list): return [_tup_and_byte(item) for item i...
def _tup_and_byte(obj): """ wat """ # if this is a unicode string, return its string representation if isinstance(obj, unicode): return obj.encode('utf-8') # if this is a list of values, return list of byteified values if isinstance(obj, list): return [_tup_and_byte(item) for item i...
[ "wat" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L407-L429
[ "def", "_tup_and_byte", "(", "obj", ")", ":", "# if this is a unicode string, return its string representation", "if", "isinstance", "(", "obj", ",", "unicode", ")", ":", "return", "obj", ".", "encode", "(", "'utf-8'", ")", "# if this is a list of values, return list of b...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Encoder.encode
function to encode json string
ipyrad/load/load.py
def encode(self, obj): """ function to encode json string""" def hint_tuples(item): """ embeds __tuple__ hinter in json strings """ if isinstance(item, tuple): return {'__tuple__': True, 'items': item} if isinstance(item, list): return ...
def encode(self, obj): """ function to encode json string""" def hint_tuples(item): """ embeds __tuple__ hinter in json strings """ if isinstance(item, tuple): return {'__tuple__': True, 'items': item} if isinstance(item, list): return ...
[ "function", "to", "encode", "json", "string" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/load/load.py#L388-L403
[ "def", "encode", "(", "self", ",", "obj", ")", ":", "def", "hint_tuples", "(", "item", ")", ":", "\"\"\" embeds __tuple__ hinter in json strings \"\"\"", "if", "isinstance", "(", "item", ",", "tuple", ")", ":", "return", "{", "'__tuple__'", ":", "True", ",", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
baba_panel_plot
signature...
ipyrad/plotting/baba_panel_plot.py
def baba_panel_plot( ttree, tests, boots, show_tip_labels=True, show_test_labels=True, use_edge_lengths=False, collapse_outgroup=False, pct_tree_x=0.4, pct_tree_y=0.2, alpha=3.0, *args, **kwargs): """ signature... """ ## create Panel plot object an...
def baba_panel_plot( ttree, tests, boots, show_tip_labels=True, show_test_labels=True, use_edge_lengths=False, collapse_outgroup=False, pct_tree_x=0.4, pct_tree_y=0.2, alpha=3.0, *args, **kwargs): """ signature... """ ## create Panel plot object an...
[ "signature", "..." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/baba_panel_plot.py#L26-L66
[ "def", "baba_panel_plot", "(", "ttree", ",", "tests", ",", "boots", ",", "show_tip_labels", "=", "True", ",", "show_test_labels", "=", "True", ",", "use_edge_lengths", "=", "False", ",", "collapse_outgroup", "=", "False", ",", "pct_tree_x", "=", "0.4", ",", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
depthplot
plots histogram of coverages across clusters
ipyrad/plotting/coverageplots.py
def depthplot(data, samples=None, dims=(None,None), canvas=(None,None), xmax=50, log=False, outprefix=None, use_maxdepth=False): """ plots histogram of coverages across clusters""" ## select samples to be plotted, requires depths info if not samples: samples = data.samples.keys() ...
def depthplot(data, samples=None, dims=(None,None), canvas=(None,None), xmax=50, log=False, outprefix=None, use_maxdepth=False): """ plots histogram of coverages across clusters""" ## select samples to be plotted, requires depths info if not samples: samples = data.samples.keys() ...
[ "plots", "histogram", "of", "coverages", "across", "clusters" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/coverageplots.py#L17-L86
[ "def", "depthplot", "(", "data", ",", "samples", "=", "None", ",", "dims", "=", "(", "None", ",", "None", ")", ",", "canvas", "=", "(", "None", ",", "None", ")", ",", "xmax", "=", "50", ",", "log", "=", "False", ",", "outprefix", "=", "None", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_parse_00
return 00 outfile as a pandas DataFrame
ipyrad/analysis/bpp.py
def _parse_00(ofile): """ return 00 outfile as a pandas DataFrame """ with open(ofile) as infile: ## read in the results summary from the end of the outfile arr = np.array( [" "] + infile.read().split("Summary of MCMC results\n\n\n")[1:][0]\ .strip().split()) ...
def _parse_00(ofile): """ return 00 outfile as a pandas DataFrame """ with open(ofile) as infile: ## read in the results summary from the end of the outfile arr = np.array( [" "] + infile.read().split("Summary of MCMC results\n\n\n")[1:][0]\ .strip().split()) ...
[ "return", "00", "outfile", "as", "a", "pandas", "DataFrame" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L714-L735
[ "def", "_parse_00", "(", "ofile", ")", ":", "with", "open", "(", "ofile", ")", "as", "infile", ":", "## read in the results summary from the end of the outfile", "arr", "=", "np", ".", "array", "(", "[", "\" \"", "]", "+", "infile", ".", "read", "(", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_parse_01
a subfunction for summarizing results
ipyrad/analysis/bpp.py
def _parse_01(ofiles, individual=False): """ a subfunction for summarizing results """ ## parse results from outfiles cols = [] dats = [] for ofile in ofiles: ## parse file with open(ofile) as infile: dat = infile.read() lastbits = dat.split(".mcmc.txt...
def _parse_01(ofiles, individual=False): """ a subfunction for summarizing results """ ## parse results from outfiles cols = [] dats = [] for ofile in ofiles: ## parse file with open(ofile) as infile: dat = infile.read() lastbits = dat.split(".mcmc.txt...
[ "a", "subfunction", "for", "summarizing", "results" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L741-L787
[ "def", "_parse_01", "(", "ofiles", ",", "individual", "=", "False", ")", ":", "## parse results from outfiles", "cols", "=", "[", "]", "dats", "=", "[", "]", "for", "ofile", "in", "ofiles", ":", "## parse file", "with", "open", "(", "ofile", ")", "as", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp._load_existing_results
Load existing results files for an object with this workdir and name. This does NOT reload the parameter settings for the object...
ipyrad/analysis/bpp.py
def _load_existing_results(self, name, workdir): """ Load existing results files for an object with this workdir and name. This does NOT reload the parameter settings for the object... """ ## get mcmcs path = os.path.realpath(os.path.join(self.workdir, self.name)) ...
def _load_existing_results(self, name, workdir): """ Load existing results files for an object with this workdir and name. This does NOT reload the parameter settings for the object... """ ## get mcmcs path = os.path.realpath(os.path.join(self.workdir, self.name)) ...
[ "Load", "existing", "results", "files", "for", "an", "object", "with", "this", "workdir", "and", "name", ".", "This", "does", "NOT", "reload", "the", "parameter", "settings", "for", "the", "object", "..." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L274-L293
[ "def", "_load_existing_results", "(", "self", ",", "name", ",", "workdir", ")", ":", "## get mcmcs", "path", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(", "self", ".", "workdir", ",", "self", ".", "name", ")", ")"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp.run
Submits bpp jobs to run on a cluster (ipyparallel Client). The seed for the random number generator if not set is randomly drawn, and if multiple reps are submitted (nreps>1) then each will draw a subsequent random seeds after that. An ipyclient connection is required. Asynchronous r...
ipyrad/analysis/bpp.py
def run(self, ipyclient, nreps=1, quiet=False, randomize_order=False, force=False, ): """ Submits bpp jobs to run on a cluster (ipyparallel Client). The seed for the random number generator if not set is randomly drawn, and if multiple ...
def run(self, ipyclient, nreps=1, quiet=False, randomize_order=False, force=False, ): """ Submits bpp jobs to run on a cluster (ipyparallel Client). The seed for the random number generator if not set is randomly drawn, and if multiple ...
[ "Submits", "bpp", "jobs", "to", "run", "on", "a", "cluster", "(", "ipyparallel", "Client", ")", ".", "The", "seed", "for", "the", "random", "number", "generator", "if", "not", "set", "is", "randomly", "drawn", "and", "if", "multiple", "reps", "are", "sub...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L296-L377
[ "def", "run", "(", "self", ",", "ipyclient", ",", "nreps", "=", "1", ",", "quiet", "=", "False", ",", "randomize_order", "=", "False", ",", "force", "=", "False", ",", ")", ":", "## is this running algorithm 00?", "is_alg00", "=", "(", "not", "self", "."...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp.write_bpp_files
Writes bpp files (.ctl, .seq, .imap) to the working directory. Parameters: ------------ randomize_order (bool): whether to randomize the locus order, this will allow you to sample different subsets of loci in different replicates when using the filters.maxl...
ipyrad/analysis/bpp.py
def write_bpp_files(self, randomize_order=False, quiet=False): """ Writes bpp files (.ctl, .seq, .imap) to the working directory. Parameters: ------------ randomize_order (bool): whether to randomize the locus order, this will allow you to sample diffe...
def write_bpp_files(self, randomize_order=False, quiet=False): """ Writes bpp files (.ctl, .seq, .imap) to the working directory. Parameters: ------------ randomize_order (bool): whether to randomize the locus order, this will allow you to sample diffe...
[ "Writes", "bpp", "files", "(", ".", "ctl", ".", "seq", ".", "imap", ")", "to", "the", "working", "directory", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L381-L411
[ "def", "write_bpp_files", "(", "self", ",", "randomize_order", "=", "False", ",", "quiet", "=", "False", ")", ":", "## remove any old jobs with this same job name", "self", ".", "_name", "=", "self", ".", "name", "oldjobs", "=", "glob", ".", "glob", "(", "os",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp._write_ctlfile
write outfile with any args in argdict
ipyrad/analysis/bpp.py
def _write_ctlfile(self):#, rep=None): """ write outfile with any args in argdict """ ## A string to store ctl info ctl = [] ## write the top header info ctl.append("seed = {}".format(self.params.seed)) ctl.append("seqfile = {}".format(self.seqfile)) ctl.append(...
def _write_ctlfile(self):#, rep=None): """ write outfile with any args in argdict """ ## A string to store ctl info ctl = [] ## write the top header info ctl.append("seed = {}".format(self.params.seed)) ctl.append("seqfile = {}".format(self.seqfile)) ctl.append(...
[ "write", "outfile", "with", "any", "args", "in", "argdict" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L513-L583
[ "def", "_write_ctlfile", "(", "self", ")", ":", "#, rep=None):", "## A string to store ctl info", "ctl", "=", "[", "]", "## write the top header info", "ctl", ".", "append", "(", "\"seed = {}\"", ".", "format", "(", "self", ".", "params", ".", "seed", ")", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp.copy
Returns a copy of the bpp object with the same parameter settings but with the files.mcmcfiles and files.outfiles attributes cleared, and with a new 'name' attribute. Parameters ---------- name (str): A name for the new copied bpp object that will be used f...
ipyrad/analysis/bpp.py
def copy(self, name, load_existing_results=False): """ Returns a copy of the bpp object with the same parameter settings but with the files.mcmcfiles and files.outfiles attributes cleared, and with a new 'name' attribute. Parameters ---------- name (st...
def copy(self, name, load_existing_results=False): """ Returns a copy of the bpp object with the same parameter settings but with the files.mcmcfiles and files.outfiles attributes cleared, and with a new 'name' attribute. Parameters ---------- name (st...
[ "Returns", "a", "copy", "of", "the", "bpp", "object", "with", "the", "same", "parameter", "settings", "but", "with", "the", "files", ".", "mcmcfiles", "and", "files", ".", "outfiles", "attributes", "cleared", "and", "with", "a", "new", "name", "attribute", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L587-L625
[ "def", "copy", "(", "self", ",", "name", ",", "load_existing_results", "=", "False", ")", ":", "## make deepcopy of self.__dict__ but do not copy async objects", "subdict", "=", "{", "i", ":", "j", "for", "i", ",", "j", "in", "self", ".", "__dict__", ".", "ite...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Bpp.summarize_results
Prints a summarized table of results from replicate runs, or, if individual_result=True, then returns a list of separate dataframes for each replicate run.
ipyrad/analysis/bpp.py
def summarize_results(self, individual_results=False): """ Prints a summarized table of results from replicate runs, or, if individual_result=True, then returns a list of separate dataframes for each replicate run. """ ## return results depending on algorithm ...
def summarize_results(self, individual_results=False): """ Prints a summarized table of results from replicate runs, or, if individual_result=True, then returns a list of separate dataframes for each replicate run. """ ## return results depending on algorithm ...
[ "Prints", "a", "summarized", "table", "of", "results", "from", "replicate", "runs", "or", "if", "individual_result", "=", "True", "then", "returns", "a", "list", "of", "separate", "dataframes", "for", "each", "replicate", "run", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bpp.py#L629-L655
[ "def", "summarize_results", "(", "self", ",", "individual_results", "=", "False", ")", ":", "## return results depending on algorithm", "## algorithm 00", "if", "(", "not", "self", ".", "params", ".", "infer_delimit", ")", "&", "(", "not", "self", ".", "params", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
persistent_popen_align3
notes
ipyrad/assemble/cluster_across.py
def persistent_popen_align3(data, samples, chunk): """ notes """ ## data are already chunked, read in the whole thing with open(chunk, 'rb') as infile: clusts = infile.read().split("//\n//\n")[:-1] ## snames to ensure sorted order samples.sort(key=lambda x: x.name) snames = [sampl...
def persistent_popen_align3(data, samples, chunk): """ notes """ ## data are already chunked, read in the whole thing with open(chunk, 'rb') as infile: clusts = infile.read().split("//\n//\n")[:-1] ## snames to ensure sorted order samples.sort(key=lambda x: x.name) snames = [sampl...
[ "notes" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L46-L287
[ "def", "persistent_popen_align3", "(", "data", ",", "samples", ",", "chunk", ")", ":", "## data are already chunked, read in the whole thing", "with", "open", "(", "chunk", ",", "'rb'", ")", "as", "infile", ":", "clusts", "=", "infile", ".", "read", "(", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
multi_muscle_align
Sends the cluster bits to nprocessors for muscle alignment. They return with indel.h5 handles to be concatenated into a joint h5.
ipyrad/assemble/cluster_across.py
def multi_muscle_align(data, samples, ipyclient): """ Sends the cluster bits to nprocessors for muscle alignment. They return with indel.h5 handles to be concatenated into a joint h5. """ LOGGER.info("starting alignments") ## get client lbview = ipyclient.load_balanced_view() start = ti...
def multi_muscle_align(data, samples, ipyclient): """ Sends the cluster bits to nprocessors for muscle alignment. They return with indel.h5 handles to be concatenated into a joint h5. """ LOGGER.info("starting alignments") ## get client lbview = ipyclient.load_balanced_view() start = ti...
[ "Sends", "the", "cluster", "bits", "to", "nprocessors", "for", "muscle", "alignment", ".", "They", "return", "with", "indel", ".", "h5", "handles", "to", "be", "concatenated", "into", "a", "joint", "h5", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L294-L338
[ "def", "multi_muscle_align", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "LOGGER", ".", "info", "(", "\"starting alignments\"", ")", "## get client", "lbview", "=", "ipyclient", ".", "load_balanced_view", "(", ")", "start", "=", "time", ".", "time...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
concatclusts
concatenates sorted aligned cluster tmpfiles and removes them.
ipyrad/assemble/cluster_across.py
def concatclusts(outhandle, alignbits): """ concatenates sorted aligned cluster tmpfiles and removes them.""" with gzip.open(outhandle, 'wb') as out: for fname in alignbits: with open(fname) as infile: out.write(infile.read()+"//\n//\n")
def concatclusts(outhandle, alignbits): """ concatenates sorted aligned cluster tmpfiles and removes them.""" with gzip.open(outhandle, 'wb') as out: for fname in alignbits: with open(fname) as infile: out.write(infile.read()+"//\n//\n")
[ "concatenates", "sorted", "aligned", "cluster", "tmpfiles", "and", "removes", "them", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L342-L347
[ "def", "concatclusts", "(", "outhandle", ",", "alignbits", ")", ":", "with", "gzip", ".", "open", "(", "outhandle", ",", "'wb'", ")", "as", "out", ":", "for", "fname", "in", "alignbits", ":", "with", "open", "(", "fname", ")", "as", "infile", ":", "o...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_indels
Builds the indels array and catclust.gz file from the aligned clusters. Building catclust is very fast. Entering indels into h5 array is a bit slow but can probably be sped up. (todo). NOT currently parallelized.
ipyrad/assemble/cluster_across.py
def build_indels(data, samples, ipyclient): """ Builds the indels array and catclust.gz file from the aligned clusters. Building catclust is very fast. Entering indels into h5 array is a bit slow but can probably be sped up. (todo). NOT currently parallelized. """ ## progress bars lbview = ...
def build_indels(data, samples, ipyclient): """ Builds the indels array and catclust.gz file from the aligned clusters. Building catclust is very fast. Entering indels into h5 array is a bit slow but can probably be sped up. (todo). NOT currently parallelized. """ ## progress bars lbview = ...
[ "Builds", "the", "indels", "array", "and", "catclust", ".", "gz", "file", "from", "the", "aligned", "clusters", ".", "Building", "catclust", "is", "very", "fast", ".", "Entering", "indels", "into", "h5", "array", "is", "a", "bit", "slow", "but", "can", "...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L352-L408
[ "def", "build_indels", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "## progress bars", "lbview", "=", "ipyclient", ".", "load_balanced_view", "(", ")", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" database indels | {} | s6...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
sub_build_indels
sub func in `build_indels()`.
ipyrad/assemble/cluster_across.py
def sub_build_indels(data, samples): """ sub func in `build_indels()`. """ ## get file handles indelfiles = glob.glob(os.path.join(data.tmpdir, "indels_*.tmp.npy")) alignbits = glob.glob(os.path.join(data.tmpdir, "align_*.fa")) ## sort into input order by chunk names indelfiles.sort(key=lambda...
def sub_build_indels(data, samples): """ sub func in `build_indels()`. """ ## get file handles indelfiles = glob.glob(os.path.join(data.tmpdir, "indels_*.tmp.npy")) alignbits = glob.glob(os.path.join(data.tmpdir, "align_*.fa")) ## sort into input order by chunk names indelfiles.sort(key=lambda...
[ "sub", "func", "in", "build_indels", "()", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L412-L464
[ "def", "sub_build_indels", "(", "data", ",", "samples", ")", ":", "## get file handles", "indelfiles", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "data", ".", "tmpdir", ",", "\"indels_*.tmp.npy\"", ")", ")", "alignbits", "=", "glob...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
call_cluster
distributes 'cluster()' function to an ipyclient to make sure it runs on a high memory node.
ipyrad/assemble/cluster_across.py
def call_cluster(data, noreverse, ipyclient): """ distributes 'cluster()' function to an ipyclient to make sure it runs on a high memory node. """ ## Find host with the most engines, for now just using first. lbview = ipyclient.load_balanced_view() ## request engine data, skips busy engine...
def call_cluster(data, noreverse, ipyclient): """ distributes 'cluster()' function to an ipyclient to make sure it runs on a high memory node. """ ## Find host with the most engines, for now just using first. lbview = ipyclient.load_balanced_view() ## request engine data, skips busy engine...
[ "distributes", "cluster", "()", "function", "to", "an", "ipyclient", "to", "make", "sure", "it", "runs", "on", "a", "high", "memory", "node", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L468-L537
[ "def", "call_cluster", "(", "data", ",", "noreverse", ",", "ipyclient", ")", ":", "## Find host with the most engines, for now just using first.", "lbview", "=", "ipyclient", ".", "load_balanced_view", "(", ")", "## request engine data, skips busy engines. ", "asyncs", "="...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cluster
Calls vsearch for clustering across samples.
ipyrad/assemble/cluster_across.py
def cluster(data, noreverse, nthreads): """ Calls vsearch for clustering across samples. """ ## input and output file handles cathaplos = os.path.join(data.dirs.across, data.name+"_catshuf.tmp") uhaplos = os.path.join(data.dirs.across, data.name+".utemp") hhaplos = os.path.join(data.dirs.ac...
def cluster(data, noreverse, nthreads): """ Calls vsearch for clustering across samples. """ ## input and output file handles cathaplos = os.path.join(data.dirs.across, data.name+"_catshuf.tmp") uhaplos = os.path.join(data.dirs.across, data.name+".utemp") hhaplos = os.path.join(data.dirs.ac...
[ "Calls", "vsearch", "for", "clustering", "across", "samples", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L541-L636
[ "def", "cluster", "(", "data", ",", "noreverse", ",", "nthreads", ")", ":", "## input and output file handles", "cathaplos", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "across", ",", "data", ".", "name", "+", "\"_catshuf.tmp\"", ")...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_h5_array
Sets up all of the h5 arrays that we will fill. The catg array of prefiltered loci is 4-dimensional (Big), so one big array would overload memory, we need to fill it in slices. This will be done in multicat (singlecat) and fill_superseqs.
ipyrad/assemble/cluster_across.py
def build_h5_array(data, samples, nloci): """ Sets up all of the h5 arrays that we will fill. The catg array of prefiltered loci is 4-dimensional (Big), so one big array would overload memory, we need to fill it in slices. This will be done in multicat (singlecat) and fill_superseqs. """ ...
def build_h5_array(data, samples, nloci): """ Sets up all of the h5 arrays that we will fill. The catg array of prefiltered loci is 4-dimensional (Big), so one big array would overload memory, we need to fill it in slices. This will be done in multicat (singlecat) and fill_superseqs. """ ...
[ "Sets", "up", "all", "of", "the", "h5", "arrays", "that", "we", "will", "fill", ".", "The", "catg", "array", "of", "prefiltered", "loci", "is", "4", "-", "dimensional", "(", "Big", ")", "so", "one", "big", "array", "would", "overload", "memory", "we", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L642-L714
[ "def", "build_h5_array", "(", "data", ",", "samples", ",", "nloci", ")", ":", "## sort to ensure samples will be in alphabetical order, tho they should be.", "samples", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", ".", "name", ")", "## get maxlen dim", "ma...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
fill_dups_arr
fills the duplicates array from the multi_muscle_align tmp files
ipyrad/assemble/cluster_across.py
def fill_dups_arr(data): """ fills the duplicates array from the multi_muscle_align tmp files """ ## build the duplicates array duplefiles = glob.glob(os.path.join(data.tmpdir, "duples_*.tmp.npy")) duplefiles.sort(key=lambda x: int(x.rsplit("_", 1)[-1][:-8])) ## enter the duplicates filter ...
def fill_dups_arr(data): """ fills the duplicates array from the multi_muscle_align tmp files """ ## build the duplicates array duplefiles = glob.glob(os.path.join(data.tmpdir, "duples_*.tmp.npy")) duplefiles.sort(key=lambda x: int(x.rsplit("_", 1)[-1][:-8])) ## enter the duplicates filter ...
[ "fills", "the", "duplicates", "array", "from", "the", "multi_muscle_align", "tmp", "files" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L718-L742
[ "def", "fill_dups_arr", "(", "data", ")", ":", "## build the duplicates array", "duplefiles", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "data", ".", "tmpdir", ",", "\"duples_*.tmp.npy\"", ")", ")", "duplefiles", ".", "sort", "(", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_tmp_h5
build tmp h5 arrays that can return quick access for nloci
ipyrad/assemble/cluster_across.py
def build_tmp_h5(data, samples): """ build tmp h5 arrays that can return quick access for nloci""" ## get samples and names, sorted snames = [i.name for i in samples] snames.sort() ## Build an array for quickly indexing consens reads from catg files. ## save as a npy int binary file. uhandl...
def build_tmp_h5(data, samples): """ build tmp h5 arrays that can return quick access for nloci""" ## get samples and names, sorted snames = [i.name for i in samples] snames.sort() ## Build an array for quickly indexing consens reads from catg files. ## save as a npy int binary file. uhandl...
[ "build", "tmp", "h5", "arrays", "that", "can", "return", "quick", "access", "for", "nloci" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L746-L758
[ "def", "build_tmp_h5", "(", "data", ",", "samples", ")", ":", "## get samples and names, sorted", "snames", "=", "[", "i", ".", "name", "for", "i", "in", "samples", "]", "snames", ".", "sort", "(", ")", "## Build an array for quickly indexing consens reads from catg...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_nloci
return nloci from the tmp h5 arr
ipyrad/assemble/cluster_across.py
def get_nloci(data): """ return nloci from the tmp h5 arr""" bseeds = os.path.join(data.dirs.across, data.name+".tmparrs.h5") with h5py.File(bseeds) as io5: return io5["seedsarr"].shape[0]
def get_nloci(data): """ return nloci from the tmp h5 arr""" bseeds = os.path.join(data.dirs.across, data.name+".tmparrs.h5") with h5py.File(bseeds) as io5: return io5["seedsarr"].shape[0]
[ "return", "nloci", "from", "the", "tmp", "h5", "arr" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L762-L766
[ "def", "get_nloci", "(", "data", ")", ":", "bseeds", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "across", ",", "data", ".", "name", "+", "\".tmparrs.h5\"", ")", "with", "h5py", ".", "File", "(", "bseeds", ")", "as", "io5", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_seeds_and_hits
builds a seeds and hits (uarr) array of ints from the utemp.sort file. Saves outputs to files ...
ipyrad/assemble/cluster_across.py
def get_seeds_and_hits(uhandle, bseeds, snames): """ builds a seeds and hits (uarr) array of ints from the utemp.sort file. Saves outputs to files ... """ ## Get max name length. Allow for trailing _ + up to 9 digits ## of numbers of loci (an astronomical number of unique loci) maxlen_names ...
def get_seeds_and_hits(uhandle, bseeds, snames): """ builds a seeds and hits (uarr) array of ints from the utemp.sort file. Saves outputs to files ... """ ## Get max name length. Allow for trailing _ + up to 9 digits ## of numbers of loci (an astronomical number of unique loci) maxlen_names ...
[ "builds", "a", "seeds", "and", "hits", "(", "uarr", ")", "array", "of", "ints", "from", "the", "utemp", ".", "sort", "file", ".", "Saves", "outputs", "to", "files", "..." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L770-L811
[ "def", "get_seeds_and_hits", "(", "uhandle", ",", "bseeds", ",", "snames", ")", ":", "## Get max name length. Allow for trailing _ + up to 9 digits", "## of numbers of loci (an astronomical number of unique loci)", "maxlen_names", "=", "np", ".", "max", "(", "map", "(", "len"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
new_multicat
Calls 'singlecat()' for all samples to build index files.
ipyrad/assemble/cluster_across.py
def new_multicat(data, samples, ipyclient): """ Calls 'singlecat()' for all samples to build index files. """ ## track progress LOGGER.info("in the multicat") start = time.time() printstr = " indexing clusters | {} | s6 |" ## Build the large h5 array. This will write a new HDF5 fil...
def new_multicat(data, samples, ipyclient): """ Calls 'singlecat()' for all samples to build index files. """ ## track progress LOGGER.info("in the multicat") start = time.time() printstr = " indexing clusters | {} | s6 |" ## Build the large h5 array. This will write a new HDF5 fil...
[ "Calls", "singlecat", "()", "for", "all", "samples", "to", "build", "index", "files", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L816-L930
[ "def", "new_multicat", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "## track progress", "LOGGER", ".", "info", "(", "\"in the multicat\"", ")", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" indexing clusters | {} | s6 |\"", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
multicat
Runs singlecat and cleanup jobs for each sample. For each sample this fills its own hdf5 array with catg data & indels. This is messy, could use simplifiying.
ipyrad/assemble/cluster_across.py
def multicat(data, samples, ipyclient): """ Runs singlecat and cleanup jobs for each sample. For each sample this fills its own hdf5 array with catg data & indels. This is messy, could use simplifiying. """ ## progress ticker start = time.time() printstr = " indexing clusters | {} |...
def multicat(data, samples, ipyclient): """ Runs singlecat and cleanup jobs for each sample. For each sample this fills its own hdf5 array with catg data & indels. This is messy, could use simplifiying. """ ## progress ticker start = time.time() printstr = " indexing clusters | {} |...
[ "Runs", "singlecat", "and", "cleanup", "jobs", "for", "each", "sample", ".", "For", "each", "sample", "this", "fills", "its", "own", "hdf5", "array", "with", "catg", "data", "&", "indels", ".", "This", "is", "messy", "could", "use", "simplifiying", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L934-L1062
[ "def", "multicat", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "## progress ticker", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" indexing clusters | {} | s6 |\"", "elapsed", "=", "datetime", ".", "timedelta", "(", "seconds"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
singlecat
Orders catg data for each sample into the final locus order. This allows all of the individual catgs to simply be combined later. They are also in the same order as the indels array, so indels are inserted from the indel array that is passed in.
ipyrad/assemble/cluster_across.py
def singlecat(data, sample, bseeds, sidx, nloci): """ Orders catg data for each sample into the final locus order. This allows all of the individual catgs to simply be combined later. They are also in the same order as the indels array, so indels are inserted from the indel array that is passed in. ...
def singlecat(data, sample, bseeds, sidx, nloci): """ Orders catg data for each sample into the final locus order. This allows all of the individual catgs to simply be combined later. They are also in the same order as the indels array, so indels are inserted from the indel array that is passed in. ...
[ "Orders", "catg", "data", "for", "each", "sample", "into", "the", "final", "locus", "order", ".", "This", "allows", "all", "of", "the", "individual", "catgs", "to", "simply", "be", "combined", "later", ".", "They", "are", "also", "in", "the", "same", "or...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1067-L1140
[ "def", "singlecat", "(", "data", ",", "sample", ",", "bseeds", ",", "sidx", ",", "nloci", ")", ":", "LOGGER", ".", "info", "(", "\"in single cat here\"", ")", "## enter ref data?", "isref", "=", "'reference'", "in", "data", ".", "paramsdict", "[", "\"assembl...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_to_fullarr
writes arrays to h5 disk
ipyrad/assemble/cluster_across.py
def write_to_fullarr(data, sample, sidx): """ writes arrays to h5 disk """ ## enter ref data? #isref = 'reference' in data.paramsdict["assembly_method"] LOGGER.info("writing fullarr %s %s", sample.name, sidx) ## save big arrays to disk temporarily with h5py.File(data.clust_database, 'r+') as i...
def write_to_fullarr(data, sample, sidx): """ writes arrays to h5 disk """ ## enter ref data? #isref = 'reference' in data.paramsdict["assembly_method"] LOGGER.info("writing fullarr %s %s", sample.name, sidx) ## save big arrays to disk temporarily with h5py.File(data.clust_database, 'r+') as i...
[ "writes", "arrays", "to", "h5", "disk" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1150-L1176
[ "def", "write_to_fullarr", "(", "data", ",", "sample", ",", "sidx", ")", ":", "## enter ref data?", "#isref = 'reference' in data.paramsdict[\"assembly_method\"]", "LOGGER", ".", "info", "(", "\"writing fullarr %s %s\"", ",", "sample", ".", "name", ",", "sidx", ")", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
dask_chroms
A dask relay function to fill chroms for all samples
ipyrad/assemble/cluster_across.py
def dask_chroms(data, samples): """ A dask relay function to fill chroms for all samples """ ## example concatenating with dask h5s = [os.path.join(data.dirs.across, s.name+".tmp.h5") for s in samples] handles = [h5py.File(i) for i in h5s] dsets = [i['/ichrom'] for i in handles] arr...
def dask_chroms(data, samples): """ A dask relay function to fill chroms for all samples """ ## example concatenating with dask h5s = [os.path.join(data.dirs.across, s.name+".tmp.h5") for s in samples] handles = [h5py.File(i) for i in h5s] dsets = [i['/ichrom'] for i in handles] arr...
[ "A", "dask", "relay", "function", "to", "fill", "chroms", "for", "all", "samples" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1180-L1206
[ "def", "dask_chroms", "(", "data", ",", "samples", ")", ":", "## example concatenating with dask", "h5s", "=", "[", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "across", ",", "s", ".", "name", "+", "\".tmp.h5\"", ")", "for", "s", "in...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
inserted_indels
inserts indels into the catg array
ipyrad/assemble/cluster_across.py
def inserted_indels(indels, ocatg): """ inserts indels into the catg array """ ## return copy with indels inserted newcatg = np.zeros(ocatg.shape, dtype=np.uint32) ## iterate over loci and make extensions for indels for iloc in xrange(ocatg.shape[0]): ## get indels indices i...
def inserted_indels(indels, ocatg): """ inserts indels into the catg array """ ## return copy with indels inserted newcatg = np.zeros(ocatg.shape, dtype=np.uint32) ## iterate over loci and make extensions for indels for iloc in xrange(ocatg.shape[0]): ## get indels indices i...
[ "inserts", "indels", "into", "the", "catg", "array" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1214-L1237
[ "def", "inserted_indels", "(", "indels", ",", "ocatg", ")", ":", "## return copy with indels inserted", "newcatg", "=", "np", ".", "zeros", "(", "ocatg", ".", "shape", ",", "dtype", "=", "np", ".", "uint32", ")", "## iterate over loci and make extensions for indels"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
fill_superseqs
Fills the superseqs array with seq data from cat.clust and fill the edges array with information about paired split locations.
ipyrad/assemble/cluster_across.py
def fill_superseqs(data, samples): """ Fills the superseqs array with seq data from cat.clust and fill the edges array with information about paired split locations. """ ## load super to get edges io5 = h5py.File(data.clust_database, 'r+') superseqs = io5["seqs"] splits = io5["splits"] ...
def fill_superseqs(data, samples): """ Fills the superseqs array with seq data from cat.clust and fill the edges array with information about paired split locations. """ ## load super to get edges io5 = h5py.File(data.clust_database, 'r+') superseqs = io5["seqs"] splits = io5["splits"] ...
[ "Fills", "the", "superseqs", "array", "with", "seq", "data", "from", "cat", ".", "clust", "and", "fill", "the", "edges", "array", "with", "information", "about", "paired", "split", "locations", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1241-L1341
[ "def", "fill_superseqs", "(", "data", ",", "samples", ")", ":", "## load super to get edges", "io5", "=", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r+'", ")", "superseqs", "=", "io5", "[", "\"seqs\"", "]", "splits", "=", "io5", "[", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
count_seeds
uses bash commands to quickly count N seeds from utemp file
ipyrad/assemble/cluster_across.py
def count_seeds(usort): """ uses bash commands to quickly count N seeds from utemp file """ with open(usort, 'r') as insort: cmd1 = ["cut", "-f", "2"] cmd2 = ["uniq"] cmd3 = ["wc"] proc1 = sps.Popen(cmd1, stdin=insort, stdout=sps.PIPE, close_fds=True) proc2 = sps....
def count_seeds(usort): """ uses bash commands to quickly count N seeds from utemp file """ with open(usort, 'r') as insort: cmd1 = ["cut", "-f", "2"] cmd2 = ["uniq"] cmd3 = ["wc"] proc1 = sps.Popen(cmd1, stdin=insort, stdout=sps.PIPE, close_fds=True) proc2 = sps....
[ "uses", "bash", "commands", "to", "quickly", "count", "N", "seeds", "from", "utemp", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1348-L1364
[ "def", "count_seeds", "(", "usort", ")", ":", "with", "open", "(", "usort", ",", "'r'", ")", "as", "insort", ":", "cmd1", "=", "[", "\"cut\"", ",", "\"-f\"", ",", "\"2\"", "]", "cmd2", "=", "[", "\"uniq\"", "]", "cmd3", "=", "[", "\"wc\"", "]", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
sort_seeds
sort seeds from cluster results
ipyrad/assemble/cluster_across.py
def sort_seeds(uhandle, usort): """ sort seeds from cluster results""" cmd = ["sort", "-k", "2", uhandle, "-o", usort] proc = sps.Popen(cmd, close_fds=True) proc.communicate()
def sort_seeds(uhandle, usort): """ sort seeds from cluster results""" cmd = ["sort", "-k", "2", uhandle, "-o", usort] proc = sps.Popen(cmd, close_fds=True) proc.communicate()
[ "sort", "seeds", "from", "cluster", "results" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1368-L1372
[ "def", "sort_seeds", "(", "uhandle", ",", "usort", ")", ":", "cmd", "=", "[", "\"sort\"", ",", "\"-k\"", ",", "\"2\"", ",", "uhandle", ",", "\"-o\"", ",", "usort", "]", "proc", "=", "sps", ".", "Popen", "(", "cmd", ",", "close_fds", "=", "True", ")...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_clustbits
Reconstitutes clusters from .utemp and htemp files and writes them to chunked files for aligning in muscle.
ipyrad/assemble/cluster_across.py
def build_clustbits(data, ipyclient, force): """ Reconstitutes clusters from .utemp and htemp files and writes them to chunked files for aligning in muscle. """ ## If you run this step then we clear all tmp .fa and .indel.h5 files if os.path.exists(data.tmpdir): shutil.rmtree(data.tmpdi...
def build_clustbits(data, ipyclient, force): """ Reconstitutes clusters from .utemp and htemp files and writes them to chunked files for aligning in muscle. """ ## If you run this step then we clear all tmp .fa and .indel.h5 files if os.path.exists(data.tmpdir): shutil.rmtree(data.tmpdi...
[ "Reconstitutes", "clusters", "from", ".", "utemp", "and", "htemp", "files", "and", "writes", "them", "to", "chunked", "files", "for", "aligning", "in", "muscle", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1376-L1447
[ "def", "build_clustbits", "(", "data", ",", "ipyclient", ",", "force", ")", ":", "## If you run this step then we clear all tmp .fa and .indel.h5 files", "if", "os", ".", "path", ".", "exists", "(", "data", ".", "tmpdir", ")", ":", "shutil", ".", "rmtree", "(", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
sub_build_clustbits
A subfunction of build_clustbits to allow progress tracking. This func splits the unaligned clusters into bits for aligning on separate cores.
ipyrad/assemble/cluster_across.py
def sub_build_clustbits(data, usort, nseeds): """ A subfunction of build_clustbits to allow progress tracking. This func splits the unaligned clusters into bits for aligning on separate cores. """ ## load FULL concat fasta file into a dict. This could cause RAM issues. ## this file has iupac co...
def sub_build_clustbits(data, usort, nseeds): """ A subfunction of build_clustbits to allow progress tracking. This func splits the unaligned clusters into bits for aligning on separate cores. """ ## load FULL concat fasta file into a dict. This could cause RAM issues. ## this file has iupac co...
[ "A", "subfunction", "of", "build_clustbits", "to", "allow", "progress", "tracking", ".", "This", "func", "splits", "the", "unaligned", "clusters", "into", "bits", "for", "aligning", "on", "separate", "cores", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1450-L1539
[ "def", "sub_build_clustbits", "(", "data", ",", "usort", ",", "nseeds", ")", ":", "## load FULL concat fasta file into a dict. This could cause RAM issues.", "## this file has iupac codes in it, not ambigs resolved, and is gzipped.", "LOGGER", ".", "info", "(", "\"loading full _catco...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_input_file
[This is run on an ipengine] Make a concatenated consens file with sampled alleles (no RSWYMK/rswymk). Orders reads by length and shuffles randomly within length classes
ipyrad/assemble/cluster_across.py
def build_input_file(data, samples, randomseed): """ [This is run on an ipengine] Make a concatenated consens file with sampled alleles (no RSWYMK/rswymk). Orders reads by length and shuffles randomly within length classes """ ## get all of the consens handles for samples that have consens read...
def build_input_file(data, samples, randomseed): """ [This is run on an ipengine] Make a concatenated consens file with sampled alleles (no RSWYMK/rswymk). Orders reads by length and shuffles randomly within length classes """ ## get all of the consens handles for samples that have consens read...
[ "[", "This", "is", "run", "on", "an", "ipengine", "]", "Make", "a", "concatenated", "consens", "file", "with", "sampled", "alleles", "(", "no", "RSWYMK", "/", "rswymk", ")", ".", "Orders", "reads", "by", "length", "and", "shuffles", "randomly", "within", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1543-L1643
[ "def", "build_input_file", "(", "data", ",", "samples", ",", "randomseed", ")", ":", "## get all of the consens handles for samples that have consens reads", "## this is better than using sample.files.consens for selecting files", "## b/c if they were moved we only have to edit data.dirs.con...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
clean_and_build_concat
STEP 6-1: Clears dirs and databases and calls 'build_input_file()'
ipyrad/assemble/cluster_across.py
def clean_and_build_concat(data, samples, randomseed, ipyclient): """ STEP 6-1: Clears dirs and databases and calls 'build_input_file()' """ ## but check for new clust database name if this is a new branch cleanup_tempfiles(data) catclust = os.path.join(data.dirs.across, data.name+"_catclus...
def clean_and_build_concat(data, samples, randomseed, ipyclient): """ STEP 6-1: Clears dirs and databases and calls 'build_input_file()' """ ## but check for new clust database name if this is a new branch cleanup_tempfiles(data) catclust = os.path.join(data.dirs.across, data.name+"_catclus...
[ "STEP", "6", "-", "1", ":", "Clears", "dirs", "and", "databases", "and", "calls", "build_input_file", "()" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1647-L1678
[ "def", "clean_and_build_concat", "(", "data", ",", "samples", ",", "randomseed", ",", "ipyclient", ")", ":", "## but check for new clust database name if this is a new branch", "cleanup_tempfiles", "(", "data", ")", "catclust", "=", "os", ".", "path", ".", "join", "("...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run
For step 6 the run function is sub divided a bit so that users with really difficult assemblies can possibly interrupt and restart the step from a checkpoint. Substeps that are run: 1. build concat consens file, 2. cluster all consens, 3. split clusters into bits, 4. align bits, ...
ipyrad/assemble/cluster_across.py
def run(data, samples, noreverse, force, randomseed, ipyclient, **kwargs): """ For step 6 the run function is sub divided a bit so that users with really difficult assemblies can possibly interrupt and restart the step from a checkpoint. Substeps that are run: 1. build concat consens file, ...
def run(data, samples, noreverse, force, randomseed, ipyclient, **kwargs): """ For step 6 the run function is sub divided a bit so that users with really difficult assemblies can possibly interrupt and restart the step from a checkpoint. Substeps that are run: 1. build concat consens file, ...
[ "For", "step", "6", "the", "run", "function", "is", "sub", "divided", "a", "bit", "so", "that", "users", "with", "really", "difficult", "assemblies", "can", "possibly", "interrupt", "and", "restart", "the", "step", "from", "a", "checkpoint", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1682-L1805
[ "def", "run", "(", "data", ",", "samples", ",", "noreverse", ",", "force", ",", "randomseed", ",", "ipyclient", ",", "*", "*", "kwargs", ")", ":", "## if force then set checkpoint to zero and run all substeps for just", "## the user specified steps. ", "if", "force", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cleanup_tempfiles
Function to remove older files. This is called either in substep 1 or after the final substep so that tempfiles are retained for restarting interrupted jobs until we're sure they're no longer needed.
ipyrad/assemble/cluster_across.py
def cleanup_tempfiles(data): """ Function to remove older files. This is called either in substep 1 or after the final substep so that tempfiles are retained for restarting interrupted jobs until we're sure they're no longer needed. """ ## remove align-related tmp files tmps1 = glob.glob(...
def cleanup_tempfiles(data): """ Function to remove older files. This is called either in substep 1 or after the final substep so that tempfiles are retained for restarting interrupted jobs until we're sure they're no longer needed. """ ## remove align-related tmp files tmps1 = glob.glob(...
[ "Function", "to", "remove", "older", "files", ".", "This", "is", "called", "either", "in", "substep", "1", "or", "after", "the", "final", "substep", "so", "that", "tempfiles", "are", "retained", "for", "restarting", "interrupted", "jobs", "until", "we", "re"...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1809-L1842
[ "def", "cleanup_tempfiles", "(", "data", ")", ":", "## remove align-related tmp files", "tmps1", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "data", ".", "tmpdir", ",", "\"*.fa\"", ")", ")", "tmps2", "=", "glob", ".", "glob", "(",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
assembly_cleanup
cleanup for assembly object
ipyrad/assemble/rawedit.py
def assembly_cleanup(data): """ cleanup for assembly object """ ## build s2 results data frame data.stats_dfs.s2 = data._build_stat("s2") data.stats_files.s2 = os.path.join(data.dirs.edits, 's2_rawedit_stats.txt') ## write stats for all samples with io.open(data.stats_files.s2, 'w', encoding='...
def assembly_cleanup(data): """ cleanup for assembly object """ ## build s2 results data frame data.stats_dfs.s2 = data._build_stat("s2") data.stats_files.s2 = os.path.join(data.dirs.edits, 's2_rawedit_stats.txt') ## write stats for all samples with io.open(data.stats_files.s2, 'w', encoding='...
[ "cleanup", "for", "assembly", "object" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L36-L45
[ "def", "assembly_cleanup", "(", "data", ")", ":", "## build s2 results data frame", "data", ".", "stats_dfs", ".", "s2", "=", "data", ".", "_build_stat", "(", "\"s2\"", ")", "data", ".", "stats_files", ".", "s2", "=", "os", ".", "path", ".", "join", "(", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
parse_single_results
parse results from cutadapt into sample data
ipyrad/assemble/rawedit.py
def parse_single_results(data, sample, res1): """ parse results from cutadapt into sample data""" ## set default values #sample.stats_dfs.s2["reads_raw"] = 0 sample.stats_dfs.s2["trim_adapter_bp_read1"] = 0 sample.stats_dfs.s2["trim_quality_bp_read1"] = 0 sample.stats_dfs.s2["reads_filtered_by...
def parse_single_results(data, sample, res1): """ parse results from cutadapt into sample data""" ## set default values #sample.stats_dfs.s2["reads_raw"] = 0 sample.stats_dfs.s2["trim_adapter_bp_read1"] = 0 sample.stats_dfs.s2["trim_quality_bp_read1"] = 0 sample.stats_dfs.s2["reads_filtered_by...
[ "parse", "results", "from", "cutadapt", "into", "sample", "data" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L49-L98
[ "def", "parse_single_results", "(", "data", ",", "sample", ",", "res1", ")", ":", "## set default values ", "#sample.stats_dfs.s2[\"reads_raw\"] = 0", "sample", ".", "stats_dfs", ".", "s2", "[", "\"trim_adapter_bp_read1\"", "]", "=", "0", "sample", ".", "stats_dfs", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
parse_pair_results
parse results from cutadapt for paired data
ipyrad/assemble/rawedit.py
def parse_pair_results(data, sample, res): """ parse results from cutadapt for paired data""" LOGGER.info("in parse pair mod results\n%s", res) ## set default values sample.stats_dfs.s2["trim_adapter_bp_read1"] = 0 sample.stats_dfs.s2["trim_adapter_bp_read2"] = 0 sample.stats_dfs.s2["trim...
def parse_pair_results(data, sample, res): """ parse results from cutadapt for paired data""" LOGGER.info("in parse pair mod results\n%s", res) ## set default values sample.stats_dfs.s2["trim_adapter_bp_read1"] = 0 sample.stats_dfs.s2["trim_adapter_bp_read2"] = 0 sample.stats_dfs.s2["trim...
[ "parse", "results", "from", "cutadapt", "for", "paired", "data" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L102-L167
[ "def", "parse_pair_results", "(", "data", ",", "sample", ",", "res", ")", ":", "LOGGER", ".", "info", "(", "\"in parse pair mod results\\n%s\"", ",", "res", ")", "## set default values", "sample", ".", "stats_dfs", ".", "s2", "[", "\"trim_adapter_bp_read1\"", "]",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cutadaptit_single
Applies quality and adapter filters to reads using cutadapt. If the ipyrad filter param is set to 0 then it only filters to hard trim edges and uses mintrimlen. If filter=1, we add quality filters. If filter=2 we add adapter filters.
ipyrad/assemble/rawedit.py
def cutadaptit_single(data, sample): """ Applies quality and adapter filters to reads using cutadapt. If the ipyrad filter param is set to 0 then it only filters to hard trim edges and uses mintrimlen. If filter=1, we add quality filters. If filter=2 we add adapter filters. """ sname = sa...
def cutadaptit_single(data, sample): """ Applies quality and adapter filters to reads using cutadapt. If the ipyrad filter param is set to 0 then it only filters to hard trim edges and uses mintrimlen. If filter=1, we add quality filters. If filter=2 we add adapter filters. """ sname = sa...
[ "Applies", "quality", "and", "adapter", "filters", "to", "reads", "using", "cutadapt", ".", "If", "the", "ipyrad", "filter", "param", "is", "set", "to", "0", "then", "it", "only", "filters", "to", "hard", "trim", "edges", "and", "uses", "mintrimlen", ".", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L171-L273
[ "def", "cutadaptit_single", "(", "data", ",", "sample", ")", ":", "sname", "=", "sample", ".", "name", "## if (GBS, ddRAD) we look for the second cut site + adapter. For single-end", "## data we don't bother trying to remove the second barcode since it's not", "## as critical as with P...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cutadaptit_pairs
Applies trim & filters to pairs, including adapter detection. If we have barcode information then we use it to trim reversecut+bcode+adapter from reverse read, if not then we have to apply a more general cut to make sure we remove the barcode, this uses wildcards and so will have more false positives...
ipyrad/assemble/rawedit.py
def cutadaptit_pairs(data, sample): """ Applies trim & filters to pairs, including adapter detection. If we have barcode information then we use it to trim reversecut+bcode+adapter from reverse read, if not then we have to apply a more general cut to make sure we remove the barcode, this uses wild...
def cutadaptit_pairs(data, sample): """ Applies trim & filters to pairs, including adapter detection. If we have barcode information then we use it to trim reversecut+bcode+adapter from reverse read, if not then we have to apply a more general cut to make sure we remove the barcode, this uses wild...
[ "Applies", "trim", "&", "filters", "to", "pairs", "including", "adapter", "detection", ".", "If", "we", "have", "barcode", "information", "then", "we", "use", "it", "to", "trim", "reversecut", "+", "bcode", "+", "adapter", "from", "reverse", "read", "if", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L278-L466
[ "def", "cutadaptit_pairs", "(", "data", ",", "sample", ")", ":", "LOGGER", ".", "debug", "(", "\"Entering cutadaptit_pairs - {}\"", ".", "format", "(", "sample", ".", "name", ")", ")", "sname", "=", "sample", ".", "name", "## applied to read pairs", "#trim_r1 = ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run2
Filter for samples that are already finished with this step, allow others to run, pass them to parallel client function to filter with cutadapt.
ipyrad/assemble/rawedit.py
def run2(data, samples, force, ipyclient): """ Filter for samples that are already finished with this step, allow others to run, pass them to parallel client function to filter with cutadapt. """ ## create output directories data.dirs.edits = os.path.join(os.path.realpath( ...
def run2(data, samples, force, ipyclient): """ Filter for samples that are already finished with this step, allow others to run, pass them to parallel client function to filter with cutadapt. """ ## create output directories data.dirs.edits = os.path.join(os.path.realpath( ...
[ "Filter", "for", "samples", "that", "are", "already", "finished", "with", "this", "step", "allow", "others", "to", "run", "pass", "them", "to", "parallel", "client", "function", "to", "filter", "with", "cutadapt", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L470-L507
[ "def", "run2", "(", "data", ",", "samples", ",", "force", ",", "ipyclient", ")", ":", "## create output directories ", "data", ".", "dirs", ".", "edits", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "realpath", "(", "data", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
concat_reads
concatenate if multiple input files for a single samples
ipyrad/assemble/rawedit.py
def concat_reads(data, subsamples, ipyclient): """ concatenate if multiple input files for a single samples """ ## concatenate reads if they come from merged assemblies. if any([len(i.files.fastqs) > 1 for i in subsamples]): ## run on single engine for now start = time.time() prints...
def concat_reads(data, subsamples, ipyclient): """ concatenate if multiple input files for a single samples """ ## concatenate reads if they come from merged assemblies. if any([len(i.files.fastqs) > 1 for i in subsamples]): ## run on single engine for now start = time.time() prints...
[ "concatenate", "if", "multiple", "input", "files", "for", "a", "single", "samples" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L525-L565
[ "def", "concat_reads", "(", "data", ",", "subsamples", ",", "ipyclient", ")", ":", "## concatenate reads if they come from merged assemblies.", "if", "any", "(", "[", "len", "(", "i", ".", "files", ".", "fastqs", ")", ">", "1", "for", "i", "in", "subsamples", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run_cutadapt
sends fastq files to cutadapt
ipyrad/assemble/rawedit.py
def run_cutadapt(data, subsamples, lbview): """ sends fastq files to cutadapt """ ## choose cutadapt function based on datatype start = time.time() printstr = " processing reads | {} | s2 |" finished = 0 rawedits = {} ## sort subsamples so that the biggest files get submitted f...
def run_cutadapt(data, subsamples, lbview): """ sends fastq files to cutadapt """ ## choose cutadapt function based on datatype start = time.time() printstr = " processing reads | {} | s2 |" finished = 0 rawedits = {} ## sort subsamples so that the biggest files get submitted f...
[ "sends", "fastq", "files", "to", "cutadapt" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L569-L613
[ "def", "run_cutadapt", "(", "data", ",", "subsamples", ",", "lbview", ")", ":", "## choose cutadapt function based on datatype", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" processing reads | {} | s2 |\"", "finished", "=", "0", "rawedits", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
choose_samples
filter out samples that are already done with this step, unless force
ipyrad/assemble/rawedit.py
def choose_samples(samples, force): """ filter out samples that are already done with this step, unless force""" ## hold samples that pass subsamples = [] ## filter the samples again if not force: for sample in samples: if sample.stats.state >= 2: print("""\ ...
def choose_samples(samples, force): """ filter out samples that are already done with this step, unless force""" ## hold samples that pass subsamples = [] ## filter the samples again if not force: for sample in samples: if sample.stats.state >= 2: print("""\ ...
[ "filter", "out", "samples", "that", "are", "already", "done", "with", "this", "step", "unless", "force" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L617-L644
[ "def", "choose_samples", "(", "samples", ",", "force", ")", ":", "## hold samples that pass", "subsamples", "=", "[", "]", "## filter the samples again", "if", "not", "force", ":", "for", "sample", "in", "samples", ":", "if", "sample", ".", "stats", ".", "stat...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
concat_multiple_inputs
If multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding.
ipyrad/assemble/rawedit.py
def concat_multiple_inputs(data, sample): """ If multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding. """ ## if more than one tuple in fastq list if len(sample.files.fastqs) > 1: ## create a cat command to append them all (d...
def concat_multiple_inputs(data, sample): """ If multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding. """ ## if more than one tuple in fastq list if len(sample.files.fastqs) > 1: ## create a cat command to append them all (d...
[ "If", "multiple", "fastq", "files", "were", "appended", "into", "the", "list", "of", "fastqs", "for", "samples", "then", "we", "merge", "them", "here", "before", "proceeding", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L648-L686
[ "def", "concat_multiple_inputs", "(", "data", ",", "sample", ")", ":", "## if more than one tuple in fastq list", "if", "len", "(", "sample", ".", "files", ".", "fastqs", ")", ">", "1", ":", "## create a cat command to append them all (doesn't matter if they ", "## are gz...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make
Convert vcf from step6 to .loci format to facilitate downstream format conversion
ipyrad/file_conversion/vcf2loci.py
def make( data, samples ): """ Convert vcf from step6 to .loci format to facilitate downstream format conversion """ invcffile = os.path.join( data.dirs.consens, data.name+".vcf" ) outlocifile = os.path.join( data.dirs.outfiles, data.name+".loci" ) importvcf( invcffile, outlocifile )
def make( data, samples ): """ Convert vcf from step6 to .loci format to facilitate downstream format conversion """ invcffile = os.path.join( data.dirs.consens, data.name+".vcf" ) outlocifile = os.path.join( data.dirs.outfiles, data.name+".loci" ) importvcf( invcffile, outlocifile )
[ "Convert", "vcf", "from", "step6", "to", ".", "loci", "format", "to", "facilitate", "downstream", "format", "conversion" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/vcf2loci.py#L8-L13
[ "def", "make", "(", "data", ",", "samples", ")", ":", "invcffile", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "consens", ",", "data", ".", "name", "+", "\".vcf\"", ")", "outlocifile", "=", "os", ".", "path", ".", "join", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
importvcf
Function for importing a vcf file into loci format. Arguments are the input vcffile and the loci file to write out.
ipyrad/file_conversion/vcf2loci.py
def importvcf( vcffile, locifile ): """ Function for importing a vcf file into loci format. Arguments are the input vcffile and the loci file to write out. """ try: ## Get names of all individuals in the vcf with open( invcffile, 'r' ) as invcf: for line in invcf: ...
def importvcf( vcffile, locifile ): """ Function for importing a vcf file into loci format. Arguments are the input vcffile and the loci file to write out. """ try: ## Get names of all individuals in the vcf with open( invcffile, 'r' ) as invcf: for line in invcf: ...
[ "Function", "for", "importing", "a", "vcf", "file", "into", "loci", "format", ".", "Arguments", "are", "the", "input", "vcffile", "and", "the", "loci", "file", "to", "write", "out", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/vcf2loci.py#L16-L35
[ "def", "importvcf", "(", "vcffile", ",", "locifile", ")", ":", "try", ":", "## Get names of all individuals in the vcf", "with", "open", "(", "invcffile", ",", "'r'", ")", "as", "invcf", ":", "for", "line", "in", "invcf", ":", "if", "line", ".", "split", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_targets
A function to find 2 engines per hostname on the ipyclient. We'll assume that the CPUs are hyperthreaded, which is why we grab two. If they are not then no foul. Two multi-threaded jobs will be run on each of the 2 engines per host.
ipyrad/analysis/tetrad.py
def get_targets(ipyclient): """ A function to find 2 engines per hostname on the ipyclient. We'll assume that the CPUs are hyperthreaded, which is why we grab two. If they are not then no foul. Two multi-threaded jobs will be run on each of the 2 engines per host. """ ## fill hosts with asy...
def get_targets(ipyclient): """ A function to find 2 engines per hostname on the ipyclient. We'll assume that the CPUs are hyperthreaded, which is why we grab two. If they are not then no foul. Two multi-threaded jobs will be run on each of the 2 engines per host. """ ## fill hosts with asy...
[ "A", "function", "to", "find", "2", "engines", "per", "hostname", "on", "the", "ipyclient", ".", "We", "ll", "assume", "that", "the", "CPUs", "are", "hyperthreaded", "which", "is", "why", "we", "grab", "two", ".", "If", "they", "are", "not", "then", "n...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1178-L1200
[ "def", "get_targets", "(", "ipyclient", ")", ":", "## fill hosts with async[gethostname] ", "hosts", "=", "[", "]", "for", "eid", "in", "ipyclient", ".", "ids", ":", "engine", "=", "ipyclient", "[", "eid", "]", "if", "not", "engine", ".", "outstanding", ":",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
compute_tree_stats
compute stats for stats file and NHX tree features
ipyrad/analysis/tetrad.py
def compute_tree_stats(self, ipyclient): """ compute stats for stats file and NHX tree features """ ## get name indices names = self.samples ## get majority rule consensus tree of weighted Q bootstrap trees if self.params.nboots: ## Tree object fulltre = ete3.Tree...
def compute_tree_stats(self, ipyclient): """ compute stats for stats file and NHX tree features """ ## get name indices names = self.samples ## get majority rule consensus tree of weighted Q bootstrap trees if self.params.nboots: ## Tree object fulltre = ete3.Tree...
[ "compute", "stats", "for", "stats", "file", "and", "NHX", "tree", "features" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1207-L1285
[ "def", "compute_tree_stats", "(", "self", ",", "ipyclient", ")", ":", "## get name indices", "names", "=", "self", ".", "samples", "## get majority rule consensus tree of weighted Q bootstrap trees", "if", "self", ".", "params", ".", "nboots", ":", "## Tree object", "fu...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
random_combination
Random selection from itertools.combinations(iterable, r). Use this if not sampling all possible quartets.
ipyrad/analysis/tetrad.py
def random_combination(iterable, nquartets): """ Random selection from itertools.combinations(iterable, r). Use this if not sampling all possible quartets. """ pool = tuple(iterable) size = len(pool) indices = random.sample(xrange(size), nquartets) return tuple(pool[i] for i in indices)
def random_combination(iterable, nquartets): """ Random selection from itertools.combinations(iterable, r). Use this if not sampling all possible quartets. """ pool = tuple(iterable) size = len(pool) indices = random.sample(xrange(size), nquartets) return tuple(pool[i] for i in indices)
[ "Random", "selection", "from", "itertools", ".", "combinations", "(", "iterable", "r", ")", ".", "Use", "this", "if", "not", "sampling", "all", "possible", "quartets", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1297-L1305
[ "def", "random_combination", "(", "iterable", ",", "nquartets", ")", ":", "pool", "=", "tuple", "(", "iterable", ")", "size", "=", "len", "(", "pool", ")", "indices", "=", "random", ".", "sample", "(", "xrange", "(", "size", ")", ",", "nquartets", ")",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
random_product
random sampler for equal_splits func
ipyrad/analysis/tetrad.py
def random_product(iter1, iter2): """ random sampler for equal_splits func""" pool1 = tuple(iter1) pool2 = tuple(iter2) ind1 = random.sample(pool1, 2) ind2 = random.sample(pool2, 2) return tuple(ind1+ind2)
def random_product(iter1, iter2): """ random sampler for equal_splits func""" pool1 = tuple(iter1) pool2 = tuple(iter2) ind1 = random.sample(pool1, 2) ind2 = random.sample(pool2, 2) return tuple(ind1+ind2)
[ "random", "sampler", "for", "equal_splits", "func" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1309-L1315
[ "def", "random_product", "(", "iter1", ",", "iter2", ")", ":", "pool1", "=", "tuple", "(", "iter1", ")", "pool2", "=", "tuple", "(", "iter2", ")", "ind1", "=", "random", ".", "sample", "(", "pool1", ",", "2", ")", "ind2", "=", "random", ".", "sampl...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
n_choose_k
get the number of quartets as n-choose-k. This is used in equal splits to decide whether a split should be exhaustively sampled or randomly sampled. Edges near tips can be exhaustive while highly nested edges probably have too many quartets
ipyrad/analysis/tetrad.py
def n_choose_k(n, k): """ get the number of quartets as n-choose-k. This is used in equal splits to decide whether a split should be exhaustively sampled or randomly sampled. Edges near tips can be exhaustive while highly nested edges probably have too many quartets """ return int(reduce(MUL, (F...
def n_choose_k(n, k): """ get the number of quartets as n-choose-k. This is used in equal splits to decide whether a split should be exhaustively sampled or randomly sampled. Edges near tips can be exhaustive while highly nested edges probably have too many quartets """ return int(reduce(MUL, (F...
[ "get", "the", "number", "of", "quartets", "as", "n", "-", "choose", "-", "k", ".", "This", "is", "used", "in", "equal", "splits", "to", "decide", "whether", "a", "split", "should", "be", "exhaustively", "sampled", "or", "randomly", "sampled", ".", "Edges...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1319-L1325
[ "def", "n_choose_k", "(", "n", ",", "k", ")", ":", "return", "int", "(", "reduce", "(", "MUL", ",", "(", "Fraction", "(", "n", "-", "i", ",", "i", "+", "1", ")", "for", "i", "in", "range", "(", "k", ")", ")", ",", "1", ")", ")" ]
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
count_snps
get dstats from the count array and return as a float tuple
ipyrad/analysis/tetrad.py
def count_snps(mat): """ get dstats from the count array and return as a float tuple """ ## get [aabb, baba, abba, aaab] snps = np.zeros(4, dtype=np.uint32) ## get concordant (aabb) pis sites snps[0] = np.uint32(\ mat[0, 5] + mat[0, 10] + mat[0, 15] + \ mat[5, 0] +...
def count_snps(mat): """ get dstats from the count array and return as a float tuple """ ## get [aabb, baba, abba, aaab] snps = np.zeros(4, dtype=np.uint32) ## get concordant (aabb) pis sites snps[0] = np.uint32(\ mat[0, 5] + mat[0, 10] + mat[0, 15] + \ mat[5, 0] +...
[ "get", "dstats", "from", "the", "count", "array", "and", "return", "as", "a", "float", "tuple" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1354-L1383
[ "def", "count_snps", "(", "mat", ")", ":", "## get [aabb, baba, abba, aaab] ", "snps", "=", "np", ".", "zeros", "(", "4", ",", "dtype", "=", "np", ".", "uint32", ")", "## get concordant (aabb) pis sites", "snps", "[", "0", "]", "=", "np", ".", "uint32", "(...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
subsample_snps_map
removes ncolumns from snparray prior to matrix calculation, and subsamples 'linked' snps (those from the same RAD locus) such that for these four samples only 1 SNP per locus is kept. This information comes from the 'map' array (map file).
ipyrad/analysis/tetrad.py
def subsample_snps_map(seqchunk, nmask, maparr): """ removes ncolumns from snparray prior to matrix calculation, and subsamples 'linked' snps (those from the same RAD locus) such that for these four samples only 1 SNP per locus is kept. This information comes from the 'map' array (map file). ...
def subsample_snps_map(seqchunk, nmask, maparr): """ removes ncolumns from snparray prior to matrix calculation, and subsamples 'linked' snps (those from the same RAD locus) such that for these four samples only 1 SNP per locus is kept. This information comes from the 'map' array (map file). ...
[ "removes", "ncolumns", "from", "snparray", "prior", "to", "matrix", "calculation", "and", "subsamples", "linked", "snps", "(", "those", "from", "the", "same", "RAD", "locus", ")", "such", "that", "for", "these", "four", "samples", "only", "1", "SNP", "per", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1412-L1434
[ "def", "subsample_snps_map", "(", "seqchunk", ",", "nmask", ",", "maparr", ")", ":", "## mask columns that contain Ns", "rmask", "=", "np", ".", "zeros", "(", "seqchunk", ".", "shape", "[", "1", "]", ",", "dtype", "=", "np", ".", "bool_", ")", "## apply ma...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
chunk_to_matrices
numba compiled code to get matrix fast. arr is a 4 x N seq matrix converted to np.int8 I convert the numbers for ATGC into their respective index for the MAT matrix, and leave all others as high numbers, i.e., -==45, N==78.
ipyrad/analysis/tetrad.py
def chunk_to_matrices(narr, mapcol, nmask): """ numba compiled code to get matrix fast. arr is a 4 x N seq matrix converted to np.int8 I convert the numbers for ATGC into their respective index for the MAT matrix, and leave all others as high numbers, i.e., -==45, N==78. """ ## get seq al...
def chunk_to_matrices(narr, mapcol, nmask): """ numba compiled code to get matrix fast. arr is a 4 x N seq matrix converted to np.int8 I convert the numbers for ATGC into their respective index for the MAT matrix, and leave all others as high numbers, i.e., -==45, N==78. """ ## get seq al...
[ "numba", "compiled", "code", "to", "get", "matrix", "fast", ".", "arr", "is", "a", "4", "x", "N", "seq", "matrix", "converted", "to", "np", ".", "int8", "I", "convert", "the", "numbers", "for", "ATGC", "into", "their", "respective", "index", "for", "th...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1472-L1502
[ "def", "chunk_to_matrices", "(", "narr", ",", "mapcol", ",", "nmask", ")", ":", "## get seq alignment and create an empty array for filling", "mats", "=", "np", ".", "zeros", "(", "(", "3", ",", "16", ",", "16", ")", ",", "dtype", "=", "np", ".", "uint32", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
calculate
groups together several numba compiled funcs
ipyrad/analysis/tetrad.py
def calculate(seqnon, mapcol, nmask, tests): """ groups together several numba compiled funcs """ ## create empty matrices #LOGGER.info("tests[0] %s", tests[0]) #LOGGER.info('seqnon[[tests[0]]] %s', seqnon[[tests[0]]]) mats = chunk_to_matrices(seqnon, mapcol, nmask) ## empty svdscores for each...
def calculate(seqnon, mapcol, nmask, tests): """ groups together several numba compiled funcs """ ## create empty matrices #LOGGER.info("tests[0] %s", tests[0]) #LOGGER.info('seqnon[[tests[0]]] %s', seqnon[[tests[0]]]) mats = chunk_to_matrices(seqnon, mapcol, nmask) ## empty svdscores for each...
[ "groups", "together", "several", "numba", "compiled", "funcs" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1507-L1536
[ "def", "calculate", "(", "seqnon", ",", "mapcol", ",", "nmask", ",", "tests", ")", ":", "## create empty matrices", "#LOGGER.info(\"tests[0] %s\", tests[0])", "#LOGGER.info('seqnon[[tests[0]]] %s', seqnon[[tests[0]]])", "mats", "=", "chunk_to_matrices", "(", "seqnon", ",", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
nworker
The workhorse function. Not numba.
ipyrad/analysis/tetrad.py
def nworker(data, smpchunk, tests): """ The workhorse function. Not numba. """ ## tell engines to limit threads #numba.config.NUMBA_DEFAULT_NUM_THREADS = 1 ## open the seqarray view, the modified array is in bootsarr with h5py.File(data.database.input, 'r') as io5: seqview = io5["b...
def nworker(data, smpchunk, tests): """ The workhorse function. Not numba. """ ## tell engines to limit threads #numba.config.NUMBA_DEFAULT_NUM_THREADS = 1 ## open the seqarray view, the modified array is in bootsarr with h5py.File(data.database.input, 'r') as io5: seqview = io5["b...
[ "The", "workhorse", "function", ".", "Not", "numba", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1542-L1586
[ "def", "nworker", "(", "data", ",", "smpchunk", ",", "tests", ")", ":", "## tell engines to limit threads", "#numba.config.NUMBA_DEFAULT_NUM_THREADS = 1", "## open the seqarray view, the modified array is in bootsarr", "with", "h5py", ".", "File", "(", "data", ".", "database"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
shuffle_cols
used in bootstrap resampling without a map file
ipyrad/analysis/tetrad.py
def shuffle_cols(seqarr, newarr, cols): """ used in bootstrap resampling without a map file """ for idx in xrange(cols.shape[0]): newarr[:, idx] = seqarr[:, cols[idx]] return newarr
def shuffle_cols(seqarr, newarr, cols): """ used in bootstrap resampling without a map file """ for idx in xrange(cols.shape[0]): newarr[:, idx] = seqarr[:, cols[idx]] return newarr
[ "used", "in", "bootstrap", "resampling", "without", "a", "map", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1638-L1642
[ "def", "shuffle_cols", "(", "seqarr", ",", "newarr", ",", "cols", ")", ":", "for", "idx", "in", "xrange", "(", "cols", ".", "shape", "[", "0", "]", ")", ":", "newarr", "[", ":", ",", "idx", "]", "=", "seqarr", "[", ":", ",", "cols", "[", "idx",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
resolve_ambigs
returns a seq array with 'RSKYWM' randomly replaced with resolved bases
ipyrad/analysis/tetrad.py
def resolve_ambigs(tmpseq): """ returns a seq array with 'RSKYWM' randomly replaced with resolved bases""" ## iterate over the bases 'RSKWYM': [82, 83, 75, 87, 89, 77] for ambig in np.uint8([82, 83, 75, 87, 89, 77]): ## get all site in this ambig idx, idy = np.where(tmpseq == ambig) ...
def resolve_ambigs(tmpseq): """ returns a seq array with 'RSKYWM' randomly replaced with resolved bases""" ## iterate over the bases 'RSKWYM': [82, 83, 75, 87, 89, 77] for ambig in np.uint8([82, 83, 75, 87, 89, 77]): ## get all site in this ambig idx, idy = np.where(tmpseq == ambig) ...
[ "returns", "a", "seq", "array", "with", "RSKYWM", "randomly", "replaced", "with", "resolved", "bases" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1647-L1663
[ "def", "resolve_ambigs", "(", "tmpseq", ")", ":", "## iterate over the bases 'RSKWYM': [82, 83, 75, 87, 89, 77]", "for", "ambig", "in", "np", ".", "uint8", "(", "[", "82", ",", "83", ",", "75", ",", "87", ",", "89", ",", "77", "]", ")", ":", "## get all site...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_spans
get span distance for each locus in original seqarray
ipyrad/analysis/tetrad.py
def get_spans(maparr, spans): """ get span distance for each locus in original seqarray """ ## start at 0, finds change at 1-index of map file bidx = 1 spans = np.zeros((maparr[-1, 0], 2), np.uint64) ## read through marr and record when locus id changes for idx in xrange(1, maparr.shape[0]): ...
def get_spans(maparr, spans): """ get span distance for each locus in original seqarray """ ## start at 0, finds change at 1-index of map file bidx = 1 spans = np.zeros((maparr[-1, 0], 2), np.uint64) ## read through marr and record when locus id changes for idx in xrange(1, maparr.shape[0]): ...
[ "get", "span", "distance", "for", "each", "locus", "in", "original", "seqarray" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1668-L1682
[ "def", "get_spans", "(", "maparr", ",", "spans", ")", ":", "## start at 0, finds change at 1-index of map file", "bidx", "=", "1", "spans", "=", "np", ".", "zeros", "(", "(", "maparr", "[", "-", "1", ",", "0", "]", ",", "2", ")", ",", "np", ".", "uint6...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_shape
get shape of new bootstrap resampled locus array
ipyrad/analysis/tetrad.py
def get_shape(spans, loci): """ get shape of new bootstrap resampled locus array """ width = 0 for idx in xrange(loci.shape[0]): width += spans[loci[idx], 1] - spans[loci[idx], 0] return width
def get_shape(spans, loci): """ get shape of new bootstrap resampled locus array """ width = 0 for idx in xrange(loci.shape[0]): width += spans[loci[idx], 1] - spans[loci[idx], 0] return width
[ "get", "shape", "of", "new", "bootstrap", "resampled", "locus", "array" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1687-L1692
[ "def", "get_shape", "(", "spans", ",", "loci", ")", ":", "width", "=", "0", "for", "idx", "in", "xrange", "(", "loci", ".", "shape", "[", "0", "]", ")", ":", "width", "+=", "spans", "[", "loci", "[", "idx", "]", ",", "1", "]", "-", "spans", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
fill_boot
fills the new bootstrap resampled array
ipyrad/analysis/tetrad.py
def fill_boot(seqarr, newboot, newmap, spans, loci): """ fills the new bootstrap resampled array """ ## column index cidx = 0 ## resample each locus for i in xrange(loci.shape[0]): ## grab a random locus's columns x1 = spans[loci[i]][0] x2 = spans[loci[i]][1] ...
def fill_boot(seqarr, newboot, newmap, spans, loci): """ fills the new bootstrap resampled array """ ## column index cidx = 0 ## resample each locus for i in xrange(loci.shape[0]): ## grab a random locus's columns x1 = spans[loci[i]][0] x2 = spans[loci[i]][1] ...
[ "fills", "the", "new", "bootstrap", "resampled", "array" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1697-L1725
[ "def", "fill_boot", "(", "seqarr", ",", "newboot", ",", "newmap", ",", "spans", ",", "loci", ")", ":", "## column index", "cidx", "=", "0", "## resample each locus", "for", "i", "in", "xrange", "(", "loci", ".", "shape", "[", "0", "]", ")", ":", "## gr...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_byteify
converts unicode to utf-8 when reading in json files
ipyrad/analysis/tetrad.py
def _byteify(data, ignore_dicts=False): """ converts unicode to utf-8 when reading in json files """ if isinstance(data, unicode): return data.encode("utf-8") if isinstance(data, list): return [_byteify(item, ignore_dicts=True) for item in data] if isinstance(data, dict) and no...
def _byteify(data, ignore_dicts=False): """ converts unicode to utf-8 when reading in json files """ if isinstance(data, unicode): return data.encode("utf-8") if isinstance(data, list): return [_byteify(item, ignore_dicts=True) for item in data] if isinstance(data, dict) and no...
[ "converts", "unicode", "to", "utf", "-", "8", "when", "reading", "in", "json", "files" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1729-L1744
[ "def", "_byteify", "(", "data", ",", "ignore_dicts", "=", "False", ")", ":", "if", "isinstance", "(", "data", ",", "unicode", ")", ":", "return", "data", ".", "encode", "(", "\"utf-8\"", ")", "if", "isinstance", "(", "data", ",", "list", ")", ":", "r...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
consensus_tree
An extended majority rule consensus function for ete3. Modelled on the similar function from scikit-bio tree module. If cutoff=0.5 then it is a normal majority rule consensus, while if cutoff=0.0 then subsequent non-conflicting clades are added to the tree.
ipyrad/analysis/tetrad.py
def consensus_tree(trees, names=None, cutoff=0.0): """ An extended majority rule consensus function for ete3. Modelled on the similar function from scikit-bio tree module. If cutoff=0.5 then it is a normal majority rule consensus, while if cutoff=0.0 then subsequent non-conflicting clades are ad...
def consensus_tree(trees, names=None, cutoff=0.0): """ An extended majority rule consensus function for ete3. Modelled on the similar function from scikit-bio tree module. If cutoff=0.5 then it is a normal majority rule consensus, while if cutoff=0.0 then subsequent non-conflicting clades are ad...
[ "An", "extended", "majority", "rule", "consensus", "function", "for", "ete3", ".", "Modelled", "on", "the", "similar", "function", "from", "scikit", "-", "bio", "tree", "module", ".", "If", "cutoff", "=", "0", ".", "5", "then", "it", "is", "a", "normal",...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1755-L1772
[ "def", "consensus_tree", "(", "trees", ",", "names", "=", "None", ",", "cutoff", "=", "0.0", ")", ":", "## find which clades occured with freq > cutoff", "namedict", ",", "clade_counts", "=", "_find_clades", "(", "trees", ",", "names", "=", "names", ")", "## fil...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_filter_clades
A subfunc of consensus_tree(). Removes clades that occur with freq < cutoff.
ipyrad/analysis/tetrad.py
def _filter_clades(clade_counts, cutoff): """ A subfunc of consensus_tree(). Removes clades that occur with freq < cutoff. """ ## store clades that pass filter passed = [] clades = np.array([list(i[0]) for i in clade_counts], dtype=np.int8) counts = np.array([i[1] for i in clade_count...
def _filter_clades(clade_counts, cutoff): """ A subfunc of consensus_tree(). Removes clades that occur with freq < cutoff. """ ## store clades that pass filter passed = [] clades = np.array([list(i[0]) for i in clade_counts], dtype=np.int8) counts = np.array([i[1] for i in clade_count...
[ "A", "subfunc", "of", "consensus_tree", "()", ".", "Removes", "clades", "that", "occur", "with", "freq", "<", "cutoff", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1776-L1824
[ "def", "_filter_clades", "(", "clade_counts", ",", "cutoff", ")", ":", "## store clades that pass filter", "passed", "=", "[", "]", "clades", "=", "np", ".", "array", "(", "[", "list", "(", "i", "[", "0", "]", ")", "for", "i", "in", "clade_counts", "]", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad.refresh
Remove all existing results files and reinit the h5 arrays so that the tetrad object is just like fresh from a CLI start.
ipyrad/analysis/tetrad.py
def refresh(self): """ Remove all existing results files and reinit the h5 arrays so that the tetrad object is just like fresh from a CLI start. """ ## clear any existing results files oldfiles = [self.files.qdump] + \ self.database.__dict__.values(...
def refresh(self): """ Remove all existing results files and reinit the h5 arrays so that the tetrad object is just like fresh from a CLI start. """ ## clear any existing results files oldfiles = [self.files.qdump] + \ self.database.__dict__.values(...
[ "Remove", "all", "existing", "results", "files", "and", "reinit", "the", "h5", "arrays", "so", "that", "the", "tetrad", "object", "is", "just", "like", "fresh", "from", "a", "CLI", "start", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L239-L274
[ "def", "refresh", "(", "self", ")", ":", "## clear any existing results files", "oldfiles", "=", "[", "self", ".", "files", ".", "qdump", "]", "+", "self", ".", "database", ".", "__dict__", ".", "values", "(", ")", "+", "self", ".", "trees", ".", "__dict...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._parse_names
parse sample names from the sequence file
ipyrad/analysis/tetrad.py
def _parse_names(self): """ parse sample names from the sequence file""" self.samples = [] with iter(open(self.files.data, 'r')) as infile: infile.next().strip().split() while 1: try: self.samples.append(infile.next().split()[0]) ...
def _parse_names(self): """ parse sample names from the sequence file""" self.samples = [] with iter(open(self.files.data, 'r')) as infile: infile.next().strip().split() while 1: try: self.samples.append(infile.next().split()[0]) ...
[ "parse", "sample", "names", "from", "the", "sequence", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L278-L287
[ "def", "_parse_names", "(", "self", ")", ":", "self", ".", "samples", "=", "[", "]", "with", "iter", "(", "open", "(", "self", ".", "files", ".", "data", ",", "'r'", ")", ")", "as", "infile", ":", "infile", ".", "next", "(", ")", ".", "strip", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._init_seqarray
Fills the seqarr with the full data set, and creates a bootsarr copy with the following modifications: 1) converts "-" into "N"s, since they are similarly treated as missing. 2) randomly resolve ambiguities (RSKWYM) 3) convert to uint8 for smaller memory load and faster computation
ipyrad/analysis/tetrad.py
def _init_seqarray(self, quiet=False): """ Fills the seqarr with the full data set, and creates a bootsarr copy with the following modifications: 1) converts "-" into "N"s, since they are similarly treated as missing. 2) randomly resolve ambiguities (RSKWYM) 3) convert...
def _init_seqarray(self, quiet=False): """ Fills the seqarr with the full data set, and creates a bootsarr copy with the following modifications: 1) converts "-" into "N"s, since they are similarly treated as missing. 2) randomly resolve ambiguities (RSKWYM) 3) convert...
[ "Fills", "the", "seqarr", "with", "the", "full", "data", "set", "and", "creates", "a", "bootsarr", "copy", "with", "the", "following", "modifications", ":" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L291-L369
[ "def", "_init_seqarray", "(", "self", ",", "quiet", "=", "False", ")", ":", "## read in the data (seqfile)", "try", ":", "spath", "=", "open", "(", "self", ".", "files", ".", "data", ",", "'r'", ")", "except", "IOError", ":", "raise", "IPyradWarningExit", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._store_N_samples
Find all quartets of samples and store in a large array Create a chunk size for sampling from the array of quartets. This should be relatively large so that we don't spend a lot of time doing I/O, but small enough that jobs finish often for checkpointing.
ipyrad/analysis/tetrad.py
def _store_N_samples(self, ncpus): """ Find all quartets of samples and store in a large array Create a chunk size for sampling from the array of quartets. This should be relatively large so that we don't spend a lot of time doing I/O, but small enough that jobs finish often f...
def _store_N_samples(self, ncpus): """ Find all quartets of samples and store in a large array Create a chunk size for sampling from the array of quartets. This should be relatively large so that we don't spend a lot of time doing I/O, but small enough that jobs finish often f...
[ "Find", "all", "quartets", "of", "samples", "and", "store", "in", "a", "large", "array", "Create", "a", "chunk", "size", "for", "sampling", "from", "the", "array", "of", "quartets", ".", "This", "should", "be", "relatively", "large", "so", "that", "we", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L445-L512
[ "def", "_store_N_samples", "(", "self", ",", "ncpus", ")", ":", "breaks", "=", "2", "if", "self", ".", "params", ".", "nquartets", "<", "5000", ":", "breaks", "=", "1", "if", "self", ".", "params", ".", "nquartets", ">", "100000", ":", "breaks", "=",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._store_equal_samples
sample quartets evenly across splits of the starting tree, and fills in remaining samples with random quartet samples. Uses a hash dict to not sample the same quartet twice, so for very large trees this can take a few minutes to find millions of possible quartet samples.
ipyrad/analysis/tetrad.py
def _store_equal_samples(self, ncpus): """ sample quartets evenly across splits of the starting tree, and fills in remaining samples with random quartet samples. Uses a hash dict to not sample the same quartet twice, so for very large trees this can take a few minutes to find ...
def _store_equal_samples(self, ncpus): """ sample quartets evenly across splits of the starting tree, and fills in remaining samples with random quartet samples. Uses a hash dict to not sample the same quartet twice, so for very large trees this can take a few minutes to find ...
[ "sample", "quartets", "evenly", "across", "splits", "of", "the", "starting", "tree", "and", "fills", "in", "remaining", "samples", "with", "random", "quartet", "samples", ".", "Uses", "a", "hash", "dict", "to", "not", "sample", "the", "same", "quartet", "twi...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L517-L665
[ "def", "_store_equal_samples", "(", "self", ",", "ncpus", ")", ":", "## choose chunker for h5 arr", "breaks", "=", "2", "if", "self", ".", "params", ".", "nquartets", "<", "5000", ":", "breaks", "=", "1", "if", "self", ".", "params", ".", "nquartets", ">",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._run_qmc
runs quartet max-cut on a quartets file
ipyrad/analysis/tetrad.py
def _run_qmc(self, boot): """ runs quartet max-cut on a quartets file """ ## convert to txt file for wQMC self._tmp = os.path.join(self.dirs, ".tmpwtre") cmd = [ip.bins.qmc, "qrtt="+self.files.qdump, "otre="+self._tmp] ## run them proc = subprocess.Popen(cmd, stderr=su...
def _run_qmc(self, boot): """ runs quartet max-cut on a quartets file """ ## convert to txt file for wQMC self._tmp = os.path.join(self.dirs, ".tmpwtre") cmd = [ip.bins.qmc, "qrtt="+self.files.qdump, "otre="+self._tmp] ## run them proc = subprocess.Popen(cmd, stderr=su...
[ "runs", "quartet", "max", "-", "cut", "on", "a", "quartets", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L669-L702
[ "def", "_run_qmc", "(", "self", ",", "boot", ")", ":", "## convert to txt file for wQMC", "self", ".", "_tmp", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dirs", ",", "\".tmpwtre\"", ")", "cmd", "=", "[", "ip", ".", "bins", ".", "qmc", ",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._dump_qmc
Makes a reduced array that excludes quartets with no information and prints the quartets and weights to a file formatted for wQMC
ipyrad/analysis/tetrad.py
def _dump_qmc(self): """ Makes a reduced array that excludes quartets with no information and prints the quartets and weights to a file formatted for wQMC """ ## open the h5 database io5 = h5py.File(self.database.output, 'r') ## create an output file for writi...
def _dump_qmc(self): """ Makes a reduced array that excludes quartets with no information and prints the quartets and weights to a file formatted for wQMC """ ## open the h5 database io5 = h5py.File(self.database.output, 'r') ## create an output file for writi...
[ "Makes", "a", "reduced", "array", "that", "excludes", "quartets", "with", "no", "information", "and", "prints", "the", "quartets", "and", "weights", "to", "a", "file", "formatted", "for", "wQMC" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L707-L740
[ "def", "_dump_qmc", "(", "self", ")", ":", "## open the h5 database", "io5", "=", "h5py", ".", "File", "(", "self", ".", "database", ".", "output", ",", "'r'", ")", "## create an output file for writing", "self", ".", "files", ".", "qdump", "=", "os", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._renamer
renames newick from numbers to sample names
ipyrad/analysis/tetrad.py
def _renamer(self, tre): """ renames newick from numbers to sample names""" ## get the tre with numbered tree tip labels names = tre.get_leaves() ## replace numbered names with snames for name in names: name.name = self.samples[int(name.name)] ## return with...
def _renamer(self, tre): """ renames newick from numbers to sample names""" ## get the tre with numbered tree tip labels names = tre.get_leaves() ## replace numbered names with snames for name in names: name.name = self.samples[int(name.name)] ## return with...
[ "renames", "newick", "from", "numbers", "to", "sample", "names" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L744-L754
[ "def", "_renamer", "(", "self", ",", "tre", ")", ":", "## get the tre with numbered tree tip labels", "names", "=", "tre", ".", "get_leaves", "(", ")", "## replace numbered names with snames", "for", "name", "in", "names", ":", "name", ".", "name", "=", "self", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._finalize_stats
write final tree files
ipyrad/analysis/tetrad.py
def _finalize_stats(self, ipyclient): """ write final tree files """ ## print stats file location: #print(STATSOUT.format(opr(self.files.stats))) ## print finished tree information --------------------- print(FINALTREES.format(opr(self.trees.tree))) ## print bootstrap ...
def _finalize_stats(self, ipyclient): """ write final tree files """ ## print stats file location: #print(STATSOUT.format(opr(self.files.stats))) ## print finished tree information --------------------- print(FINALTREES.format(opr(self.trees.tree))) ## print bootstrap ...
[ "write", "final", "tree", "files" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L758-L793
[ "def", "_finalize_stats", "(", "self", ",", "ipyclient", ")", ":", "## print stats file location:", "#print(STATSOUT.format(opr(self.files.stats)))", "## print finished tree information ---------------------", "print", "(", "FINALTREES", ".", "format", "(", "opr", "(", "self", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._save
save a JSON file representation of Tetrad Class for checkpoint
ipyrad/analysis/tetrad.py
def _save(self): """ save a JSON file representation of Tetrad Class for checkpoint""" ## save each attribute as dict fulldict = copy.deepcopy(self.__dict__) for i, j in fulldict.items(): if isinstance(j, Params): fulldict[i] = j.__dict__ fulldumps = ...
def _save(self): """ save a JSON file representation of Tetrad Class for checkpoint""" ## save each attribute as dict fulldict = copy.deepcopy(self.__dict__) for i, j in fulldict.items(): if isinstance(j, Params): fulldict[i] = j.__dict__ fulldumps = ...
[ "save", "a", "JSON", "file", "representation", "of", "Tetrad", "Class", "for", "checkpoint" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L803-L831
[ "def", "_save", "(", "self", ")", ":", "## save each attribute as dict", "fulldict", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "for", "i", ",", "j", "in", "fulldict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "j", ","...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._insert_to_array
inputs results from workers into hdf4 array
ipyrad/analysis/tetrad.py
def _insert_to_array(self, start, results): """ inputs results from workers into hdf4 array """ qrts, wgts, qsts = results #qrts, wgts = results #print(qrts) with h5py.File(self.database.output, 'r+') as out: chunk = self._chunksize out['quartets'][start:...
def _insert_to_array(self, start, results): """ inputs results from workers into hdf4 array """ qrts, wgts, qsts = results #qrts, wgts = results #print(qrts) with h5py.File(self.database.output, 'r+') as out: chunk = self._chunksize out['quartets'][start:...
[ "inputs", "results", "from", "workers", "into", "hdf4", "array" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L835-L851
[ "def", "_insert_to_array", "(", "self", ",", "start", ",", "results", ")", ":", "qrts", ",", "wgts", ",", "qsts", "=", "results", "#qrts, wgts = results", "#print(qrts)", "with", "h5py", ".", "File", "(", "self", ".", "database", ".", "output", ",", "'r+'"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad.run
Run quartet inference on a SNP alignment and distribute work across an ipyparallel cluster (ipyclient). Unless passed an ipyclient explicitly, it looks for a running ipcluster instance running from the defautl ("") profile, and will raise an exception if one is not found within a set ti...
ipyrad/analysis/tetrad.py
def run(self, force=0, verbose=2, ipyclient=None): """ Run quartet inference on a SNP alignment and distribute work across an ipyparallel cluster (ipyclient). Unless passed an ipyclient explicitly, it looks for a running ipcluster instance running from the defautl ("") profile,...
def run(self, force=0, verbose=2, ipyclient=None): """ Run quartet inference on a SNP alignment and distribute work across an ipyparallel cluster (ipyclient). Unless passed an ipyclient explicitly, it looks for a running ipcluster instance running from the defautl ("") profile,...
[ "Run", "quartet", "inference", "on", "a", "SNP", "alignment", "and", "distribute", "work", "across", "an", "ipyparallel", "cluster", "(", "ipyclient", ")", ".", "Unless", "passed", "an", "ipyclient", "explicitly", "it", "looks", "for", "a", "running", "ipclust...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L902-L1059
[ "def", "run", "(", "self", ",", "force", "=", "0", ",", "verbose", "=", "2", ",", "ipyclient", "=", "None", ")", ":", "## clear object results and data if force=True", "if", "force", ":", "self", ".", "refresh", "(", ")", "## wrap everything in a try statement s...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tetrad._inference
Inference sends slices of jobs to the parallel engines for computing and collects the results into the output hdf5 array as they finish.
ipyrad/analysis/tetrad.py
def _inference(self, start, lbview, quiet=False): """ Inference sends slices of jobs to the parallel engines for computing and collects the results into the output hdf5 array as they finish. """ ## an iterator to distribute sampled quartets in chunks gen = xrange(self....
def _inference(self, start, lbview, quiet=False): """ Inference sends slices of jobs to the parallel engines for computing and collects the results into the output hdf5 array as they finish. """ ## an iterator to distribute sampled quartets in chunks gen = xrange(self....
[ "Inference", "sends", "slices", "of", "jobs", "to", "the", "parallel", "engines", "for", "computing", "and", "collects", "the", "results", "into", "the", "output", "hdf5", "array", "as", "they", "finish", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad.py#L1063-L1174
[ "def", "_inference", "(", "self", ",", "start", ",", "lbview", ",", "quiet", "=", "False", ")", ":", "## an iterator to distribute sampled quartets in chunks", "gen", "=", "xrange", "(", "self", ".", "checkpoint", ".", "arr", ",", "self", ".", "params", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run
Check all samples requested have been clustered (state=6), make output directory, then create the requested outfiles. Excluded samples are already removed from samples.
ipyrad/assemble/write_outfiles.py
def run(data, samples, force, ipyclient): """ Check all samples requested have been clustered (state=6), make output directory, then create the requested outfiles. Excluded samples are already removed from samples. """ ## prepare dirs data.dirs.outfiles = os.path.join(data.dirs.project, dat...
def run(data, samples, force, ipyclient): """ Check all samples requested have been clustered (state=6), make output directory, then create the requested outfiles. Excluded samples are already removed from samples. """ ## prepare dirs data.dirs.outfiles = os.path.join(data.dirs.project, dat...
[ "Check", "all", "samples", "requested", "have", "been", "clustered", "(", "state", "=", "6", ")", "make", "output", "directory", "then", "create", "the", "requested", "outfiles", ".", "Excluded", "samples", "are", "already", "removed", "from", "samples", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L72-L120
[ "def", "run", "(", "data", ",", "samples", ",", "force", ",", "ipyclient", ")", ":", "## prepare dirs", "data", ".", "dirs", ".", "outfiles", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "project", ",", "data", ".", "name", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make_stats
write the output stats file and save to Assembly obj.
ipyrad/assemble/write_outfiles.py
def make_stats(data, samples, samplecounts, locuscounts): """ write the output stats file and save to Assembly obj.""" ## get meta info with h5py.File(data.clust_database, 'r') as io5: anames = io5["seqs"].attrs["samples"] nloci = io5["seqs"].shape[0] optim = io5["seqs"].attrs["chun...
def make_stats(data, samples, samplecounts, locuscounts): """ write the output stats file and save to Assembly obj.""" ## get meta info with h5py.File(data.clust_database, 'r') as io5: anames = io5["seqs"].attrs["samples"] nloci = io5["seqs"].shape[0] optim = io5["seqs"].attrs["chun...
[ "write", "the", "output", "stats", "file", "and", "save", "to", "Assembly", "obj", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L124-L322
[ "def", "make_stats", "(", "data", ",", "samples", ",", "samplecounts", ",", "locuscounts", ")", ":", "## get meta info", "with", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r'", ")", "as", "io5", ":", "anames", "=", "io5", "[", "\"seq...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
select_samples
Get the row index of samples that are included. If samples are in the 'excluded' they were already filtered out of 'samples' during _get_samples.
ipyrad/assemble/write_outfiles.py
def select_samples(dbsamples, samples, pidx=None): """ Get the row index of samples that are included. If samples are in the 'excluded' they were already filtered out of 'samples' during _get_samples. """ ## get index from dbsamples samples = [i.name for i in samples] if pidx: sidx =...
def select_samples(dbsamples, samples, pidx=None): """ Get the row index of samples that are included. If samples are in the 'excluded' they were already filtered out of 'samples' during _get_samples. """ ## get index from dbsamples samples = [i.name for i in samples] if pidx: sidx =...
[ "Get", "the", "row", "index", "of", "samples", "that", "are", "included", ".", "If", "samples", "are", "in", "the", "excluded", "they", "were", "already", "filtered", "out", "of", "samples", "during", "_get_samples", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L326-L338
[ "def", "select_samples", "(", "dbsamples", ",", "samples", ",", "pidx", "=", "None", ")", ":", "## get index from dbsamples", "samples", "=", "[", "i", ".", "name", "for", "i", "in", "samples", "]", "if", "pidx", ":", "sidx", "=", "[", "list", "(", "db...
5eeb8a178160f45faf71bf47cec4abe998a575d1