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
filter_all_clusters
Open the clust_database HDF5 array with seqs, catg, and filter data. Fill the remaining filters.
ipyrad/assemble/write_outfiles.py
def filter_all_clusters(data, samples, ipyclient): """ Open the clust_database HDF5 array with seqs, catg, and filter data. Fill the remaining filters. """ ## create loadbalanced ipyclient lbview = ipyclient.load_balanced_view() ## get chunk size from the HD5 array and close with h5py....
def filter_all_clusters(data, samples, ipyclient): """ Open the clust_database HDF5 array with seqs, catg, and filter data. Fill the remaining filters. """ ## create loadbalanced ipyclient lbview = ipyclient.load_balanced_view() ## get chunk size from the HD5 array and close with h5py....
[ "Open", "the", "clust_database", "HDF5", "array", "with", "seqs", "catg", "and", "filter", "data", ".", "Fill", "the", "remaining", "filters", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L342-L497
[ "def", "filter_all_clusters", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "## create loadbalanced ipyclient", "lbview", "=", "ipyclient", ".", "load_balanced_view", "(", ")", "## get chunk size from the HD5 array and close", "with", "h5py", ".", "File", "("...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
padnames
pads names for loci output
ipyrad/assemble/write_outfiles.py
def padnames(names): """ pads names for loci output """ ## get longest name longname_len = max(len(i) for i in names) ## Padding distance between name and seq. padding = 5 ## add pad to names pnames = [name + " " * (longname_len - len(name)+ padding) \ for name in names] s...
def padnames(names): """ pads names for loci output """ ## get longest name longname_len = max(len(i) for i in names) ## Padding distance between name and seq. padding = 5 ## add pad to names pnames = [name + " " * (longname_len - len(name)+ padding) \ for name in names] s...
[ "pads", "names", "for", "loci", "output" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L501-L512
[ "def", "padnames", "(", "names", ")", ":", "## get longest name", "longname_len", "=", "max", "(", "len", "(", "i", ")", "for", "i", "in", "names", ")", "## Padding distance between name and seq.", "padding", "=", "5", "## add pad to names", "pnames", "=", "[", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make_loci_and_stats
Makes the .loci file from h5 data base. Iterates by optim loci at a time and write to file. Also makes alleles file if requested.
ipyrad/assemble/write_outfiles.py
def make_loci_and_stats(data, samples, ipyclient): """ Makes the .loci file from h5 data base. Iterates by optim loci at a time and write to file. Also makes alleles file if requested. """ ## start vcf progress bar start = time.time() printstr = " building loci/stats | {} | s7 |" elaps...
def make_loci_and_stats(data, samples, ipyclient): """ Makes the .loci file from h5 data base. Iterates by optim loci at a time and write to file. Also makes alleles file if requested. """ ## start vcf progress bar start = time.time() printstr = " building loci/stats | {} | s7 |" elaps...
[ "Makes", "the", ".", "loci", "file", "from", "h5", "data", "base", ".", "Iterates", "by", "optim", "loci", "at", "a", "time", "and", "write", "to", "file", ".", "Also", "makes", "alleles", "file", "if", "requested", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L517-L640
[ "def", "make_loci_and_stats", "(", "data", ",", "samples", ",", "ipyclient", ")", ":", "## start vcf progress bar", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" building loci/stats | {} | s7 |\"", "elapsed", "=", "datetime", ".", "timedelta", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
locichunk
Function from make_loci to apply to chunks. smask is sample mask.
ipyrad/assemble/write_outfiles.py
def locichunk(args): """ Function from make_loci to apply to chunks. smask is sample mask. """ ## parse args data, optim, pnames, snppad, smask, start, samplecov, locuscov, upper = args ## this slice hslice = [start, start+optim] ## get filter db info co5 = h5py.File(data.database,...
def locichunk(args): """ Function from make_loci to apply to chunks. smask is sample mask. """ ## parse args data, optim, pnames, snppad, smask, start, samplecov, locuscov, upper = args ## this slice hslice = [start, start+optim] ## get filter db info co5 = h5py.File(data.database,...
[ "Function", "from", "make_loci", "to", "apply", "to", "chunks", ".", "smask", "is", "sample", "mask", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L674-L723
[ "def", "locichunk", "(", "args", ")", ":", "## parse args", "data", ",", "optim", ",", "pnames", ",", "snppad", ",", "smask", ",", "start", ",", "samplecov", ",", "locuscov", ",", "upper", "=", "args", "## this slice", "hslice", "=", "[", "start", ",", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
enter_pairs
enters funcs for pairs
ipyrad/assemble/write_outfiles.py
def enter_pairs(iloc, pnames, snppad, edg, aseqs, asnps, smask, samplecov, locuscov, start): """ enters funcs for pairs """ ## snps was created using only the selected samples. LOGGER.info("edges in enter_pairs %s", edg) seq1 = aseqs[iloc, :, edg[0]:edg[1]+1] snp1 = asnps[iloc, edg[0]:edg[1]+1, ] ...
def enter_pairs(iloc, pnames, snppad, edg, aseqs, asnps, smask, samplecov, locuscov, start): """ enters funcs for pairs """ ## snps was created using only the selected samples. LOGGER.info("edges in enter_pairs %s", edg) seq1 = aseqs[iloc, :, edg[0]:edg[1]+1] snp1 = asnps[iloc, edg[0]:edg[1]+1, ] ...
[ "enters", "funcs", "for", "pairs" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L727-L780
[ "def", "enter_pairs", "(", "iloc", ",", "pnames", ",", "snppad", ",", "edg", ",", "aseqs", ",", "asnps", ",", "smask", ",", "samplecov", ",", "locuscov", ",", "start", ")", ":", "## snps was created using only the selected samples.", "LOGGER", ".", "info", "("...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
enter_singles
enter funcs for SE or merged data
ipyrad/assemble/write_outfiles.py
def enter_singles(iloc, pnames, snppad, edg, aseqs, asnps, smask, samplecov, locuscov, start): """ enter funcs for SE or merged data """ ## grab all seqs between edges seq = aseqs[iloc, :, edg[0]:edg[1]+1] ## snps was created using only the selected samples, and is edge masked. ## The mask is for c...
def enter_singles(iloc, pnames, snppad, edg, aseqs, asnps, smask, samplecov, locuscov, start): """ enter funcs for SE or merged data """ ## grab all seqs between edges seq = aseqs[iloc, :, edg[0]:edg[1]+1] ## snps was created using only the selected samples, and is edge masked. ## The mask is for c...
[ "enter", "funcs", "for", "SE", "or", "merged", "data" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L784-L818
[ "def", "enter_singles", "(", "iloc", ",", "pnames", ",", "snppad", ",", "edg", ",", "aseqs", ",", "asnps", ",", "smask", ",", "samplecov", ",", "locuscov", ",", "start", ")", ":", "## grab all seqs between edges", "seq", "=", "aseqs", "[", "iloc", ",", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
init_arrays
Create database file for storing final filtered snps data as hdf5 array. Copies splits and duplicates info from clust_database to database.
ipyrad/assemble/write_outfiles.py
def init_arrays(data): """ Create database file for storing final filtered snps data as hdf5 array. Copies splits and duplicates info from clust_database to database. """ ## get stats from step6 h5 and create new h5 co5 = h5py.File(data.clust_database, 'r') io5 = h5py.File(data.database, 'w...
def init_arrays(data): """ Create database file for storing final filtered snps data as hdf5 array. Copies splits and duplicates info from clust_database to database. """ ## get stats from step6 h5 and create new h5 co5 = h5py.File(data.clust_database, 'r') io5 = h5py.File(data.database, 'w...
[ "Create", "database", "file", "for", "storing", "final", "filtered", "snps", "data", "as", "hdf5", "array", ".", "Copies", "splits", "and", "duplicates", "info", "from", "clust_database", "to", "database", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L822-L865
[ "def", "init_arrays", "(", "data", ")", ":", "## get stats from step6 h5 and create new h5", "co5", "=", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r'", ")", "io5", "=", "h5py", ".", "File", "(", "data", ".", "database", ",", "'w'", ")...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
filter_stacks
Grab a chunk of loci from the HDF5 database. Apply filters and fill the the filters boolean array. The design of the filtering steps intentionally sacrifices some performance for an increase in readability, and extensibility. Calling multiple filter functions ends up running through the sequences per s...
ipyrad/assemble/write_outfiles.py
def filter_stacks(data, sidx, hslice): """ Grab a chunk of loci from the HDF5 database. Apply filters and fill the the filters boolean array. The design of the filtering steps intentionally sacrifices some performance for an increase in readability, and extensibility. Calling multiple filter fu...
def filter_stacks(data, sidx, hslice): """ Grab a chunk of loci from the HDF5 database. Apply filters and fill the the filters boolean array. The design of the filtering steps intentionally sacrifices some performance for an increase in readability, and extensibility. Calling multiple filter fu...
[ "Grab", "a", "chunk", "of", "loci", "from", "the", "HDF5", "database", ".", "Apply", "filters", "and", "fill", "the", "the", "filters", "boolean", "array", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L869-L969
[ "def", "filter_stacks", "(", "data", ",", "sidx", ",", "hslice", ")", ":", "LOGGER", ".", "info", "(", "\"Entering filter_stacks\"", ")", "## open h5 handles", "io5", "=", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r'", ")", "co5", "="...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_edges
Gets edge trimming based on the overlap of sequences at the edges of alignments and the tuple arg passed in for edge_trimming. Trims as (R1 left, R1 right, R2 left, R2 right). We also trim off the restriction site if it present. This modifies superints, and so should be run on an engine so it doesn't af...
ipyrad/assemble/write_outfiles.py
def get_edges(data, superints, splits): """ Gets edge trimming based on the overlap of sequences at the edges of alignments and the tuple arg passed in for edge_trimming. Trims as (R1 left, R1 right, R2 left, R2 right). We also trim off the restriction site if it present. This modifies superints, an...
def get_edges(data, superints, splits): """ Gets edge trimming based on the overlap of sequences at the edges of alignments and the tuple arg passed in for edge_trimming. Trims as (R1 left, R1 right, R2 left, R2 right). We also trim off the restriction site if it present. This modifies superints, an...
[ "Gets", "edge", "trimming", "based", "on", "the", "overlap", "of", "sequences", "at", "the", "edges", "of", "alignments", "and", "the", "tuple", "arg", "passed", "in", "for", "edge_trimming", ".", "Trims", "as", "(", "R1", "left", "R1", "right", "R2", "l...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L973-L1024
[ "def", "get_edges", "(", "data", ",", "superints", ",", "splits", ")", ":", "## the filtering arg and parse it into minsamp numbers", "if", "\"trim_overhang\"", "in", "data", ".", "paramsdict", ":", "edgetrims", "=", "np", ".", "array", "(", "data", ".", "paramsdi...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
filter_minsamp
Filter minimum # of samples per locus from superseqs[chunk]. The shape of superseqs is [chunk, sum(sidx), maxlen]
ipyrad/assemble/write_outfiles.py
def filter_minsamp(data, superints): """ Filter minimum # of samples per locus from superseqs[chunk]. The shape of superseqs is [chunk, sum(sidx), maxlen] """ ## global minsamp minsamp = data.paramsdict["min_samples_locus"] ## use population minsamps if data.populations: ## data...
def filter_minsamp(data, superints): """ Filter minimum # of samples per locus from superseqs[chunk]. The shape of superseqs is [chunk, sum(sidx), maxlen] """ ## global minsamp minsamp = data.paramsdict["min_samples_locus"] ## use population minsamps if data.populations: ## data...
[ "Filter", "minimum", "#", "of", "samples", "per", "locus", "from", "superseqs", "[", "chunk", "]", ".", "The", "shape", "of", "superseqs", "is", "[", "chunk", "sum", "(", "sidx", ")", "maxlen", "]" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1092-L1123
[ "def", "filter_minsamp", "(", "data", ",", "superints", ")", ":", "## global minsamp", "minsamp", "=", "data", ".", "paramsdict", "[", "\"min_samples_locus\"", "]", "## use population minsamps", "if", "data", ".", "populations", ":", "## data._populations will look like...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
ucount
Used to count the number of unique bases in a site for snpstring. returns as a spstring with * and -
ipyrad/assemble/write_outfiles.py
def ucount(sitecol): """ Used to count the number of unique bases in a site for snpstring. returns as a spstring with * and - """ ## a list for only catgs catg = [i for i in sitecol if i in "CATG"] ## find sites that are ambigs where = [sitecol[sitecol == i] for i in "RSKYWM"] ## ...
def ucount(sitecol): """ Used to count the number of unique bases in a site for snpstring. returns as a spstring with * and - """ ## a list for only catgs catg = [i for i in sitecol if i in "CATG"] ## find sites that are ambigs where = [sitecol[sitecol == i] for i in "RSKYWM"] ## ...
[ "Used", "to", "count", "the", "number", "of", "unique", "bases", "in", "a", "site", "for", "snpstring", ".", "returns", "as", "a", "spstring", "with", "*", "and", "-" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1127-L1153
[ "def", "ucount", "(", "sitecol", ")", ":", "## a list for only catgs", "catg", "=", "[", "i", "for", "i", "in", "sitecol", "if", "i", "in", "\"CATG\"", "]", "## find sites that are ambigs", "where", "=", "[", "sitecol", "[", "sitecol", "==", "i", "]", "for...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
filter_maxsnp
Filter max # of SNPs per locus. Do R1 and R2 separately if PE. Also generate the snpsite line for the .loci format and save in the snp arr This uses the edge filters that have been built based on trimming, and saves the snps array with edges filtered. **Loci are not yet filtered.**
ipyrad/assemble/write_outfiles.py
def filter_maxsnp(data, superints, edgearr): """ Filter max # of SNPs per locus. Do R1 and R2 separately if PE. Also generate the snpsite line for the .loci format and save in the snp arr This uses the edge filters that have been built based on trimming, and saves the snps array with edges filtered....
def filter_maxsnp(data, superints, edgearr): """ Filter max # of SNPs per locus. Do R1 and R2 separately if PE. Also generate the snpsite line for the .loci format and save in the snp arr This uses the edge filters that have been built based on trimming, and saves the snps array with edges filtered....
[ "Filter", "max", "#", "of", "SNPs", "per", "locus", ".", "Do", "R1", "and", "R2", "separately", "if", "PE", ".", "Also", "generate", "the", "snpsite", "line", "for", "the", ".", "loci", "format", "and", "save", "in", "the", "snp", "arr", "This", "use...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1157-L1177
[ "def", "filter_maxsnp", "(", "data", ",", "superints", ",", "edgearr", ")", ":", "## an empty array to count with failed loci", "snpfilt", "=", "np", ".", "zeros", "(", "superints", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "bool", ")", "s...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
snpcount_numba
Used to count the number of unique bases in a site for snpstring.
ipyrad/assemble/write_outfiles.py
def snpcount_numba(superints, snpsarr): """ Used to count the number of unique bases in a site for snpstring. """ ## iterate over all loci for iloc in xrange(superints.shape[0]): for site in xrange(superints.shape[2]): ## make new array catg = np.zeros(4, dtype=np.in...
def snpcount_numba(superints, snpsarr): """ Used to count the number of unique bases in a site for snpstring. """ ## iterate over all loci for iloc in xrange(superints.shape[0]): for site in xrange(superints.shape[2]): ## make new array catg = np.zeros(4, dtype=np.in...
[ "Used", "to", "count", "the", "number", "of", "unique", "bases", "in", "a", "site", "for", "snpstring", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1219-L1271
[ "def", "snpcount_numba", "(", "superints", ",", "snpsarr", ")", ":", "## iterate over all loci", "for", "iloc", "in", "xrange", "(", "superints", ".", "shape", "[", "0", "]", ")", ":", "for", "site", "in", "xrange", "(", "superints", ".", "shape", "[", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
filter_maxhet
Filter max shared heterozygosity per locus. The dimensions of superseqs are (chunk, sum(sidx), maxlen). Don't need split info since it applies to entire loci based on site patterns (i.e., location along the seq doesn't matter.) Current implementation does ints, but does not apply float diff to every loc...
ipyrad/assemble/write_outfiles.py
def filter_maxhet(data, superints, edgearr): """ Filter max shared heterozygosity per locus. The dimensions of superseqs are (chunk, sum(sidx), maxlen). Don't need split info since it applies to entire loci based on site patterns (i.e., location along the seq doesn't matter.) Current implementation ...
def filter_maxhet(data, superints, edgearr): """ Filter max shared heterozygosity per locus. The dimensions of superseqs are (chunk, sum(sidx), maxlen). Don't need split info since it applies to entire loci based on site patterns (i.e., location along the seq doesn't matter.) Current implementation ...
[ "Filter", "max", "shared", "heterozygosity", "per", "locus", ".", "The", "dimensions", "of", "superseqs", "are", "(", "chunk", "sum", "(", "sidx", ")", "maxlen", ")", ".", "Don", "t", "need", "split", "info", "since", "it", "applies", "to", "entire", "lo...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1275-L1302
[ "def", "filter_maxhet", "(", "data", ",", "superints", ",", "edgearr", ")", ":", "## the filter max", "## The type of max_shared_Hs_locus is determined and the cast to either", "## int or float is made at assembly load time", "maxhet", "=", "data", ".", "paramsdict", "[", "\"ma...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
filter_indels
Filter max indels. Needs to split to apply to each read separately. The dimensions of superseqs are (chunk, sum(sidx), maxlen).
ipyrad/assemble/write_outfiles.py
def filter_indels(data, superints, edgearr): """ Filter max indels. Needs to split to apply to each read separately. The dimensions of superseqs are (chunk, sum(sidx), maxlen). """ maxinds = np.array(data.paramsdict["max_Indels_locus"]).astype(np.int64) ## an empty array to fill with failed lo...
def filter_indels(data, superints, edgearr): """ Filter max indels. Needs to split to apply to each read separately. The dimensions of superseqs are (chunk, sum(sidx), maxlen). """ maxinds = np.array(data.paramsdict["max_Indels_locus"]).astype(np.int64) ## an empty array to fill with failed lo...
[ "Filter", "max", "indels", ".", "Needs", "to", "split", "to", "apply", "to", "each", "read", "separately", ".", "The", "dimensions", "of", "superseqs", "are", "(", "chunk", "sum", "(", "sidx", ")", "maxlen", ")", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1306-L1355
[ "def", "filter_indels", "(", "data", ",", "superints", ",", "edgearr", ")", ":", "maxinds", "=", "np", ".", "array", "(", "data", ".", "paramsdict", "[", "\"max_Indels_locus\"", "]", ")", ".", "astype", "(", "np", ".", "int64", ")", "## an empty array to f...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
maxind_numba
filter for indels
ipyrad/assemble/write_outfiles.py
def maxind_numba(block): """ filter for indels """ ## remove terminal edges inds = 0 for row in xrange(block.shape[0]): where = np.where(block[row] != 45)[0] if len(where) == 0: obs = 100 else: left = np.min(where) right = np.max(where) ...
def maxind_numba(block): """ filter for indels """ ## remove terminal edges inds = 0 for row in xrange(block.shape[0]): where = np.where(block[row] != 45)[0] if len(where) == 0: obs = 100 else: left = np.min(where) right = np.max(where) ...
[ "filter", "for", "indels" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1360-L1374
[ "def", "maxind_numba", "(", "block", ")", ":", "## remove terminal edges", "inds", "=", "0", "for", "row", "in", "xrange", "(", "block", ".", "shape", "[", "0", "]", ")", ":", "where", "=", "np", ".", "where", "(", "block", "[", "row", "]", "!=", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make_outfiles
Get desired formats from paramsdict and write files to outfiles directory.
ipyrad/assemble/write_outfiles.py
def make_outfiles(data, samples, output_formats, ipyclient): """ Get desired formats from paramsdict and write files to outfiles directory. """ ## will iterate optim loci at a time with h5py.File(data.clust_database, 'r') as io5: optim = io5["seqs"].attrs["chunksize"][0] nloci =...
def make_outfiles(data, samples, output_formats, ipyclient): """ Get desired formats from paramsdict and write files to outfiles directory. """ ## will iterate optim loci at a time with h5py.File(data.clust_database, 'r') as io5: optim = io5["seqs"].attrs["chunksize"][0] nloci =...
[ "Get", "desired", "formats", "from", "paramsdict", "and", "write", "files", "to", "outfiles", "directory", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1413-L1520
[ "def", "make_outfiles", "(", "data", ",", "samples", ",", "output_formats", ",", "ipyclient", ")", ":", "## will iterate optim loci at a time", "with", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r'", ")", "as", "io5", ":", "optim", "=", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
worker_make_arrays
Parallelized worker to build array chunks for output files. One main goal here is to keep seqarr to less than ~1GB RAM.
ipyrad/assemble/write_outfiles.py
def worker_make_arrays(data, sidx, hslice, optim, maxlen): """ Parallelized worker to build array chunks for output files. One main goal here is to keep seqarr to less than ~1GB RAM. """ ## big data arrays io5 = h5py.File(data.clust_database, 'r') co5 = h5py.File(data.database, 'r') ...
def worker_make_arrays(data, sidx, hslice, optim, maxlen): """ Parallelized worker to build array chunks for output files. One main goal here is to keep seqarr to less than ~1GB RAM. """ ## big data arrays io5 = h5py.File(data.clust_database, 'r') co5 = h5py.File(data.database, 'r') ...
[ "Parallelized", "worker", "to", "build", "array", "chunks", "for", "output", "files", ".", "One", "main", "goal", "here", "is", "to", "keep", "seqarr", "to", "less", "than", "~1GB", "RAM", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1613-L1714
[ "def", "worker_make_arrays", "(", "data", ",", "sidx", ",", "hslice", ",", "optim", ",", "maxlen", ")", ":", "## big data arrays", "io5", "=", "h5py", ".", "File", "(", "data", ".", "clust_database", ",", "'r'", ")", "co5", "=", "h5py", ".", "File", "(...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_phy
write the phylip output file from the tmparr[seqarray]
ipyrad/assemble/write_outfiles.py
def write_phy(data, sidx, pnames): """ write the phylip output file from the tmparr[seqarray] """ ## grab seq data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: seqarr = io5["seqarr"]...
def write_phy(data, sidx, pnames): """ write the phylip output file from the tmparr[seqarray] """ ## grab seq data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: seqarr = io5["seqarr"]...
[ "write", "the", "phylip", "output", "file", "from", "the", "tmparr", "[", "seqarray", "]" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1718-L1744
[ "def", "write_phy", "(", "data", ",", "sidx", ",", "pnames", ")", ":", "## grab seq data from tmparr", "start", "=", "time", ".", "time", "(", ")", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "\"tmp-{...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_nex
write the nexus output file from the tmparr[seqarray] and tmparr[maparr]
ipyrad/assemble/write_outfiles.py
def write_nex(data, sidx, pnames): """ write the nexus output file from the tmparr[seqarray] and tmparr[maparr] """ ## grab seq data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: s...
def write_nex(data, sidx, pnames): """ write the nexus output file from the tmparr[seqarray] and tmparr[maparr] """ ## grab seq data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: s...
[ "write", "the", "nexus", "output", "file", "from", "the", "tmparr", "[", "seqarray", "]", "and", "tmparr", "[", "maparr", "]" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1748-L1796
[ "def", "write_nex", "(", "data", ",", "sidx", ",", "pnames", ")", ":", "## grab seq data from tmparr", "start", "=", "time", ".", "time", "(", ")", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "\"tmp-{...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_snps_map
write a map file with linkage information for SNPs file
ipyrad/assemble/write_outfiles.py
def write_snps_map(data): """ write a map file with linkage information for SNPs file""" ## grab map data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: maparr = io5["maparr"][:] ## get...
def write_snps_map(data): """ write a map file with linkage information for SNPs file""" ## grab map data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: maparr = io5["maparr"][:] ## get...
[ "write", "a", "map", "file", "with", "linkage", "information", "for", "SNPs", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1801-L1833
[ "def", "write_snps_map", "(", "data", ")", ":", "## grab map data from tmparr", "start", "=", "time", ".", "time", "(", ")", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "\"tmp-{}.h5\"", ".", "format", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_usnps
write the bisnp string
ipyrad/assemble/write_outfiles.py
def write_usnps(data, sidx, pnames): """ write the bisnp string """ ## grab bis data from tmparr tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: bisarr = io5["bisarr"] ## trim to size b/c it was made longer than actual ...
def write_usnps(data, sidx, pnames): """ write the bisnp string """ ## grab bis data from tmparr tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: bisarr = io5["bisarr"] ## trim to size b/c it was made longer than actual ...
[ "write", "the", "bisnp", "string" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1862-L1881
[ "def", "write_usnps", "(", "data", ",", "sidx", ",", "pnames", ")", ":", "## grab bis data from tmparr", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "\"tmp-{}.h5\"", ".", "format", "(", "data", ".", "na...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_str
Write STRUCTURE format for all SNPs and unlinked SNPs
ipyrad/assemble/write_outfiles.py
def write_str(data, sidx, pnames): """ Write STRUCTURE format for all SNPs and unlinked SNPs """ ## grab snp and bis data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: snparr = io5["snparr"] ...
def write_str(data, sidx, pnames): """ Write STRUCTURE format for all SNPs and unlinked SNPs """ ## grab snp and bis data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) with h5py.File(tmparrs, 'r') as io5: snparr = io5["snparr"] ...
[ "Write", "STRUCTURE", "format", "for", "all", "SNPs", "and", "unlinked", "SNPs" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1885-L1937
[ "def", "write_str", "(", "data", ",", "sidx", ",", "pnames", ")", ":", "## grab snp and bis data from tmparr", "start", "=", "time", ".", "time", "(", ")", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_geno
write the geno output formerly used by admixture, still supported by adegenet, perhaps. Also, sNMF still likes .geno.
ipyrad/assemble/write_outfiles.py
def write_geno(data, sidx): """ write the geno output formerly used by admixture, still supported by adegenet, perhaps. Also, sNMF still likes .geno. """ ## grab snp and bis data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) ...
def write_geno(data, sidx): """ write the geno output formerly used by admixture, still supported by adegenet, perhaps. Also, sNMF still likes .geno. """ ## grab snp and bis data from tmparr start = time.time() tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) ...
[ "write", "the", "geno", "output", "formerly", "used", "by", "admixture", "still", "supported", "by", "adegenet", "perhaps", ".", "Also", "sNMF", "still", "likes", ".", "geno", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L1941-L2013
[ "def", "write_geno", "(", "data", ",", "sidx", ")", ":", "## grab snp and bis data from tmparr", "start", "=", "time", ".", "time", "(", ")", "tmparrs", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "\"tmp-{}.h5\"", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_gphocs
write the g-phocs output. This code is hella ugly bcz it's copy/pasted directly from the old loci2gphocs script from pyrad. I figure having it get done the stupid way is better than not having it done at all, at least for the time being. This could probably be sped up significantly.
ipyrad/assemble/write_outfiles.py
def write_gphocs(data, sidx): """ write the g-phocs output. This code is hella ugly bcz it's copy/pasted directly from the old loci2gphocs script from pyrad. I figure having it get done the stupid way is better than not having it done at all, at least for the time being. This could probably be sped ...
def write_gphocs(data, sidx): """ write the g-phocs output. This code is hella ugly bcz it's copy/pasted directly from the old loci2gphocs script from pyrad. I figure having it get done the stupid way is better than not having it done at all, at least for the time being. This could probably be sped ...
[ "write", "the", "g", "-", "phocs", "output", ".", "This", "code", "is", "hella", "ugly", "bcz", "it", "s", "copy", "/", "pasted", "directly", "from", "the", "old", "loci2gphocs", "script", "from", "pyrad", ".", "I", "figure", "having", "it", "get", "do...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2017-L2074
[ "def", "write_gphocs", "(", "data", ",", "sidx", ")", ":", "outfile", "=", "data", ".", "outfiles", ".", "gphocs", "infile", "=", "data", ".", "outfiles", ".", "loci", "infile", "=", "open", "(", "infile", ")", "outfile", "=", "open", "(", "outfile", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make_vcf
Write the full VCF for loci passing filtering. Other vcf formats are possible, like SNPs-only, or with filtered loci included but the filter explicitly labeled. These are not yet supported, however.
ipyrad/assemble/write_outfiles.py
def make_vcf(data, samples, ipyclient, full=0): """ Write the full VCF for loci passing filtering. Other vcf formats are possible, like SNPs-only, or with filtered loci included but the filter explicitly labeled. These are not yet supported, however. """ ## start vcf progress bar start = tim...
def make_vcf(data, samples, ipyclient, full=0): """ Write the full VCF for loci passing filtering. Other vcf formats are possible, like SNPs-only, or with filtered loci included but the filter explicitly labeled. These are not yet supported, however. """ ## start vcf progress bar start = tim...
[ "Write", "the", "full", "VCF", "for", "loci", "passing", "filtering", ".", "Other", "vcf", "formats", "are", "possible", "like", "SNPs", "-", "only", "or", "with", "filtered", "loci", "included", "but", "the", "filter", "explicitly", "labeled", ".", "These",...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2078-L2177
[ "def", "make_vcf", "(", "data", ",", "samples", ",", "ipyclient", ",", "full", "=", "0", ")", ":", "## start vcf progress bar", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" building vcf file | {} | s7 |\"", "LOGGER", ".", "info", "(", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
concat_vcf
Sorts, concatenates, and gzips VCF chunks. Also cleans up chunks.
ipyrad/assemble/write_outfiles.py
def concat_vcf(data, names, full): """ Sorts, concatenates, and gzips VCF chunks. Also cleans up chunks. """ ## open handle and write headers if not full: writer = open(data.outfiles.vcf, 'w') else: writer = gzip.open(data.outfiles.VCF, 'w') vcfheader(data, names, writer) ...
def concat_vcf(data, names, full): """ Sorts, concatenates, and gzips VCF chunks. Also cleans up chunks. """ ## open handle and write headers if not full: writer = open(data.outfiles.vcf, 'w') else: writer = gzip.open(data.outfiles.VCF, 'w') vcfheader(data, names, writer) ...
[ "Sorts", "concatenates", "and", "gzips", "VCF", "chunks", ".", "Also", "cleans", "up", "chunks", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2181-L2225
[ "def", "concat_vcf", "(", "data", ",", "names", ",", "full", ")", ":", "## open handle and write headers", "if", "not", "full", ":", "writer", "=", "open", "(", "data", ".", "outfiles", ".", "vcf", ",", "'w'", ")", "else", ":", "writer", "=", "gzip", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
vcfchunk
Function called within make_vcf to run chunks on separate engines.
ipyrad/assemble/write_outfiles.py
def vcfchunk(data, optim, sidx, chunk, full): """ Function called within make_vcf to run chunks on separate engines. """ ## empty array to be filled before writing ## will not actually be optim*maxlen, extra needs to be trimmed maxlen = data._hackersonly["max_fragment_length"] + 20 ## get d...
def vcfchunk(data, optim, sidx, chunk, full): """ Function called within make_vcf to run chunks on separate engines. """ ## empty array to be filled before writing ## will not actually be optim*maxlen, extra needs to be trimmed maxlen = data._hackersonly["max_fragment_length"] + 20 ## get d...
[ "Function", "called", "within", "make_vcf", "to", "run", "chunks", "on", "separate", "engines", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2229-L2455
[ "def", "vcfchunk", "(", "data", ",", "optim", ",", "sidx", ",", "chunk", ",", "full", ")", ":", "## empty array to be filled before writing", "## will not actually be optim*maxlen, extra needs to be trimmed", "maxlen", "=", "data", ".", "_hackersonly", "[", "\"max_fragmen...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
reftrick
Returns the most common base at each site in order.
ipyrad/assemble/write_outfiles.py
def reftrick(iseq, consdict): """ Returns the most common base at each site in order. """ altrefs = np.zeros((iseq.shape[1], 4), dtype=np.uint8) altrefs[:, 1] = 46 for col in xrange(iseq.shape[1]): ## expand colums with ambigs and remove N- fcounts = np.zeros(111, dtype=np.int64) ...
def reftrick(iseq, consdict): """ Returns the most common base at each site in order. """ altrefs = np.zeros((iseq.shape[1], 4), dtype=np.uint8) altrefs[:, 1] = 46 for col in xrange(iseq.shape[1]): ## expand colums with ambigs and remove N- fcounts = np.zeros(111, dtype=np.int64) ...
[ "Returns", "the", "most", "common", "base", "at", "each", "site", "in", "order", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2460-L2502
[ "def", "reftrick", "(", "iseq", ",", "consdict", ")", ":", "altrefs", "=", "np", ".", "zeros", "(", "(", "iseq", ".", "shape", "[", "1", "]", ",", "4", ")", ",", "dtype", "=", "np", ".", "uint8", ")", "altrefs", "[", ":", ",", "1", "]", "=", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
vcfheader
Prints header for vcf files
ipyrad/assemble/write_outfiles.py
def vcfheader(data, names, ofile): """ Prints header for vcf files """ ## choose reference string if data.paramsdict["reference_sequence"]: reference = data.paramsdict["reference_sequence"] else: reference = "pseudo-reference (most common base at site)" ##FILTER=<ID=minCov,...
def vcfheader(data, names, ofile): """ Prints header for vcf files """ ## choose reference string if data.paramsdict["reference_sequence"]: reference = data.paramsdict["reference_sequence"] else: reference = "pseudo-reference (most common base at site)" ##FILTER=<ID=minCov,...
[ "Prints", "header", "for", "vcf", "files" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/write_outfiles.py#L2565-L2597
[ "def", "vcfheader", "(", "data", ",", "names", ",", "ofile", ")", ":", "## choose reference string", "if", "data", ".", "paramsdict", "[", "\"reference_sequence\"", "]", ":", "reference", "=", "data", ".", "paramsdict", "[", "\"reference_sequence\"", "]", "else"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
loci2bpp
Converts loci file format to bpp file format, i.e., concatenated phylip-like format, and produces imap and ctl input files for bpp. Parameters: ----------- name: A prefix name for output files that will be produced locifile: A .loci file produced by ipyrad. imap: A Pytho...
ipyrad/file_conversion/loci2bpp.py
def loci2bpp(name, locifile, imap, guidetree, minmap=None, maxloci=None, infer_sptree=0, infer_delimit=0, delimit_alg=(0, 5), seed=12345, burnin=1000, nsample=10000, sampfreq=2, thetaprior=(5, 5), tauprior=(4, 2, 1), traits_df=None, nu=0, kappa=0, useseqdata=1...
def loci2bpp(name, locifile, imap, guidetree, minmap=None, maxloci=None, infer_sptree=0, infer_delimit=0, delimit_alg=(0, 5), seed=12345, burnin=1000, nsample=10000, sampfreq=2, thetaprior=(5, 5), tauprior=(4, 2, 1), traits_df=None, nu=0, kappa=0, useseqdata=1...
[ "Converts", "loci", "file", "format", "to", "bpp", "file", "format", "i", ".", "e", ".", "concatenated", "phylip", "-", "like", "format", "and", "produces", "imap", "and", "ctl", "input", "files", "for", "bpp", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2bpp.py#L21-L233
[ "def", "loci2bpp", "(", "name", ",", "locifile", ",", "imap", ",", "guidetree", ",", "minmap", "=", "None", ",", "maxloci", "=", "None", ",", "infer_sptree", "=", "0", ",", "infer_delimit", "=", "0", ",", "delimit_alg", "=", "(", "0", ",", "5", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
write_ctl
write outfile with any args in argdict
ipyrad/file_conversion/loci2bpp.py
def write_ctl(name, imap, guidetree, nloci, infer_sptree, infer_delimit, delimit_alg, seed, burnin, nsample, sampfreq, thetaprior, tauprior, traits_df, nu0, kappa0, cleandata, useseqdata, usetraitdata, wdir, finetune, verbose): """ write outfile...
def write_ctl(name, imap, guidetree, nloci, infer_sptree, infer_delimit, delimit_alg, seed, burnin, nsample, sampfreq, thetaprior, tauprior, traits_df, nu0, kappa0, cleandata, useseqdata, usetraitdata, wdir, finetune, verbose): """ write outfile...
[ "write", "outfile", "with", "any", "args", "in", "argdict" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2bpp.py#L237-L380
[ "def", "write_ctl", "(", "name", ",", "imap", ",", "guidetree", ",", "nloci", ",", "infer_sptree", ",", "infer_delimit", ",", "delimit_alg", ",", "seed", ",", "burnin", ",", "nsample", ",", "sampfreq", ",", "thetaprior", ",", "tauprior", ",", "traits_df", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_collapse_outgroup
collapse outgroup in ete Tree for easier viewing
ipyrad/analysis/tree.py
def _collapse_outgroup(tree, taxdicts): """ collapse outgroup in ete Tree for easier viewing """ ## check that all tests have the same outgroup outg = taxdicts[0]["p4"] if not all([i["p4"] == outg for i in taxdicts]): raise Exception("no good") ## prune tree, keep only one sample from ou...
def _collapse_outgroup(tree, taxdicts): """ collapse outgroup in ete Tree for easier viewing """ ## check that all tests have the same outgroup outg = taxdicts[0]["p4"] if not all([i["p4"] == outg for i in taxdicts]): raise Exception("no good") ## prune tree, keep only one sample from ou...
[ "collapse", "outgroup", "in", "ete", "Tree", "for", "easier", "viewing" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tree.py#L176-L199
[ "def", "_collapse_outgroup", "(", "tree", ",", "taxdicts", ")", ":", "## check that all tests have the same outgroup", "outg", "=", "taxdicts", "[", "0", "]", "[", "\"p4\"", "]", "if", "not", "all", "(", "[", "i", "[", "\"p4\"", "]", "==", "outg", "for", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_decompose_tree
decomposes tree into component parts for plotting
ipyrad/analysis/tree.py
def _decompose_tree(ttree, orient='right', use_edge_lengths=True): """ decomposes tree into component parts for plotting """ ## set attributes ttree._orient = orient ttree._use_edge_lengths = use_edge_lengths ult = use_edge_lengths == False ## map numeric values to internal nodes from root to...
def _decompose_tree(ttree, orient='right', use_edge_lengths=True): """ decomposes tree into component parts for plotting """ ## set attributes ttree._orient = orient ttree._use_edge_lengths = use_edge_lengths ult = use_edge_lengths == False ## map numeric values to internal nodes from root to...
[ "decomposes", "tree", "into", "component", "parts", "for", "plotting" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tree.py#L204-L306
[ "def", "_decompose_tree", "(", "ttree", ",", "orient", "=", "'right'", ",", "use_edge_lengths", "=", "True", ")", ":", "## set attributes", "ttree", ".", "_orient", "=", "orient", "ttree", ".", "_use_edge_lengths", "=", "use_edge_lengths", "ult", "=", "use_edge_...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
Tree.draw
plot the tree using toyplot.graph. Parameters: ----------- show_tip_labels: bool Show tip names from tree. use_edge_lengths: bool Use edge lengths from newick tree. show_node_support: bool Show support values at nodes ...
ipyrad/analysis/tree.py
def draw( self, show_tip_labels=True, show_node_support=False, use_edge_lengths=False, orient="right", print_args=False, *args, **kwargs): """ plot the tree using toyplot.graph. Parameters: ----------- show_...
def draw( self, show_tip_labels=True, show_node_support=False, use_edge_lengths=False, orient="right", print_args=False, *args, **kwargs): """ plot the tree using toyplot.graph. Parameters: ----------- show_...
[ "plot", "the", "tree", "using", "toyplot", ".", "graph", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tree.py#L92-L127
[ "def", "draw", "(", "self", ",", "show_tip_labels", "=", "True", ",", "show_node_support", "=", "False", ",", "use_edge_lengths", "=", "False", ",", "orient", "=", "\"right\"", ",", "print_args", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
tree_panel_plot
signature...
ipyrad/plotting/tree_panel_plot.py
def tree_panel_plot(ttree, print_args=False, *args, **kwargs): """ signature... """ ## create Panel plot object and set height & width panel = Panel(ttree) #tree, edges, verts, names) if not kwargs.get("width"): panel.kwargs["width"] = min(1000, 25*len(panel.tree))...
def tree_panel_plot(ttree, print_args=False, *args, **kwargs): """ signature... """ ## create Panel plot object and set height & width panel = Panel(ttree) #tree, edges, verts, names) if not kwargs.get("width"): panel.kwargs["width"] = min(1000, 25*len(panel.tree))...
[ "signature", "..." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/tree_panel_plot.py#L152-L216
[ "def", "tree_panel_plot", "(", "ttree", ",", "print_args", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "## create Panel plot object and set height & width", "panel", "=", "Panel", "(", "ttree", ")", "#tree, edges, verts, names)", "if", "not"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_quick_depths
iterate over clustS files to get data
ipyrad/assemble/cluster_within.py
def get_quick_depths(data, sample): """ iterate over clustS files to get data """ ## use existing sample cluster path if it exists, since this ## func can be used in step 4 and that can occur after merging ## assemblies after step3, and if we then referenced by data.dirs.clusts ## the path would be...
def get_quick_depths(data, sample): """ iterate over clustS files to get data """ ## use existing sample cluster path if it exists, since this ## func can be used in step 4 and that can occur after merging ## assemblies after step3, and if we then referenced by data.dirs.clusts ## the path would be...
[ "iterate", "over", "clustS", "files", "to", "get", "data" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L46-L105
[ "def", "get_quick_depths", "(", "data", ",", "sample", ")", ":", "## use existing sample cluster path if it exists, since this", "## func can be used in step 4 and that can occur after merging", "## assemblies after step3, and if we then referenced by data.dirs.clusts", "## the path would be b...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
sample_cleanup
stats, cleanup, and link to samples
ipyrad/assemble/cluster_within.py
def sample_cleanup(data, sample): """ stats, cleanup, and link to samples """ ## get maxlen and depths array from clusters maxlens, depths = get_quick_depths(data, sample) try: depths.max() except ValueError: ## If depths is an empty array max() will raise print(" no clu...
def sample_cleanup(data, sample): """ stats, cleanup, and link to samples """ ## get maxlen and depths array from clusters maxlens, depths = get_quick_depths(data, sample) try: depths.max() except ValueError: ## If depths is an empty array max() will raise print(" no clu...
[ "stats", "cleanup", "and", "link", "to", "samples" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L109-L201
[ "def", "sample_cleanup", "(", "data", ",", "sample", ")", ":", "## get maxlen and depths array from clusters", "maxlens", ",", "depths", "=", "get_quick_depths", "(", "data", ",", "sample", ")", "try", ":", "depths", ".", "max", "(", ")", "except", "ValueError",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
persistent_popen_align3
keeps a persistent bash shell open and feeds it muscle alignments
ipyrad/assemble/cluster_within.py
def persistent_popen_align3(clusts, maxseqs=200, is_gbs=False): """ keeps a persistent bash shell open and feeds it muscle alignments """ ## create a separate shell for running muscle in, this is much faster ## than spawning a separate subprocess for each muscle call proc = sps.Popen(["bash"], ...
def persistent_popen_align3(clusts, maxseqs=200, is_gbs=False): """ keeps a persistent bash shell open and feeds it muscle alignments """ ## create a separate shell for running muscle in, this is much faster ## than spawning a separate subprocess for each muscle call proc = sps.Popen(["bash"], ...
[ "keeps", "a", "persistent", "bash", "shell", "open", "and", "feeds", "it", "muscle", "alignments" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L206-L353
[ "def", "persistent_popen_align3", "(", "clusts", ",", "maxseqs", "=", "200", ",", "is_gbs", "=", "False", ")", ":", "## create a separate shell for running muscle in, this is much faster", "## than spawning a separate subprocess for each muscle call", "proc", "=", "sps", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
gbs_trim
No reads can go past the left of the seed, or right of the least extended reverse complement match. Example below. m is a match. u is an area where lots of mismatches typically occur. The cut sites are shown. Original locus* Seed TGCAG************************************-----------------...
ipyrad/assemble/cluster_within.py
def gbs_trim(align1): """ No reads can go past the left of the seed, or right of the least extended reverse complement match. Example below. m is a match. u is an area where lots of mismatches typically occur. The cut sites are shown. Original locus* Seed TGCAG*******************...
def gbs_trim(align1): """ No reads can go past the left of the seed, or right of the least extended reverse complement match. Example below. m is a match. u is an area where lots of mismatches typically occur. The cut sites are shown. Original locus* Seed TGCAG*******************...
[ "No", "reads", "can", "go", "past", "the", "left", "of", "the", "seed", "or", "right", "of", "the", "least", "extended", "reverse", "complement", "match", ".", "Example", "below", ".", "m", "is", "a", "match", ".", "u", "is", "an", "area", "where", "...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L356-L400
[ "def", "gbs_trim", "(", "align1", ")", ":", "leftmost", "=", "rightmost", "=", "None", "dd", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "[", "j", ".", "rsplit", "(", "\"\\n\"", ",", "1", ")", "for", "j", "in", "align1", "]", "}", "s...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
align_and_parse
much faster implementation for aligning chunks
ipyrad/assemble/cluster_within.py
def align_and_parse(handle, max_internal_indels=5, is_gbs=False): """ much faster implementation for aligning chunks """ ## data are already chunked, read in the whole thing. bail if no data. try: with open(handle, 'rb') as infile: clusts = infile.read().split("//\n//\n") ##...
def align_and_parse(handle, max_internal_indels=5, is_gbs=False): """ much faster implementation for aligning chunks """ ## data are already chunked, read in the whole thing. bail if no data. try: with open(handle, 'rb') as infile: clusts = infile.read().split("//\n//\n") ##...
[ "much", "faster", "implementation", "for", "aligning", "chunks" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L408-L463
[ "def", "align_and_parse", "(", "handle", ",", "max_internal_indels", "=", "5", ",", "is_gbs", "=", "False", ")", ":", "## data are already chunked, read in the whole thing. bail if no data.", "try", ":", "with", "open", "(", "handle", ",", "'rb'", ")", "as", "infile...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
aligned_indel_filter
checks for too many internal indels in muscle aligned clusters
ipyrad/assemble/cluster_within.py
def aligned_indel_filter(clust, max_internal_indels): """ checks for too many internal indels in muscle aligned clusters """ ## make into list lclust = clust.split() ## paired or not try: seq1 = [i.split("nnnn")[0] for i in lclust[1::2]] seq2 = [i.split("nnnn")[1] for i in lclu...
def aligned_indel_filter(clust, max_internal_indels): """ checks for too many internal indels in muscle aligned clusters """ ## make into list lclust = clust.split() ## paired or not try: seq1 = [i.split("nnnn")[0] for i in lclust[1::2]] seq2 = [i.split("nnnn")[1] for i in lclu...
[ "checks", "for", "too", "many", "internal", "indels", "in", "muscle", "aligned", "clusters" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L467-L489
[ "def", "aligned_indel_filter", "(", "clust", ",", "max_internal_indels", ")", ":", "## make into list", "lclust", "=", "clust", ".", "split", "(", ")", "## paired or not", "try", ":", "seq1", "=", "[", "i", ".", "split", "(", "\"nnnn\"", ")", "[", "0", "]"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_clusters
Combines information from .utemp and .htemp files to create .clust files, which contain un-aligned clusters. Hits to seeds are only kept in the cluster if the number of internal indels is less than 'maxindels'. By default, we set maxindels=6 for this step (within-sample clustering).
ipyrad/assemble/cluster_within.py
def build_clusters(data, sample, maxindels): """ Combines information from .utemp and .htemp files to create .clust files, which contain un-aligned clusters. Hits to seeds are only kept in the cluster if the number of internal indels is less than 'maxindels'. By default, we set maxindels=6 for this ...
def build_clusters(data, sample, maxindels): """ Combines information from .utemp and .htemp files to create .clust files, which contain un-aligned clusters. Hits to seeds are only kept in the cluster if the number of internal indels is less than 'maxindels'. By default, we set maxindels=6 for this ...
[ "Combines", "information", "from", ".", "utemp", "and", ".", "htemp", "files", "to", "create", ".", "clust", "files", "which", "contain", "un", "-", "aligned", "clusters", ".", "Hits", "to", "seeds", "are", "only", "kept", "in", "the", "cluster", "if", "...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L493-L618
[ "def", "build_clusters", "(", "data", ",", "sample", ",", "maxindels", ")", ":", "## If reference assembly then here we're clustering the unmapped reads", "if", "\"reference\"", "in", "data", ".", "paramsdict", "[", "\"assembly_method\"", "]", ":", "derepfile", "=", "os...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
setup_dirs
sets up directories for step3 data
ipyrad/assemble/cluster_within.py
def setup_dirs(data): """ sets up directories for step3 data """ ## make output folder for clusters pdir = os.path.realpath(data.paramsdict["project_dir"]) data.dirs.clusts = os.path.join(pdir, "{}_clust_{}"\ .format(data.name, data.paramsdict["clust_threshold"])) if not os.pa...
def setup_dirs(data): """ sets up directories for step3 data """ ## make output folder for clusters pdir = os.path.realpath(data.paramsdict["project_dir"]) data.dirs.clusts = os.path.join(pdir, "{}_clust_{}"\ .format(data.name, data.paramsdict["clust_threshold"])) if not os.pa...
[ "sets", "up", "directories", "for", "step3", "data" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L622-L642
[ "def", "setup_dirs", "(", "data", ")", ":", "## make output folder for clusters", "pdir", "=", "os", ".", "path", ".", "realpath", "(", "data", ".", "paramsdict", "[", "\"project_dir\"", "]", ")", "data", ".", "dirs", ".", "clusts", "=", "os", ".", "path",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
new_apply_jobs
Create a DAG of prealign jobs to be run in order for each sample. Track Progress, report errors. Each assembly method has a slightly different DAG setup, calling different functions.
ipyrad/assemble/cluster_within.py
def new_apply_jobs(data, samples, ipyclient, nthreads, maxindels, force): """ Create a DAG of prealign jobs to be run in order for each sample. Track Progress, report errors. Each assembly method has a slightly different DAG setup, calling different functions. """ ## is datatype gbs? used in al...
def new_apply_jobs(data, samples, ipyclient, nthreads, maxindels, force): """ Create a DAG of prealign jobs to be run in order for each sample. Track Progress, report errors. Each assembly method has a slightly different DAG setup, calling different functions. """ ## is datatype gbs? used in al...
[ "Create", "a", "DAG", "of", "prealign", "jobs", "to", "be", "run", "in", "order", "for", "each", "sample", ".", "Track", "Progress", "report", "errors", ".", "Each", "assembly", "method", "has", "a", "slightly", "different", "DAG", "setup", "calling", "dif...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L646-L763
[ "def", "new_apply_jobs", "(", "data", ",", "samples", ",", "ipyclient", ",", "nthreads", ",", "maxindels", ",", "force", ")", ":", "## is datatype gbs? used in alignment-trimming by align_and_parse()", "is_gbs", "=", "bool", "(", "\"gbs\"", "in", "data", ".", "param...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_dag
build a directed acyclic graph describing jobs to be run in order.
ipyrad/assemble/cluster_within.py
def build_dag(data, samples): """ build a directed acyclic graph describing jobs to be run in order. """ ## Create DAGs for the assembly method being used, store jobs in nodes snames = [i.name for i in samples] dag = nx.DiGraph() ## get list of pre-align jobs from globals based on assembly...
def build_dag(data, samples): """ build a directed acyclic graph describing jobs to be run in order. """ ## Create DAGs for the assembly method being used, store jobs in nodes snames = [i.name for i in samples] dag = nx.DiGraph() ## get list of pre-align jobs from globals based on assembly...
[ "build", "a", "directed", "acyclic", "graph", "describing", "jobs", "to", "be", "run", "in", "order", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L770-L820
[ "def", "build_dag", "(", "data", ",", "samples", ")", ":", "## Create DAGs for the assembly method being used, store jobs in nodes", "snames", "=", "[", "i", ".", "name", "for", "i", "in", "samples", "]", "dag", "=", "nx", ".", "DiGraph", "(", ")", "## get list ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_plot_dag
makes plot to help visualize the DAG setup. For developers only.
ipyrad/assemble/cluster_within.py
def _plot_dag(dag, results, snames): """ makes plot to help visualize the DAG setup. For developers only. """ try: import matplotlib.pyplot as plt from matplotlib.dates import date2num from matplotlib.cm import gist_rainbow ## first figure is dag layout plt.figur...
def _plot_dag(dag, results, snames): """ makes plot to help visualize the DAG setup. For developers only. """ try: import matplotlib.pyplot as plt from matplotlib.dates import date2num from matplotlib.cm import gist_rainbow ## first figure is dag layout plt.figur...
[ "makes", "plot", "to", "help", "visualize", "the", "DAG", "setup", ".", "For", "developers", "only", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L824-L870
[ "def", "_plot_dag", "(", "dag", ",", "results", ",", "snames", ")", ":", "try", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "from", "matplotlib", ".", "dates", "import", "date2num", "from", "matplotlib", ".", "cm", "import", "gist_rainbow", "#...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
trackjobs
Blocks and prints progress for just the func being requested from a list of submitted engine jobs. Returns whether any of the jobs failed. func = str results = dict of asyncs
ipyrad/assemble/cluster_within.py
def trackjobs(func, results, spacer): """ Blocks and prints progress for just the func being requested from a list of submitted engine jobs. Returns whether any of the jobs failed. func = str results = dict of asyncs """ ## TODO: try to insert a better way to break on KBD here. LOGGER....
def trackjobs(func, results, spacer): """ Blocks and prints progress for just the func being requested from a list of submitted engine jobs. Returns whether any of the jobs failed. func = str results = dict of asyncs """ ## TODO: try to insert a better way to break on KBD here. LOGGER....
[ "Blocks", "and", "prints", "progress", "for", "just", "the", "func", "being", "requested", "from", "a", "list", "of", "submitted", "engine", "jobs", ".", "Returns", "whether", "any", "of", "the", "jobs", "failed", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L874-L909
[ "def", "trackjobs", "(", "func", ",", "results", ",", "spacer", ")", ":", "## TODO: try to insert a better way to break on KBD here.", "LOGGER", ".", "info", "(", "\"inside trackjobs of %s\"", ",", "func", ")", "## get just the jobs from results that are relevant to this func",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
declone_3rad
3rad uses random adapters to identify pcr duplicates. We will remove pcr dupes here. Basically append the radom adapter to each sequence, do a regular old vsearch derep, then trim off the adapter, and push it down the pipeline. This will remove all identical seqs with identical random i5 adapters.
ipyrad/assemble/cluster_within.py
def declone_3rad(data, sample): """ 3rad uses random adapters to identify pcr duplicates. We will remove pcr dupes here. Basically append the radom adapter to each sequence, do a regular old vsearch derep, then trim off the adapter, and push it down the pipeline. This will remove all identical s...
def declone_3rad(data, sample): """ 3rad uses random adapters to identify pcr duplicates. We will remove pcr dupes here. Basically append the radom adapter to each sequence, do a regular old vsearch derep, then trim off the adapter, and push it down the pipeline. This will remove all identical s...
[ "3rad", "uses", "random", "adapters", "to", "identify", "pcr", "duplicates", ".", "We", "will", "remove", "pcr", "dupes", "here", ".", "Basically", "append", "the", "radom", "adapter", "to", "each", "sequence", "do", "a", "regular", "old", "vsearch", "derep"...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L926-L1048
[ "def", "declone_3rad", "(", "data", ",", "sample", ")", ":", "LOGGER", ".", "info", "(", "\"Entering declone_3rad - {}\"", ".", "format", "(", "sample", ".", "name", ")", ")", "## Append i5 adapter to the head of each read. Merged file is input, and", "## still has fq qua...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
derep_and_sort
Dereplicates reads and sorts so reads that were highly replicated are at the top, and singletons at bottom, writes output to derep file. Paired reads are dereplicated as one concatenated read and later split again. Updated this function to take infile and outfile to support the double dereplication that...
ipyrad/assemble/cluster_within.py
def derep_and_sort(data, infile, outfile, nthreads): """ Dereplicates reads and sorts so reads that were highly replicated are at the top, and singletons at bottom, writes output to derep file. Paired reads are dereplicated as one concatenated read and later split again. Updated this function to tak...
def derep_and_sort(data, infile, outfile, nthreads): """ Dereplicates reads and sorts so reads that were highly replicated are at the top, and singletons at bottom, writes output to derep file. Paired reads are dereplicated as one concatenated read and later split again. Updated this function to tak...
[ "Dereplicates", "reads", "and", "sorts", "so", "reads", "that", "were", "highly", "replicated", "are", "at", "the", "top", "and", "singletons", "at", "bottom", "writes", "output", "to", "derep", "file", ".", "Paired", "reads", "are", "dereplicated", "as", "o...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1052-L1098
[ "def", "derep_and_sort", "(", "data", ",", "infile", ",", "outfile", ",", "nthreads", ")", ":", "## datatypes options", "strand", "=", "\"plus\"", "if", "\"gbs\"", "in", "data", ".", "paramsdict", "[", "\"datatype\"", "]", "or", "\"2brad\"", "in", "data", "....
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
data_cleanup
cleanup / statswriting function for Assembly obj
ipyrad/assemble/cluster_within.py
def data_cleanup(data): """ cleanup / statswriting function for Assembly obj """ data.stats_dfs.s3 = data._build_stat("s3") data.stats_files.s3 = os.path.join(data.dirs.clusts, "s3_cluster_stats.txt") with io.open(data.stats_files.s3, 'w') as outfile: data.stats_dfs.s3.to_string( buf...
def data_cleanup(data): """ cleanup / statswriting function for Assembly obj """ data.stats_dfs.s3 = data._build_stat("s3") data.stats_files.s3 = os.path.join(data.dirs.clusts, "s3_cluster_stats.txt") with io.open(data.stats_files.s3, 'w') as outfile: data.stats_dfs.s3.to_string( buf...
[ "cleanup", "/", "statswriting", "function", "for", "Assembly", "obj" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1102-L1120
[ "def", "data_cleanup", "(", "data", ")", ":", "data", ".", "stats_dfs", ".", "s3", "=", "data", ".", "_build_stat", "(", "\"s3\"", ")", "data", ".", "stats_files", ".", "s3", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "clus...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
concat_multiple_edits
if multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding.
ipyrad/assemble/cluster_within.py
def concat_multiple_edits(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.edits) > 1: ## create a cat command to append them all (doesn...
def concat_multiple_edits(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.edits) > 1: ## create a cat command to append them all (doesn...
[ "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/cluster_within.py#L1124-L1157
[ "def", "concat_multiple_edits", "(", "data", ",", "sample", ")", ":", "## if more than one tuple in fastq list", "if", "len", "(", "sample", ".", "files", ".", "edits", ")", ">", "1", ":", "## create a cat command to append them all (doesn't matter if they", "## are gzipp...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cluster
Calls vsearch for clustering. cov varies by data type, values were chosen based on experience, but could be edited by users
ipyrad/assemble/cluster_within.py
def cluster(data, sample, nthreads, force): """ Calls vsearch for clustering. cov varies by data type, values were chosen based on experience, but could be edited by users """ ## get the dereplicated reads if "reference" in data.paramsdict["assembly_method"]: derephandle = os.path.join(...
def cluster(data, sample, nthreads, force): """ Calls vsearch for clustering. cov varies by data type, values were chosen based on experience, but could be edited by users """ ## get the dereplicated reads if "reference" in data.paramsdict["assembly_method"]: derephandle = os.path.join(...
[ "Calls", "vsearch", "for", "clustering", ".", "cov", "varies", "by", "data", "type", "values", "were", "chosen", "based", "on", "experience", "but", "could", "be", "edited", "by", "users" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1161-L1263
[ "def", "cluster", "(", "data", ",", "sample", ",", "nthreads", ",", "force", ")", ":", "## get the dereplicated reads", "if", "\"reference\"", "in", "data", ".", "paramsdict", "[", "\"assembly_method\"", "]", ":", "derephandle", "=", "os", ".", "path", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
muscle_chunker
Splits the muscle alignment into chunks. Each chunk is run on a separate computing core. Because the largest clusters are at the beginning of the clusters file, assigning equal clusters to each file would put all of the large cluster, that take longer to align, near the top. So instead we randomly di...
ipyrad/assemble/cluster_within.py
def muscle_chunker(data, sample): """ Splits the muscle alignment into chunks. Each chunk is run on a separate computing core. Because the largest clusters are at the beginning of the clusters file, assigning equal clusters to each file would put all of the large cluster, that take longer to align...
def muscle_chunker(data, sample): """ Splits the muscle alignment into chunks. Each chunk is run on a separate computing core. Because the largest clusters are at the beginning of the clusters file, assigning equal clusters to each file would put all of the large cluster, that take longer to align...
[ "Splits", "the", "muscle", "alignment", "into", "chunks", ".", "Each", "chunk", "is", "run", "on", "a", "separate", "computing", "core", ".", "Because", "the", "largest", "clusters", "are", "at", "the", "beginning", "of", "the", "clusters", "file", "assignin...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1267-L1319
[ "def", "muscle_chunker", "(", "data", ",", "sample", ")", ":", "## log our location for debugging", "LOGGER", ".", "info", "(", "\"inside muscle_chunker\"", ")", "## only chunk up denovo data, refdata has its own chunking method which ", "## makes equal size chunks, instead of uneven...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
reconcat
takes aligned chunks (usually 10) and concatenates them
ipyrad/assemble/cluster_within.py
def reconcat(data, sample): """ takes aligned chunks (usually 10) and concatenates them """ try: ## get chunks chunks = glob.glob(os.path.join(data.tmpdir, sample.name+"_chunk_[0-9].aligned")) ## sort by chunk number, cuts off last 8 =(aligned) chunks.sort(key=...
def reconcat(data, sample): """ takes aligned chunks (usually 10) and concatenates them """ try: ## get chunks chunks = glob.glob(os.path.join(data.tmpdir, sample.name+"_chunk_[0-9].aligned")) ## sort by chunk number, cuts off last 8 =(aligned) chunks.sort(key=...
[ "takes", "aligned", "chunks", "(", "usually", "10", ")", "and", "concatenates", "them" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1323-L1350
[ "def", "reconcat", "(", "data", ",", "sample", ")", ":", "try", ":", "## get chunks", "chunks", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "data", ".", "tmpdir", ",", "sample", ".", "name", "+", "\"_chunk_[0-9].aligned\"", ")",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
derep_concat_split
Running on remote Engine. Refmaps, then merges, then dereplicates, then denovo clusters reads.
ipyrad/assemble/cluster_within.py
def derep_concat_split(data, sample, nthreads, force): """ Running on remote Engine. Refmaps, then merges, then dereplicates, then denovo clusters reads. """ ## report location for debugging LOGGER.info("INSIDE derep %s", sample.name) ## MERGED ASSEMBIES ONLY: ## concatenate edits file...
def derep_concat_split(data, sample, nthreads, force): """ Running on remote Engine. Refmaps, then merges, then dereplicates, then denovo clusters reads. """ ## report location for debugging LOGGER.info("INSIDE derep %s", sample.name) ## MERGED ASSEMBIES ONLY: ## concatenate edits file...
[ "Running", "on", "remote", "Engine", ".", "Refmaps", "then", "merges", "then", "dereplicates", "then", "denovo", "clusters", "reads", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1354-L1411
[ "def", "derep_concat_split", "(", "data", ",", "sample", ",", "nthreads", ",", "force", ")", ":", "## report location for debugging", "LOGGER", ".", "info", "(", "\"INSIDE derep %s\"", ",", "sample", ".", "name", ")", "## MERGED ASSEMBIES ONLY:", "## concatenate edits...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run
run the major functions for clustering within samples
ipyrad/assemble/cluster_within.py
def run(data, samples, noreverse, maxindels, force, ipyclient): """ run the major functions for clustering within samples """ ## list of samples to submit to queue subsamples = [] ## if sample is already done skip for sample in samples: ## If sample not in state 2 don't try to cluster it. ...
def run(data, samples, noreverse, maxindels, force, ipyclient): """ run the major functions for clustering within samples """ ## list of samples to submit to queue subsamples = [] ## if sample is already done skip for sample in samples: ## If sample not in state 2 don't try to cluster it. ...
[ "run", "the", "major", "functions", "for", "clustering", "within", "samples" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1429-L1508
[ "def", "run", "(", "data", ",", "samples", ",", "noreverse", ",", "maxindels", ",", "force", ",", "ipyclient", ")", ":", "## list of samples to submit to queue", "subsamples", "=", "[", "]", "## if sample is already done skip", "for", "sample", "in", "samples", ":...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
parse_params
Parse the params file args, create and return Assembly object.
ipyrad/__main__.py
def parse_params(args): """ Parse the params file args, create and return Assembly object.""" ## check that params.txt file is correctly formatted. try: with open(args.params) as paramsin: plines = paramsin.readlines() except IOError as _: sys.exit(" No params file found") ...
def parse_params(args): """ Parse the params file args, create and return Assembly object.""" ## check that params.txt file is correctly formatted. try: with open(args.params) as paramsin: plines = paramsin.readlines() except IOError as _: sys.exit(" No params file found") ...
[ "Parse", "the", "params", "file", "args", "create", "and", "return", "Assembly", "object", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L25-L69
[ "def", "parse_params", "(", "args", ")", ":", "## check that params.txt file is correctly formatted.", "try", ":", "with", "open", "(", "args", ".", "params", ")", "as", "paramsin", ":", "plines", "=", "paramsin", ".", "readlines", "(", ")", "except", "IOError",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
showstats
loads assembly or dies, and print stats to screen
ipyrad/__main__.py
def showstats(parsedict): """ loads assembly or dies, and print stats to screen """ #project_dir = parsedict['1'] project_dir = parsedict["project_dir"] if not project_dir: project_dir = "./" ## Be nice if somebody also puts in the file extension #assembly_name = parsedict['0'] asse...
def showstats(parsedict): """ loads assembly or dies, and print stats to screen """ #project_dir = parsedict['1'] project_dir = parsedict["project_dir"] if not project_dir: project_dir = "./" ## Be nice if somebody also puts in the file extension #assembly_name = parsedict['0'] asse...
[ "loads", "assembly", "or", "dies", "and", "print", "stats", "to", "screen" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L73-L123
[ "def", "showstats", "(", "parsedict", ")", ":", "#project_dir = parsedict['1']", "project_dir", "=", "parsedict", "[", "\"project_dir\"", "]", "if", "not", "project_dir", ":", "project_dir", "=", "\"./\"", "## Be nice if somebody also puts in the file extension", "#assembly...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
branch_assembly
Load the passed in assembly and create a branch. Copy it to a new assembly, and also write out the appropriate params.txt
ipyrad/__main__.py
def branch_assembly(args, parsedict): """ Load the passed in assembly and create a branch. Copy it to a new assembly, and also write out the appropriate params.txt """ ## Get the current assembly data = getassembly(args, parsedict) ## get arguments to branch command bargs = args.bran...
def branch_assembly(args, parsedict): """ Load the passed in assembly and create a branch. Copy it to a new assembly, and also write out the appropriate params.txt """ ## Get the current assembly data = getassembly(args, parsedict) ## get arguments to branch command bargs = args.bran...
[ "Load", "the", "passed", "in", "assembly", "and", "create", "a", "branch", ".", "Copy", "it", "to", "a", "new", "assembly", "and", "also", "write", "out", "the", "appropriate", "params", ".", "txt" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L127-L183
[ "def", "branch_assembly", "(", "args", ",", "parsedict", ")", ":", "## Get the current assembly", "data", "=", "getassembly", "(", "args", ",", "parsedict", ")", "## get arguments to branch command", "bargs", "=", "args", ".", "branch", "## get new name, trim off .txt i...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
merge_assemblies
merge all given assemblies into a new assembly. Copies the params from the first passed in extant assembly. this function is called with the ipyrad -m flag. You must pass it at least 3 values, the first is a new assembly name (a new `param-newname.txt` will be created). The second and third args must b...
ipyrad/__main__.py
def merge_assemblies(args): """ merge all given assemblies into a new assembly. Copies the params from the first passed in extant assembly. this function is called with the ipyrad -m flag. You must pass it at least 3 values, the first is a new assembly name (a new `param-newname.txt` will be creat...
def merge_assemblies(args): """ merge all given assemblies into a new assembly. Copies the params from the first passed in extant assembly. this function is called with the ipyrad -m flag. You must pass it at least 3 values, the first is a new assembly name (a new `param-newname.txt` will be creat...
[ "merge", "all", "given", "assemblies", "into", "a", "new", "assembly", ".", "Copies", "the", "params", "from", "the", "first", "passed", "in", "extant", "assembly", ".", "this", "function", "is", "called", "with", "the", "ipyrad", "-", "m", "flag", ".", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L187-L233
[ "def", "merge_assemblies", "(", "args", ")", ":", "print", "(", "\"\\n Merging assemblies: {}\"", ".", "format", "(", "args", ".", "merge", "[", "1", ":", "]", ")", ")", "## Make sure there are the right number of args", "if", "len", "(", "args", ".", "merge", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
getassembly
loads assembly or creates a new one and set its params from parsedict. Does not launch ipcluster.
ipyrad/__main__.py
def getassembly(args, parsedict): """ loads assembly or creates a new one and set its params from parsedict. Does not launch ipcluster. """ ## Creating an assembly with a full path in the name will "work" ## but it is potentially dangerous, so here we have assembly_name ## and assembly_f...
def getassembly(args, parsedict): """ loads assembly or creates a new one and set its params from parsedict. Does not launch ipcluster. """ ## Creating an assembly with a full path in the name will "work" ## but it is potentially dangerous, so here we have assembly_name ## and assembly_f...
[ "loads", "assembly", "or", "creates", "a", "new", "one", "and", "set", "its", "params", "from", "parsedict", ".", "Does", "not", "launch", "ipcluster", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L237-L296
[ "def", "getassembly", "(", "args", ",", "parsedict", ")", ":", "## Creating an assembly with a full path in the name will \"work\"", "## but it is potentially dangerous, so here we have assembly_name", "## and assembly_file, name is used for creating new in cwd, file is", "## used for loading ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_check_version
Test if there's a newer version and nag the user to upgrade.
ipyrad/__main__.py
def _check_version(): """ Test if there's a newer version and nag the user to upgrade.""" import urllib2 from distutils.version import LooseVersion header = \ "\n -------------------------------------------------------------"+\ "\n ipyrad [v.{}]".format(ip.__version__)+\ "\n Interactive a...
def _check_version(): """ Test if there's a newer version and nag the user to upgrade.""" import urllib2 from distutils.version import LooseVersion header = \ "\n -------------------------------------------------------------"+\ "\n ipyrad [v.{}]".format(ip.__version__)+\ "\n Interactive a...
[ "Test", "if", "there", "s", "a", "newer", "version", "and", "nag", "the", "user", "to", "upgrade", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L300-L325
[ "def", "_check_version", "(", ")", ":", "import", "urllib2", "from", "distutils", ".", "version", "import", "LooseVersion", "header", "=", "\"\\n -------------------------------------------------------------\"", "+", "\"\\n ipyrad [v.{}]\"", ".", "format", "(", "ip", "."...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
main
main function
ipyrad/__main__.py
def main(): """ main function """ ## turn off traceback for the CLI ip.__interactive__ = 0 ## Check for a new version on anaconda _check_version() ## parse params file input (returns to stdout if --help or --version) args = parse_command_line() ## Turn the debug output written to ipyr...
def main(): """ main function """ ## turn off traceback for the CLI ip.__interactive__ = 0 ## Check for a new version on anaconda _check_version() ## parse params file input (returns to stdout if --help or --version) args = parse_command_line() ## Turn the debug output written to ipyr...
[ "main", "function" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__main__.py#L453-L605
[ "def", "main", "(", ")", ":", "## turn off traceback for the CLI", "ip", ".", "__interactive__", "=", "0", "## Check for a new version on anaconda", "_check_version", "(", ")", "## parse params file input (returns to stdout if --help or --version)", "args", "=", "parse_command_li...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_binom
return probability of base call
ipyrad/assemble/consens_se.py
def get_binom(base1, base2, estE, estH): """ return probability of base call """ prior_homo = (1. - estH) / 2. prior_hete = estH ## calculate probs bsum = base1 + base2 hetprob = scipy.misc.comb(bsum, base1)/(2. **(bsum)) homoa = scipy.stats.binom.pmf(base2, bsum, estE)...
def get_binom(base1, base2, estE, estH): """ return probability of base call """ prior_homo = (1. - estH) / 2. prior_hete = estH ## calculate probs bsum = base1 + base2 hetprob = scipy.misc.comb(bsum, base1)/(2. **(bsum)) homoa = scipy.stats.binom.pmf(base2, bsum, estE)...
[ "return", "probability", "of", "base", "call" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L36-L63
[ "def", "get_binom", "(", "base1", ",", "base2", ",", "estE", ",", "estH", ")", ":", "prior_homo", "=", "(", "1.", "-", "estH", ")", "/", "2.", "prior_hete", "=", "estH", "## calculate probs", "bsum", "=", "base1", "+", "base2", "hetprob", "=", "scipy",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
removerepeats
Checks for interior Ns in consensus seqs and removes those that are at low depth, here defined as less than 1/3 of the average depth. The prop 1/3 is chosen so that mindepth=6 requires 2 base calls that are not in [N,-].
ipyrad/assemble/consens_se.py
def removerepeats(consens, arrayed): """ Checks for interior Ns in consensus seqs and removes those that are at low depth, here defined as less than 1/3 of the average depth. The prop 1/3 is chosen so that mindepth=6 requires 2 base calls that are not in [N,-]. """ ## default trim no edges ...
def removerepeats(consens, arrayed): """ Checks for interior Ns in consensus seqs and removes those that are at low depth, here defined as less than 1/3 of the average depth. The prop 1/3 is chosen so that mindepth=6 requires 2 base calls that are not in [N,-]. """ ## default trim no edges ...
[ "Checks", "for", "interior", "Ns", "in", "consensus", "seqs", "and", "removes", "those", "that", "are", "at", "low", "depth", "here", "defined", "as", "less", "than", "1", "/", "3", "of", "the", "average", "depth", ".", "The", "prop", "1", "/", "3", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L67-L146
[ "def", "removerepeats", "(", "consens", ",", "arrayed", ")", ":", "## default trim no edges", "consens", "=", "\"\"", ".", "join", "(", "consens", ")", ".", "replace", "(", "\"-\"", ",", "\"N\"", ")", "## split for pairs", "try", ":", "cons1", ",", "cons2", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
newconsensus
new faster replacement to consensus
ipyrad/assemble/consens_se.py
def newconsensus(data, sample, tmpchunk, optim): """ new faster replacement to consensus """ ## do reference map funcs? isref = "reference" in data.paramsdict["assembly_method"] ## temporarily store the mean estimates to Assembly data._este = data.stats.error_est.mean() data._esth = d...
def newconsensus(data, sample, tmpchunk, optim): """ new faster replacement to consensus """ ## do reference map funcs? isref = "reference" in data.paramsdict["assembly_method"] ## temporarily store the mean estimates to Assembly data._este = data.stats.error_est.mean() data._esth = d...
[ "new", "faster", "replacement", "to", "consensus" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L150-L337
[ "def", "newconsensus", "(", "data", ",", "sample", ",", "tmpchunk", ",", "optim", ")", ":", "## do reference map funcs?", "isref", "=", "\"reference\"", "in", "data", ".", "paramsdict", "[", "\"assembly_method\"", "]", "## temporarily store the mean estimates to Assembl...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
basecaller
call all sites in a locus array.
ipyrad/assemble/consens_se.py
def basecaller(arrayed, mindepth_majrule, mindepth_statistical, estH, estE): """ call all sites in a locus array. """ ## an array to fill with consensus site calls cons = np.zeros(arrayed.shape[1], dtype=np.uint8) cons.fill(78) arr = arrayed.view(np.uint8) ## iterate over columns ...
def basecaller(arrayed, mindepth_majrule, mindepth_statistical, estH, estE): """ call all sites in a locus array. """ ## an array to fill with consensus site calls cons = np.zeros(arrayed.shape[1], dtype=np.uint8) cons.fill(78) arr = arrayed.view(np.uint8) ## iterate over columns ...
[ "call", "all", "sites", "in", "a", "locus", "array", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L341-L417
[ "def", "basecaller", "(", "arrayed", ",", "mindepth_majrule", ",", "mindepth_statistical", ",", "estH", ",", "estE", ")", ":", "## an array to fill with consensus site calls", "cons", "=", "np", ".", "zeros", "(", "arrayed", ".", "shape", "[", "1", "]", ",", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
nfilter1
applies read depths filter
ipyrad/assemble/consens_se.py
def nfilter1(data, reps): """ applies read depths filter """ if sum(reps) >= data.paramsdict["mindepth_majrule"] and \ sum(reps) <= data.paramsdict["maxdepth"]: return 1 else: return 0
def nfilter1(data, reps): """ applies read depths filter """ if sum(reps) >= data.paramsdict["mindepth_majrule"] and \ sum(reps) <= data.paramsdict["maxdepth"]: return 1 else: return 0
[ "applies", "read", "depths", "filter" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L438-L444
[ "def", "nfilter1", "(", "data", ",", "reps", ")", ":", "if", "sum", "(", "reps", ")", ">=", "data", ".", "paramsdict", "[", "\"mindepth_majrule\"", "]", "and", "sum", "(", "reps", ")", "<=", "data", ".", "paramsdict", "[", "\"maxdepth\"", "]", ":", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
nfilter4
applies max haplotypes filter returns pass and consens
ipyrad/assemble/consens_se.py
def nfilter4(consens, hidx, arrayed): """ applies max haplotypes filter returns pass and consens""" ## if less than two Hs then there is only one allele if len(hidx) < 2: return consens, 1 ## store base calls for hetero sites harray = arrayed[:, hidx] ## remove any reads that have N o...
def nfilter4(consens, hidx, arrayed): """ applies max haplotypes filter returns pass and consens""" ## if less than two Hs then there is only one allele if len(hidx) < 2: return consens, 1 ## store base calls for hetero sites harray = arrayed[:, hidx] ## remove any reads that have N o...
[ "applies", "max", "haplotypes", "filter", "returns", "pass", "and", "consens" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L470-L521
[ "def", "nfilter4", "(", "consens", ",", "hidx", ",", "arrayed", ")", ":", "## if less than two Hs then there is only one allele", "if", "len", "(", "hidx", ")", "<", "2", ":", "return", "consens", ",", "1", "## store base calls for hetero sites", "harray", "=", "a...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
storealleles
store phased allele data for diploids
ipyrad/assemble/consens_se.py
def storealleles(consens, hidx, alleles): """ store phased allele data for diploids """ ## find the first hetero site and choose the priority base ## example, if W: then priority base in A and not T. PRIORITY=(order: CATG) bigbase = PRIORITY[consens[hidx[0]]] ## find which allele has priority based...
def storealleles(consens, hidx, alleles): """ store phased allele data for diploids """ ## find the first hetero site and choose the priority base ## example, if W: then priority base in A and not T. PRIORITY=(order: CATG) bigbase = PRIORITY[consens[hidx[0]]] ## find which allele has priority based...
[ "store", "phased", "allele", "data", "for", "diploids" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L525-L545
[ "def", "storealleles", "(", "consens", ",", "hidx", ",", "alleles", ")", ":", "## find the first hetero site and choose the priority base", "## example, if W: then priority base in A and not T. PRIORITY=(order: CATG)", "bigbase", "=", "PRIORITY", "[", "consens", "[", "hidx", "[...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cleanup
cleaning up. optim is the size (nloci) of tmp arrays
ipyrad/assemble/consens_se.py
def cleanup(data, sample, statsdicts): """ cleaning up. optim is the size (nloci) of tmp arrays """ LOGGER.info("in cleanup for: %s", sample.name) isref = 'reference' in data.paramsdict["assembly_method"] ## collect consens chunk files combs1 = glob.glob(os.path.join( ...
def cleanup(data, sample, statsdicts): """ cleaning up. optim is the size (nloci) of tmp arrays """ LOGGER.info("in cleanup for: %s", sample.name) isref = 'reference' in data.paramsdict["assembly_method"] ## collect consens chunk files combs1 = glob.glob(os.path.join( ...
[ "cleaning", "up", ".", "optim", "is", "the", "size", "(", "nloci", ")", "of", "tmp", "arrays" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L549-L655
[ "def", "cleanup", "(", "data", ",", "sample", ",", "statsdicts", ")", ":", "LOGGER", ".", "info", "(", "\"in cleanup for: %s\"", ",", "sample", ".", "name", ")", "isref", "=", "'reference'", "in", "data", ".", "paramsdict", "[", "\"assembly_method\"", "]", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
chunk_clusters
split job into bits and pass to the client
ipyrad/assemble/consens_se.py
def chunk_clusters(data, sample): """ split job into bits and pass to the client """ ## counter for split job submission num = 0 ## set optim size for chunks in N clusters. The first few chunks take longer ## because they contain larger clusters, so we create 4X as many chunks as ## processors...
def chunk_clusters(data, sample): """ split job into bits and pass to the client """ ## counter for split job submission num = 0 ## set optim size for chunks in N clusters. The first few chunks take longer ## because they contain larger clusters, so we create 4X as many chunks as ## processors...
[ "split", "job", "into", "bits", "and", "pass", "to", "the", "client" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L659-L693
[ "def", "chunk_clusters", "(", "data", ",", "sample", ")", ":", "## counter for split job submission", "num", "=", "0", "## set optim size for chunks in N clusters. The first few chunks take longer", "## because they contain larger clusters, so we create 4X as many chunks as", "## process...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_subsamples
Apply state, ncluster, and force filters to select samples to be run.
ipyrad/assemble/consens_se.py
def get_subsamples(data, samples, force): """ Apply state, ncluster, and force filters to select samples to be run. """ subsamples = [] for sample in samples: if not force: if sample.stats.state >= 5: print("""\ Skipping Sample {}; Already has consens reads. ...
def get_subsamples(data, samples, force): """ Apply state, ncluster, and force filters to select samples to be run. """ subsamples = [] for sample in samples: if not force: if sample.stats.state >= 5: print("""\ Skipping Sample {}; Already has consens reads. ...
[ "Apply", "state", "ncluster", "and", "force", "filters", "to", "select", "samples", "to", "be", "run", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L697-L752
[ "def", "get_subsamples", "(", "data", ",", "samples", ",", "force", ")", ":", "subsamples", "=", "[", "]", "for", "sample", "in", "samples", ":", "if", "not", "force", ":", "if", "sample", ".", "stats", ".", "state", ">=", "5", ":", "print", "(", "...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
run
checks if the sample should be run and passes the args
ipyrad/assemble/consens_se.py
def run(data, samples, force, ipyclient): """ checks if the sample should be run and passes the args """ ## prepare dirs data.dirs.consens = os.path.join(data.dirs.project, data.name+"_consens") if not os.path.exists(data.dirs.consens): os.mkdir(data.dirs.consens) ## zap any tmp files that ...
def run(data, samples, force, ipyclient): """ checks if the sample should be run and passes the args """ ## prepare dirs data.dirs.consens = os.path.join(data.dirs.project, data.name+"_consens") if not os.path.exists(data.dirs.consens): os.mkdir(data.dirs.consens) ## zap any tmp files that ...
[ "checks", "if", "the", "sample", "should", "be", "run", "and", "passes", "the", "args" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L756-L803
[ "def", "run", "(", "data", ",", "samples", ",", "force", ",", "ipyclient", ")", ":", "## prepare dirs", "data", ".", "dirs", ".", "consens", "=", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "project", ",", "data", ".", "name", "+...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
calculate_depths
check whether mindepth has changed, and thus whether clusters_hidepth needs to be recalculated, and get new maxlen for new highdepth clusts. if mindepth not changed then nothing changes.
ipyrad/assemble/consens_se.py
def calculate_depths(data, samples, lbview): """ check whether mindepth has changed, and thus whether clusters_hidepth needs to be recalculated, and get new maxlen for new highdepth clusts. if mindepth not changed then nothing changes. """ ## send jobs to be processed on engines start = tim...
def calculate_depths(data, samples, lbview): """ check whether mindepth has changed, and thus whether clusters_hidepth needs to be recalculated, and get new maxlen for new highdepth clusts. if mindepth not changed then nothing changes. """ ## send jobs to be processed on engines start = tim...
[ "check", "whether", "mindepth", "has", "changed", "and", "thus", "whether", "clusters_hidepth", "needs", "to", "be", "recalculated", "and", "get", "new", "maxlen", "for", "new", "highdepth", "clusts", ".", "if", "mindepth", "not", "changed", "then", "nothing", ...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L807-L845
[ "def", "calculate_depths", "(", "data", ",", "samples", ",", "lbview", ")", ":", "## send jobs to be processed on engines", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" calculating depths | {} | s5 |\"", "recaljobs", "=", "{", "}", "maxlens",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make_chunks
calls chunk_clusters and tracks progress.
ipyrad/assemble/consens_se.py
def make_chunks(data, samples, lbview): """ calls chunk_clusters and tracks progress. """ ## first progress bar start = time.time() printstr = " chunking clusters | {} | s5 |" elapsed = datetime.timedelta(seconds=int(time.time()-start)) progressbar(10, 0, printstr.format(elapsed), sp...
def make_chunks(data, samples, lbview): """ calls chunk_clusters and tracks progress. """ ## first progress bar start = time.time() printstr = " chunking clusters | {} | s5 |" elapsed = datetime.timedelta(seconds=int(time.time()-start)) progressbar(10, 0, printstr.format(elapsed), sp...
[ "calls", "chunk_clusters", "and", "tracks", "progress", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L849-L880
[ "def", "make_chunks", "(", "data", ",", "samples", ",", "lbview", ")", ":", "## first progress bar", "start", "=", "time", ".", "time", "(", ")", "printstr", "=", "\" chunking clusters | {} | s5 |\"", "elapsed", "=", "datetime", ".", "timedelta", "(", "secon...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
process_chunks
submit chunks to consens func and ...
ipyrad/assemble/consens_se.py
def process_chunks(data, samples, lasyncs, lbview): """ submit chunks to consens func and ... """ ## send chunks to be processed start = time.time() asyncs = {sample.name:[] for sample in samples} printstr = " consens calling | {} | s5 |" ## get chunklist from results for sam...
def process_chunks(data, samples, lasyncs, lbview): """ submit chunks to consens func and ... """ ## send chunks to be processed start = time.time() asyncs = {sample.name:[] for sample in samples} printstr = " consens calling | {} | s5 |" ## get chunklist from results for sam...
[ "submit", "chunks", "to", "consens", "func", "and", "..." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/consens_se.py#L884-L962
[ "def", "process_chunks", "(", "data", ",", "samples", ",", "lasyncs", ",", "lbview", ")", ":", "## send chunks to be processed", "start", "=", "time", ".", "time", "(", ")", "asyncs", "=", "{", "sample", ".", "name", ":", "[", "]", "for", "sample", "in",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make
reads in .loci and builds alleles from case characters
ipyrad/file_conversion/loci2alleles.py
def make(data, samples): """ reads in .loci and builds alleles from case characters """ #read in loci file outfile = open(os.path.join(data.dirs.outfiles, data.name+".alleles"), 'w') lines = open(os.path.join(data.dirs.outfiles, data.name+".loci"), 'r') ## Get the longest sample name for prett...
def make(data, samples): """ reads in .loci and builds alleles from case characters """ #read in loci file outfile = open(os.path.join(data.dirs.outfiles, data.name+".alleles"), 'w') lines = open(os.path.join(data.dirs.outfiles, data.name+".loci"), 'r') ## Get the longest sample name for prett...
[ "reads", "in", ".", "loci", "and", "builds", "alleles", "from", "case", "characters" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2alleles.py#L12-L48
[ "def", "make", "(", "data", ",", "samples", ")", ":", "#read in loci file", "outfile", "=", "open", "(", "os", ".", "path", ".", "join", "(", "data", ".", "dirs", ".", "outfiles", ",", "data", ".", "name", "+", "\".alleles\"", ")", ",", "'w'", ")", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
make
builds snps output
ipyrad/file_conversion/loci2SNP.py
def make(data, samples): """ builds snps output """ ## get attr ploidy = data.paramsdict["max_alleles_consens"] names = [i.name for i in samples] longname = max([len(i) for i in names]) ## TODO: use iter cuz of super huge files inloci = open(os.path.join(\ data.dirs.outf...
def make(data, samples): """ builds snps output """ ## get attr ploidy = data.paramsdict["max_alleles_consens"] names = [i.name for i in samples] longname = max([len(i) for i in names]) ## TODO: use iter cuz of super huge files inloci = open(os.path.join(\ data.dirs.outf...
[ "builds", "snps", "output" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2SNP.py#L14-L192
[ "def", "make", "(", "data", ",", "samples", ")", ":", "## get attr ", "ploidy", "=", "data", ".", "paramsdict", "[", "\"max_alleles_consens\"", "]", "names", "=", "[", "i", ".", "name", "for", "i", "in", "samples", "]", "longname", "=", "max", "(", "["...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
cluster_info
reports host and engine info for an ipyclient
ipyrad/__init__.py
def cluster_info(ipyclient, spacer=""): """ reports host and engine info for an ipyclient """ ## get engine data, skips busy engines. hosts = [] for eid in ipyclient.ids: engine = ipyclient[eid] if not engine.outstanding: hosts.append(engine.apply(_socket.gethostname)...
def cluster_info(ipyclient, spacer=""): """ reports host and engine info for an ipyclient """ ## get engine data, skips busy engines. hosts = [] for eid in ipyclient.ids: engine = ipyclient[eid] if not engine.outstanding: hosts.append(engine.apply(_socket.gethostname)...
[ "reports", "host", "and", "engine", "info", "for", "an", "ipyclient" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L65-L80
[ "def", "cluster_info", "(", "ipyclient", ",", "spacer", "=", "\"\"", ")", ":", "## get engine data, skips busy engines. ", "hosts", "=", "[", "]", "for", "eid", "in", "ipyclient", ".", "ids", ":", "engine", "=", "ipyclient", "[", "eid", "]", "if", "not", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_debug_on
Turns on debugging by creating hidden tmp file This is only run by the __main__ engine.
ipyrad/__init__.py
def _debug_on(): """ Turns on debugging by creating hidden tmp file This is only run by the __main__ engine. """ ## make tmp file and set loglevel for top-level init with open(__debugflag__, 'w') as dfile: dfile.write("wat") __loglevel__ = "DEBUG" _LOGGER.info("debugging turned o...
def _debug_on(): """ Turns on debugging by creating hidden tmp file This is only run by the __main__ engine. """ ## make tmp file and set loglevel for top-level init with open(__debugflag__, 'w') as dfile: dfile.write("wat") __loglevel__ = "DEBUG" _LOGGER.info("debugging turned o...
[ "Turns", "on", "debugging", "by", "creating", "hidden", "tmp", "file", "This", "is", "only", "run", "by", "the", "__main__", "engine", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L84-L94
[ "def", "_debug_on", "(", ")", ":", "## make tmp file and set loglevel for top-level init", "with", "open", "(", "__debugflag__", ",", "'w'", ")", "as", "dfile", ":", "dfile", ".", "write", "(", "\"wat\"", ")", "__loglevel__", "=", "\"DEBUG\"", "_LOGGER", ".", "i...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_set_debug_dict
set the debug dict
ipyrad/__init__.py
def _set_debug_dict(__loglevel__): """ set the debug dict """ _lconfig.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': "%(asctime)s \t"\ +"pid=%(process)d \t"\ +"[%(filename)s]\t"\ ...
def _set_debug_dict(__loglevel__): """ set the debug dict """ _lconfig.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': "%(asctime)s \t"\ +"pid=%(process)d \t"\ +"[%(filename)s]\t"\ ...
[ "set", "the", "debug", "dict" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L98-L130
[ "def", "_set_debug_dict", "(", "__loglevel__", ")", ":", "_lconfig", ".", "dictConfig", "(", "{", "'version'", ":", "1", ",", "'disable_existing_loggers'", ":", "False", ",", "'formatters'", ":", "{", "'standard'", ":", "{", "'format'", ":", "\"%(asctime)s \\t\"...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_debug_off
turns off debugging by removing hidden tmp file
ipyrad/__init__.py
def _debug_off(): """ turns off debugging by removing hidden tmp file """ if _os.path.exists(__debugflag__): _os.remove(__debugflag__) __loglevel__ = "ERROR" _LOGGER.info("debugging turned off") _set_debug_dict(__loglevel__)
def _debug_off(): """ turns off debugging by removing hidden tmp file """ if _os.path.exists(__debugflag__): _os.remove(__debugflag__) __loglevel__ = "ERROR" _LOGGER.info("debugging turned off") _set_debug_dict(__loglevel__)
[ "turns", "off", "debugging", "by", "removing", "hidden", "tmp", "file" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L135-L141
[ "def", "_debug_off", "(", ")", ":", "if", "_os", ".", "path", ".", "exists", "(", "__debugflag__", ")", ":", "_os", ".", "remove", "(", "__debugflag__", ")", "__loglevel__", "=", "\"ERROR\"", "_LOGGER", ".", "info", "(", "\"debugging turned off\"", ")", "_...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_cmd_exists
check if dependency program is there
ipyrad/__init__.py
def _cmd_exists(cmd): """ check if dependency program is there """ return _subprocess.call("type " + cmd, shell=True, stdout=_subprocess.PIPE, stderr=_subprocess.PIPE) == 0
def _cmd_exists(cmd): """ check if dependency program is there """ return _subprocess.call("type " + cmd, shell=True, stdout=_subprocess.PIPE, stderr=_subprocess.PIPE) == 0
[ "check", "if", "dependency", "program", "is", "there" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L145-L150
[ "def", "_cmd_exists", "(", "cmd", ")", ":", "return", "_subprocess", ".", "call", "(", "\"type \"", "+", "cmd", ",", "shell", "=", "True", ",", "stdout", "=", "_subprocess", ".", "PIPE", ",", "stderr", "=", "_subprocess", ".", "PIPE", ")", "==", "0" ]
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
_getbins
gets the right version of vsearch, muscle, and smalt depending on linux vs osx
ipyrad/__init__.py
def _getbins(): """ gets the right version of vsearch, muscle, and smalt depending on linux vs osx """ # Return error if system is 32-bit arch. # This is straight from the python docs: # https://docs.python.org/2/library/platform.html#cross-platform if not _sys.maxsize > 2**32: _sys.exi...
def _getbins(): """ gets the right version of vsearch, muscle, and smalt depending on linux vs osx """ # Return error if system is 32-bit arch. # This is straight from the python docs: # https://docs.python.org/2/library/platform.html#cross-platform if not _sys.maxsize > 2**32: _sys.exi...
[ "gets", "the", "right", "version", "of", "vsearch", "muscle", "and", "smalt", "depending", "on", "linux", "vs", "osx" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/__init__.py#L154-L233
[ "def", "_getbins", "(", ")", ":", "# Return error if system is 32-bit arch.", "# This is straight from the python docs:", "# https://docs.python.org/2/library/platform.html#cross-platform", "if", "not", "_sys", ".", "maxsize", ">", "2", "**", "32", ":", "_sys", ".", "exit", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
nworker
Worker to distribute work to jit funcs. Wraps everything on an engine to run single-threaded to maximize efficiency for multi-processing.
ipyrad/analysis/tetrad2.py
def nworker(data, chunk): """ Worker to distribute work to jit funcs. Wraps everything on an engine to run single-threaded to maximize efficiency for multi-processing. """ ## set the thread limit on the remote engine oldlimit = set_mkl_thread_limit(1) ## open seqarray view, the modif...
def nworker(data, chunk): """ Worker to distribute work to jit funcs. Wraps everything on an engine to run single-threaded to maximize efficiency for multi-processing. """ ## set the thread limit on the remote engine oldlimit = set_mkl_thread_limit(1) ## open seqarray view, the modif...
[ "Worker", "to", "distribute", "work", "to", "jit", "funcs", ".", "Wraps", "everything", "on", "an", "engine", "to", "run", "single", "-", "threaded", "to", "maximize", "efficiency", "for", "multi", "-", "processing", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L967-L1016
[ "def", "nworker", "(", "data", ",", "chunk", ")", ":", "## set the thread limit on the remote engine", "oldlimit", "=", "set_mkl_thread_limit", "(", "1", ")", "## open seqarray view, the modified arr is in bootstarr", "with", "h5py", ".", "File", "(", "data", ".", "data...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
store_all
Populate array with all possible quartets. This allows us to sample from the total, and also to continue from a checkpoint
ipyrad/analysis/tetrad2.py
def store_all(self): """ Populate array with all possible quartets. This allows us to sample from the total, and also to continue from a checkpoint """ with h5py.File(self.database.input, 'a') as io5: fillsets = io5["quartets"] ## generator for all quartet sets qiter = ite...
def store_all(self): """ Populate array with all possible quartets. This allows us to sample from the total, and also to continue from a checkpoint """ with h5py.File(self.database.input, 'a') as io5: fillsets = io5["quartets"] ## generator for all quartet sets qiter = ite...
[ "Populate", "array", "with", "all", "possible", "quartets", ".", "This", "allows", "us", "to", "sample", "from", "the", "total", "and", "also", "to", "continue", "from", "a", "checkpoint" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1095-L1115
[ "def", "store_all", "(", "self", ")", ":", "with", "h5py", ".", "File", "(", "self", ".", "database", ".", "input", ",", "'a'", ")", "as", "io5", ":", "fillsets", "=", "io5", "[", "\"quartets\"", "]", "## generator for all quartet sets", "qiter", "=", "i...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
store_random
Populate array with random quartets sampled from a generator. Holding all sets in memory might take a lot, but holding a very large list of random numbers for which ones to sample will fit into memory for most reasonable sized sets. So we'll load a list of random numbers in the range of the length of ...
ipyrad/analysis/tetrad2.py
def store_random(self): """ Populate array with random quartets sampled from a generator. Holding all sets in memory might take a lot, but holding a very large list of random numbers for which ones to sample will fit into memory for most reasonable sized sets. So we'll load a list of random nu...
def store_random(self): """ Populate array with random quartets sampled from a generator. Holding all sets in memory might take a lot, but holding a very large list of random numbers for which ones to sample will fit into memory for most reasonable sized sets. So we'll load a list of random nu...
[ "Populate", "array", "with", "random", "quartets", "sampled", "from", "a", "generator", ".", "Holding", "all", "sets", "in", "memory", "might", "take", "a", "lot", "but", "holding", "a", "very", "large", "list", "of", "random", "numbers", "for", "which", "...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1118-L1166
[ "def", "store_random", "(", "self", ")", ":", "with", "h5py", ".", "File", "(", "self", ".", "database", ".", "input", ",", "'a'", ")", "as", "io5", ":", "fillsets", "=", "io5", "[", "\"quartets\"", "]", "## set generators", "qiter", "=", "itertools", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
store_equal
Takes a tetrad class object and populates array with random quartets sampled equally among splits of the tree so that deep splits are not overrepresented relative to rare splits, like those near the tips.
ipyrad/analysis/tetrad2.py
def store_equal(self): """ Takes a tetrad class object and populates array with random quartets sampled equally among splits of the tree so that deep splits are not overrepresented relative to rare splits, like those near the tips. """ with h5py.File(self.database.input, 'a') as io5: ...
def store_equal(self): """ Takes a tetrad class object and populates array with random quartets sampled equally among splits of the tree so that deep splits are not overrepresented relative to rare splits, like those near the tips. """ with h5py.File(self.database.input, 'a') as io5: ...
[ "Takes", "a", "tetrad", "class", "object", "and", "populates", "array", "with", "random", "quartets", "sampled", "equally", "among", "splits", "of", "the", "tree", "so", "that", "deep", "splits", "are", "not", "overrepresented", "relative", "to", "rare", "spli...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1169-L1278
[ "def", "store_equal", "(", "self", ")", ":", "with", "h5py", ".", "File", "(", "self", ".", "database", ".", "input", ",", "'a'", ")", "as", "io5", ":", "fillsets", "=", "io5", "[", "\"quartets\"", "]", "## require guidetree", "if", "not", "os", ".", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
random_combination
Returns nsets unique random quartet sets sampled from n-choose-k without replacement combinations.
ipyrad/analysis/tetrad2.py
def random_combination(nsets, n, k): """ Returns nsets unique random quartet sets sampled from n-choose-k without replacement combinations. """ sets = set() while len(sets) < nsets: newset = tuple(sorted(np.random.choice(n, k, replace=False))) sets.add(newset) return tuple(se...
def random_combination(nsets, n, k): """ Returns nsets unique random quartet sets sampled from n-choose-k without replacement combinations. """ sets = set() while len(sets) < nsets: newset = tuple(sorted(np.random.choice(n, k, replace=False))) sets.add(newset) return tuple(se...
[ "Returns", "nsets", "unique", "random", "quartet", "sets", "sampled", "from", "n", "-", "choose", "-", "k", "without", "replacement", "combinations", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1298-L1307
[ "def", "random_combination", "(", "nsets", ",", "n", ",", "k", ")", ":", "sets", "=", "set", "(", ")", "while", "len", "(", "sets", ")", "<", "nsets", ":", "newset", "=", "tuple", "(", "sorted", "(", "np", ".", "random", ".", "choice", "(", "n", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
random_product
Random sampler for equal_splits functions
ipyrad/analysis/tetrad2.py
def random_product(iter1, iter2): """ Random sampler for equal_splits functions """ iter4 = np.concatenate([ np.random.choice(iter1, 2, replace=False), np.random.choice(iter2, 2, replace=False) ]) return iter4
def random_product(iter1, iter2): """ Random sampler for equal_splits functions """ iter4 = np.concatenate([ np.random.choice(iter1, 2, replace=False), np.random.choice(iter2, 2, replace=False) ]) return iter4
[ "Random", "sampler", "for", "equal_splits", "functions" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1310-L1318
[ "def", "random_product", "(", "iter1", ",", "iter2", ")", ":", "iter4", "=", "np", ".", "concatenate", "(", "[", "np", ".", "random", ".", "choice", "(", "iter1", ",", "2", ",", "replace", "=", "False", ")", ",", "np", ".", "random", ".", "choice",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
resolve_ambigs
Randomly resolve ambiguous bases. This is applied to each boot replicate so that over reps the random resolutions don't matter. Sites are randomly resolved, so best for unlinked SNPs since otherwise linked SNPs are losing their linkage information... though it's not like we're using it anyways.
ipyrad/analysis/tetrad2.py
def resolve_ambigs(tmpseq): """ Randomly resolve ambiguous bases. This is applied to each boot replicate so that over reps the random resolutions don't matter. Sites are randomly resolved, so best for unlinked SNPs since otherwise linked SNPs are losing their linkage information... though it'...
def resolve_ambigs(tmpseq): """ Randomly resolve ambiguous bases. This is applied to each boot replicate so that over reps the random resolutions don't matter. Sites are randomly resolved, so best for unlinked SNPs since otherwise linked SNPs are losing their linkage information... though it'...
[ "Randomly", "resolve", "ambiguous", "bases", ".", "This", "is", "applied", "to", "each", "boot", "replicate", "so", "that", "over", "reps", "the", "random", "resolutions", "don", "t", "matter", ".", "Sites", "are", "randomly", "resolved", "so", "best", "for"...
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1348-L1371
[ "def", "resolve_ambigs", "(", "tmpseq", ")", ":", "## the order of rows in GETCONS", "for", "aidx", "in", "xrange", "(", "6", ")", ":", "#np.uint([82, 75, 83, 89, 87, 77]):", "ambig", ",", "res1", ",", "res2", "=", "GETCONS", "[", "aidx", "]", "## get true whereve...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
set_mkl_thread_limit
set mkl thread limit and return old value so we can reset when finished.
ipyrad/analysis/tetrad2.py
def set_mkl_thread_limit(cores): """ set mkl thread limit and return old value so we can reset when finished. """ if "linux" in sys.platform: mkl_rt = ctypes.CDLL('libmkl_rt.so') else: mkl_rt = ctypes.CDLL('libmkl_rt.dylib') oldlimit = mkl_rt.mkl_get_max_threads() mkl_rt...
def set_mkl_thread_limit(cores): """ set mkl thread limit and return old value so we can reset when finished. """ if "linux" in sys.platform: mkl_rt = ctypes.CDLL('libmkl_rt.so') else: mkl_rt = ctypes.CDLL('libmkl_rt.dylib') oldlimit = mkl_rt.mkl_get_max_threads() mkl_rt...
[ "set", "mkl", "thread", "limit", "and", "return", "old", "value", "so", "we", "can", "reset", "when", "finished", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1479-L1490
[ "def", "set_mkl_thread_limit", "(", "cores", ")", ":", "if", "\"linux\"", "in", "sys", ".", "platform", ":", "mkl_rt", "=", "ctypes", ".", "CDLL", "(", "'libmkl_rt.so'", ")", "else", ":", "mkl_rt", "=", "ctypes", ".", "CDLL", "(", "'libmkl_rt.dylib'", ")",...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_total
get total number of quartets possible for a split
ipyrad/analysis/tetrad2.py
def get_total(tots, node): """ get total number of quartets possible for a split""" if (node.is_leaf() or node.is_root()): return 0 else: ## Get counts on down edges. ## How to treat polytomies here? if len(node.children) > 2: down_r = node.children[0] ...
def get_total(tots, node): """ get total number of quartets possible for a split""" if (node.is_leaf() or node.is_root()): return 0 else: ## Get counts on down edges. ## How to treat polytomies here? if len(node.children) > 2: down_r = node.children[0] ...
[ "get", "total", "number", "of", "quartets", "possible", "for", "a", "split" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1498-L1523
[ "def", "get_total", "(", "tots", ",", "node", ")", ":", "if", "(", "node", ".", "is_leaf", "(", ")", "or", "node", ".", "is_root", "(", ")", ")", ":", "return", "0", "else", ":", "## Get counts on down edges. ", "## How to treat polytomies here?", "if", "l...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
get_sampled
get total number of quartets sampled for a split
ipyrad/analysis/tetrad2.py
def get_sampled(data, totn, node): """ get total number of quartets sampled for a split""" ## convert tip names to ints names = sorted(totn) cdict = {name: idx for idx, name in enumerate(names)} ## skip some nodes if (node.is_leaf() or node.is_root()): return 0 else: ## ...
def get_sampled(data, totn, node): """ get total number of quartets sampled for a split""" ## convert tip names to ints names = sorted(totn) cdict = {name: idx for idx, name in enumerate(names)} ## skip some nodes if (node.is_leaf() or node.is_root()): return 0 else: ## ...
[ "get", "total", "number", "of", "quartets", "sampled", "for", "a", "split" ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1527-L1574
[ "def", "get_sampled", "(", "data", ",", "totn", ",", "node", ")", ":", "## convert tip names to ints", "names", "=", "sorted", "(", "totn", ")", "cdict", "=", "{", "name", ":", "idx", "for", "idx", ",", "name", "in", "enumerate", "(", "names", ")", "}"...
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/tetrad2.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/tetrad2.py#L1578-L1595
[ "def", "consensus_tree", "(", "trees", ",", "names", "=", "None", ",", "cutoff", "=", "0.0", ")", ":", "## find which clades occured with freq > cutoff", "namedict", ",", "clade_counts", "=", "find_clades", "(", "trees", ",", "names", "=", "names", ")", "## filt...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
find_clades
A subfunc of consensus_tree(). Traverses trees to count clade occurrences. Names are ordered by names, else they are in the order of the first tree.
ipyrad/analysis/tetrad2.py
def find_clades(trees, names): """ A subfunc of consensus_tree(). Traverses trees to count clade occurrences. Names are ordered by names, else they are in the order of the first tree. """ ## index names from the first tree if not names: names = trees[0].get_leaf_names() ndict =...
def find_clades(trees, names): """ A subfunc of consensus_tree(). Traverses trees to count clade occurrences. Names are ordered by names, else they are in the order of the first tree. """ ## index names from the first tree if not names: names = trees[0].get_leaf_names() ndict =...
[ "A", "subfunc", "of", "consensus_tree", "()", ".", "Traverses", "trees", "to", "count", "clade", "occurrences", ".", "Names", "are", "ordered", "by", "names", "else", "they", "are", "in", "the", "order", "of", "the", "first", "tree", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1651-L1689
[ "def", "find_clades", "(", "trees", ",", "names", ")", ":", "## index names from the first tree", "if", "not", "names", ":", "names", "=", "trees", "[", "0", "]", ".", "get_leaf_names", "(", ")", "ndict", "=", "{", "j", ":", "i", "for", "i", ",", "j", ...
5eeb8a178160f45faf71bf47cec4abe998a575d1
valid
build_trees
A subfunc of consensus_tree(). Build an unrooted consensus tree from filtered clade counts.
ipyrad/analysis/tetrad2.py
def build_trees(fclade_counts, namedict): """ A subfunc of consensus_tree(). Build an unrooted consensus tree from filtered clade counts. """ ## storage nodes = {} idxarr = np.arange(len(fclade_counts[0][0])) queue = [] ## create dict of clade counts and set keys countdict =...
def build_trees(fclade_counts, namedict): """ A subfunc of consensus_tree(). Build an unrooted consensus tree from filtered clade counts. """ ## storage nodes = {} idxarr = np.arange(len(fclade_counts[0][0])) queue = [] ## create dict of clade counts and set keys countdict =...
[ "A", "subfunc", "of", "consensus_tree", "()", ".", "Build", "an", "unrooted", "consensus", "tree", "from", "filtered", "clade", "counts", "." ]
dereneaton/ipyrad
python
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L1693-L1755
[ "def", "build_trees", "(", "fclade_counts", ",", "namedict", ")", ":", "## storage", "nodes", "=", "{", "}", "idxarr", "=", "np", ".", "arange", "(", "len", "(", "fclade_counts", "[", "0", "]", "[", "0", "]", ")", ")", "queue", "=", "[", "]", "## c...
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/tetrad2.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/tetrad2.py#L290-L326
[ "def", "_refresh", "(", "self", ")", ":", "## clear any existing results files", "oldfiles", "=", "[", "self", ".", "files", ".", "qdump", "]", "+", "self", ".", "database", ".", "__dict__", ".", "values", "(", ")", "+", "self", ".", "trees", ".", "__dic...
5eeb8a178160f45faf71bf47cec4abe998a575d1