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 | OrderedModel.down | Move this object down one position. | publications/models/orderedmodel.py | def down(self):
"""
Move this object down one position.
"""
self.swap(self.get_ordering_queryset().filter(order__gt=self.order)) | def down(self):
"""
Move this object down one position.
"""
self.swap(self.get_ordering_queryset().filter(order__gt=self.order)) | [
"Move",
"this",
"object",
"down",
"one",
"position",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L142-L146 | [
"def",
"down",
"(",
"self",
")",
":",
"self",
".",
"swap",
"(",
"self",
".",
"get_ordering_queryset",
"(",
")",
".",
"filter",
"(",
"order__gt",
"=",
"self",
".",
"order",
")",
")"
] | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | OrderedModel.to | Move object to a certain position, updating all affected objects to move accordingly up or down. | publications/models/orderedmodel.py | def to(self, order):
"""
Move object to a certain position, updating all affected objects to move accordingly up or down.
"""
if order is None or self.order == order:
# object is already at desired position
return
qs = self.get_ordering_queryset()
... | def to(self, order):
"""
Move object to a certain position, updating all affected objects to move accordingly up or down.
"""
if order is None or self.order == order:
# object is already at desired position
return
qs = self.get_ordering_queryset()
... | [
"Move",
"object",
"to",
"a",
"certain",
"position",
"updating",
"all",
"affected",
"objects",
"to",
"move",
"accordingly",
"up",
"or",
"down",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L148-L161 | [
"def",
"to",
"(",
"self",
",",
"order",
")",
":",
"if",
"order",
"is",
"None",
"or",
"self",
".",
"order",
"==",
"order",
":",
"# object is already at desired position",
"return",
"qs",
"=",
"self",
".",
"get_ordering_queryset",
"(",
")",
"if",
"self",
"."... | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | OrderedModel.above | Move this object above the referenced object. | publications/models/orderedmodel.py | def above(self, ref):
"""
Move this object above the referenced object.
"""
if not self._valid_ordering_reference(ref):
raise ValueError(
"%r can only be moved above instances of %r which %s equals %r." % (
self, self.__class__, self.order_... | def above(self, ref):
"""
Move this object above the referenced object.
"""
if not self._valid_ordering_reference(ref):
raise ValueError(
"%r can only be moved above instances of %r which %s equals %r." % (
self, self.__class__, self.order_... | [
"Move",
"this",
"object",
"above",
"the",
"referenced",
"object",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L163-L180 | [
"def",
"above",
"(",
"self",
",",
"ref",
")",
":",
"if",
"not",
"self",
".",
"_valid_ordering_reference",
"(",
"ref",
")",
":",
"raise",
"ValueError",
"(",
"\"%r can only be moved above instances of %r which %s equals %r.\"",
"%",
"(",
"self",
",",
"self",
".",
... | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | OrderedModel.below | Move this object below the referenced object. | publications/models/orderedmodel.py | def below(self, ref):
"""
Move this object below the referenced object.
"""
if not self._valid_ordering_reference(ref):
raise ValueError(
"%r can only be moved below instances of %r which %s equals %r." % (
self, self.__class__, self.order_... | def below(self, ref):
"""
Move this object below the referenced object.
"""
if not self._valid_ordering_reference(ref):
raise ValueError(
"%r can only be moved below instances of %r which %s equals %r." % (
self, self.__class__, self.order_... | [
"Move",
"this",
"object",
"below",
"the",
"referenced",
"object",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L182-L199 | [
"def",
"below",
"(",
"self",
",",
"ref",
")",
":",
"if",
"not",
"self",
".",
"_valid_ordering_reference",
"(",
"ref",
")",
":",
"raise",
"ValueError",
"(",
"\"%r can only be moved below instances of %r which %s equals %r.\"",
"%",
"(",
"self",
",",
"self",
".",
... | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | OrderedModel.top | Move this object to the top of the ordered stack. | publications/models/orderedmodel.py | def top(self):
"""
Move this object to the top of the ordered stack.
"""
o = self.get_ordering_queryset().aggregate(Min('order')).get('order__min')
self.to(o) | def top(self):
"""
Move this object to the top of the ordered stack.
"""
o = self.get_ordering_queryset().aggregate(Min('order')).get('order__min')
self.to(o) | [
"Move",
"this",
"object",
"to",
"the",
"top",
"of",
"the",
"ordered",
"stack",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L201-L206 | [
"def",
"top",
"(",
"self",
")",
":",
"o",
"=",
"self",
".",
"get_ordering_queryset",
"(",
")",
".",
"aggregate",
"(",
"Min",
"(",
"'order'",
")",
")",
".",
"get",
"(",
"'order__min'",
")",
"self",
".",
"to",
"(",
"o",
")"
] | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | OrderedModel.bottom | Move this object to the bottom of the ordered stack. | publications/models/orderedmodel.py | def bottom(self):
"""
Move this object to the bottom of the ordered stack.
"""
o = self.get_ordering_queryset().aggregate(Max('order')).get('order__max')
self.to(o) | def bottom(self):
"""
Move this object to the bottom of the ordered stack.
"""
o = self.get_ordering_queryset().aggregate(Max('order')).get('order__max')
self.to(o) | [
"Move",
"this",
"object",
"to",
"the",
"bottom",
"of",
"the",
"ordered",
"stack",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/models/orderedmodel.py#L208-L213 | [
"def",
"bottom",
"(",
"self",
")",
":",
"o",
"=",
"self",
".",
"get_ordering_queryset",
"(",
")",
".",
"aggregate",
"(",
"Max",
"(",
"'order'",
")",
")",
".",
"get",
"(",
"'order__max'",
")",
"self",
".",
"to",
"(",
"o",
")"
] | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | unapi | This view implements unAPI 1.0 (see http://unapi.info). | publications/views/unapi.py | def unapi(request):
"""
This view implements unAPI 1.0 (see http://unapi.info).
"""
id = request.GET.get('id')
format = request.GET.get('format')
if format is not None:
try:
publications = Publication.objects.filter(pk=int(id))
if not publications:
raise ValueError
except ValueError:
# inv... | def unapi(request):
"""
This view implements unAPI 1.0 (see http://unapi.info).
"""
id = request.GET.get('id')
format = request.GET.get('format')
if format is not None:
try:
publications = Publication.objects.filter(pk=int(id))
if not publications:
raise ValueError
except ValueError:
# inv... | [
"This",
"view",
"implements",
"unAPI",
"1",
".",
"0",
"(",
"see",
"http",
":",
"//",
"unapi",
".",
"info",
")",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/views/unapi.py#L9-L75 | [
"def",
"unapi",
"(",
"request",
")",
":",
"id",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'id'",
")",
"format",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'format'",
")",
"if",
"format",
"is",
"not",
"None",
":",
"try",
":",
"publications",
... | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | populate | Load custom links and files from database and attach to publications. | publications/utils.py | def populate(publications):
"""
Load custom links and files from database and attach to publications.
"""
customlinks = CustomLink.objects.filter(publication__in=publications)
customfiles = CustomFile.objects.filter(publication__in=publications)
publications_ = {}
for publication in publications:
publication... | def populate(publications):
"""
Load custom links and files from database and attach to publications.
"""
customlinks = CustomLink.objects.filter(publication__in=publications)
customfiles = CustomFile.objects.filter(publication__in=publications)
publications_ = {}
for publication in publications:
publication... | [
"Load",
"custom",
"links",
"and",
"files",
"from",
"database",
"and",
"attach",
"to",
"publications",
"."
] | lucastheis/django-publications | python | https://github.com/lucastheis/django-publications/blob/5a75cf88cf794937711b6850ff2acb07fe005f08/publications/utils.py#L3-L20 | [
"def",
"populate",
"(",
"publications",
")",
":",
"customlinks",
"=",
"CustomLink",
".",
"objects",
".",
"filter",
"(",
"publication__in",
"=",
"publications",
")",
"customfiles",
"=",
"CustomFile",
".",
"objects",
".",
"filter",
"(",
"publication__in",
"=",
"... | 5a75cf88cf794937711b6850ff2acb07fe005f08 |
valid | make | build a vcf file from the supercatg array and the cat.clust.gz output | ipyrad/file_conversion/loci2vcf.py | def make(data, samples):
""" build a vcf file from the supercatg array and the cat.clust.gz output"""
outfile = open(os.path.join(data.dirs.outfiles, data.name+".vcf"), 'w')
inloci = os.path.join(data.dirs.outfiles, data.name+".loci")
names = [i.name for i in samples]
names.sort()
## TODO:... | def make(data, samples):
""" build a vcf file from the supercatg array and the cat.clust.gz output"""
outfile = open(os.path.join(data.dirs.outfiles, data.name+".vcf"), 'w')
inloci = os.path.join(data.dirs.outfiles, data.name+".loci")
names = [i.name for i in samples]
names.sort()
## TODO:... | [
"build",
"a",
"vcf",
"file",
"from",
"the",
"supercatg",
"array",
"and",
"the",
"cat",
".",
"clust",
".",
"gz",
"output"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2vcf.py#L8-L81 | [
"def",
"make",
"(",
"data",
",",
"samples",
")",
":",
"outfile",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"outfiles",
",",
"data",
".",
"name",
"+",
"\".vcf\"",
")",
",",
"'w'",
")",
"inloci",
"=",
"os",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | worker | Calculates the quartet weights for the test at a random
subsampled chunk of loci. | ipyrad/analysis/twiist.py | def worker(self):
"""
Calculates the quartet weights for the test at a random
subsampled chunk of loci.
"""
## subsample loci
fullseqs = self.sample_loci()
## find all iterations of samples for this quartet
liters = itertools.product(*self.imap.values())
## run tree inference fo... | def worker(self):
"""
Calculates the quartet weights for the test at a random
subsampled chunk of loci.
"""
## subsample loci
fullseqs = self.sample_loci()
## find all iterations of samples for this quartet
liters = itertools.product(*self.imap.values())
## run tree inference fo... | [
"Calculates",
"the",
"quartet",
"weights",
"for",
"the",
"test",
"at",
"a",
"random",
"subsampled",
"chunk",
"of",
"loci",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L210-L269 | [
"def",
"worker",
"(",
"self",
")",
":",
"## subsample loci ",
"fullseqs",
"=",
"self",
".",
"sample_loci",
"(",
")",
"## find all iterations of samples for this quartet",
"liters",
"=",
"itertools",
".",
"product",
"(",
"*",
"self",
".",
"imap",
".",
"values",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_order | return tree order | ipyrad/analysis/twiist.py | def get_order(tre):
"""
return tree order
"""
anode = tre.tree&">A"
sister = anode.get_sisters()[0]
sisters = (anode.name[1:], sister.name[1:])
others = [i for i in list("ABCD") if i not in sisters]
return sorted(sisters) + sorted(others) | def get_order(tre):
"""
return tree order
"""
anode = tre.tree&">A"
sister = anode.get_sisters()[0]
sisters = (anode.name[1:], sister.name[1:])
others = [i for i in list("ABCD") if i not in sisters]
return sorted(sisters) + sorted(others) | [
"return",
"tree",
"order"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L273-L281 | [
"def",
"get_order",
"(",
"tre",
")",
":",
"anode",
"=",
"tre",
".",
"tree",
"&",
"\">A\"",
"sister",
"=",
"anode",
".",
"get_sisters",
"(",
")",
"[",
"0",
"]",
"sisters",
"=",
"(",
"anode",
".",
"name",
"[",
"1",
":",
"]",
",",
"sister",
".",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | count_var | count number of sites with cov=4, and number of variable sites. | ipyrad/analysis/twiist.py | def count_var(nex):
"""
count number of sites with cov=4, and number of variable sites.
"""
arr = np.array([list(i.split()[-1]) for i in nex])
miss = np.any(arr=="N", axis=0)
nomiss = arr[:, ~miss]
nsnps = np.invert(np.all(nomiss==nomiss[0, :], axis=0)).sum()
return nomiss.shape[1], nsnp... | def count_var(nex):
"""
count number of sites with cov=4, and number of variable sites.
"""
arr = np.array([list(i.split()[-1]) for i in nex])
miss = np.any(arr=="N", axis=0)
nomiss = arr[:, ~miss]
nsnps = np.invert(np.all(nomiss==nomiss[0, :], axis=0)).sum()
return nomiss.shape[1], nsnp... | [
"count",
"number",
"of",
"sites",
"with",
"cov",
"=",
"4",
"and",
"number",
"of",
"variable",
"sites",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L284-L292 | [
"def",
"count_var",
"(",
"nex",
")",
":",
"arr",
"=",
"np",
".",
"array",
"(",
"[",
"list",
"(",
"i",
".",
"split",
"(",
")",
"[",
"-",
"1",
"]",
")",
"for",
"i",
"in",
"nex",
"]",
")",
"miss",
"=",
"np",
".",
"any",
"(",
"arr",
"==",
"\"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Twiist.sample_loci | finds loci with sufficient sampling for this test | ipyrad/analysis/twiist.py | def sample_loci(self):
""" finds loci with sufficient sampling for this test"""
## store idx of passing loci
idxs = np.random.choice(self.idxs, self.ntests)
## open handle, make a proper generator to reduce mem
with open(self.data) as indata:
liter = (indata.read().... | def sample_loci(self):
""" finds loci with sufficient sampling for this test"""
## store idx of passing loci
idxs = np.random.choice(self.idxs, self.ntests)
## open handle, make a proper generator to reduce mem
with open(self.data) as indata:
liter = (indata.read().... | [
"finds",
"loci",
"with",
"sufficient",
"sampling",
"for",
"this",
"test"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L95-L125 | [
"def",
"sample_loci",
"(",
"self",
")",
":",
"## store idx of passing loci",
"idxs",
"=",
"np",
".",
"random",
".",
"choice",
"(",
"self",
".",
"idxs",
",",
"self",
".",
"ntests",
")",
"## open handle, make a proper generator to reduce mem",
"with",
"open",
"(",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Twiist.run_tree_inference | Write nexus to tmpfile, runs phyml tree inference, and parses
and returns the resulting tree. | ipyrad/analysis/twiist.py | def run_tree_inference(self, nexus, idx):
"""
Write nexus to tmpfile, runs phyml tree inference, and parses
and returns the resulting tree.
"""
## create a tmpdir for this test
tmpdir = tempfile.tempdir
tmpfile = os.path.join(tempfile.NamedTemporaryFile(
... | def run_tree_inference(self, nexus, idx):
"""
Write nexus to tmpfile, runs phyml tree inference, and parses
and returns the resulting tree.
"""
## create a tmpdir for this test
tmpdir = tempfile.tempdir
tmpfile = os.path.join(tempfile.NamedTemporaryFile(
... | [
"Write",
"nexus",
"to",
"tmpfile",
"runs",
"phyml",
"tree",
"inference",
"and",
"parses",
"and",
"returns",
"the",
"resulting",
"tree",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L129-L155 | [
"def",
"run_tree_inference",
"(",
"self",
",",
"nexus",
",",
"idx",
")",
":",
"## create a tmpdir for this test",
"tmpdir",
"=",
"tempfile",
".",
"tempdir",
"tmpfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"delet... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Twiist.run | parallelize calls to worker function. | ipyrad/analysis/twiist.py | def run(self, ipyclient):
"""
parallelize calls to worker function.
"""
## connect to parallel client
lbview = ipyclient.load_balanced_view()
## iterate over tests
asyncs = []
for test in xrange(self.ntests):
## ... | def run(self, ipyclient):
"""
parallelize calls to worker function.
"""
## connect to parallel client
lbview = ipyclient.load_balanced_view()
## iterate over tests
asyncs = []
for test in xrange(self.ntests):
## ... | [
"parallelize",
"calls",
"to",
"worker",
"function",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L159-L185 | [
"def",
"run",
"(",
"self",
",",
"ipyclient",
")",
":",
"## connect to parallel client",
"lbview",
"=",
"ipyclient",
".",
"load_balanced_view",
"(",
")",
"## iterate over tests",
"asyncs",
"=",
"[",
"]",
"for",
"test",
"in",
"xrange",
"(",
"self",
".",
"ntests"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Twiist.plot | return a toyplot barplot of the results table. | ipyrad/analysis/twiist.py | def plot(self):
"""
return a toyplot barplot of the results table.
"""
if self.results_table == None:
return "no results found"
else:
bb = self.results_table.sort_values(
by=["ABCD", "ACBD"],
ascending=[False, True],
... | def plot(self):
"""
return a toyplot barplot of the results table.
"""
if self.results_table == None:
return "no results found"
else:
bb = self.results_table.sort_values(
by=["ABCD", "ACBD"],
ascending=[False, True],
... | [
"return",
"a",
"toyplot",
"barplot",
"of",
"the",
"results",
"table",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/twiist.py#L189-L206 | [
"def",
"plot",
"(",
"self",
")",
":",
"if",
"self",
".",
"results_table",
"==",
"None",
":",
"return",
"\"no results found\"",
"else",
":",
"bb",
"=",
"self",
".",
"results_table",
".",
"sort_values",
"(",
"by",
"=",
"[",
"\"ABCD\"",
",",
"\"ACBD\"",
"]"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | PCA.plot | Do the PCA and plot it.
Parameters
---------
pcs: list of ints
...
ax: matplotlib axis
...
cmap: matplotlib colormap
...
cdict: dictionary mapping pop names to colors
...
legend: boolean, whether or not to show the legend | ipyrad/analysis/pca.py | def plot(self, pcs=[1, 2], ax=None, cmap=None, cdict=None, legend=True, title=None, outfile=None):
"""
Do the PCA and plot it.
Parameters
---------
pcs: list of ints
...
ax: matplotlib axis
...
cmap: matplotlib colormap
...
cdict: ... | def plot(self, pcs=[1, 2], ax=None, cmap=None, cdict=None, legend=True, title=None, outfile=None):
"""
Do the PCA and plot it.
Parameters
---------
pcs: list of ints
...
ax: matplotlib axis
...
cmap: matplotlib colormap
...
cdict: ... | [
"Do",
"the",
"PCA",
"and",
"plot",
"it",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/pca.py#L264-L354 | [
"def",
"plot",
"(",
"self",
",",
"pcs",
"=",
"[",
"1",
",",
"2",
"]",
",",
"ax",
"=",
"None",
",",
"cmap",
"=",
"None",
",",
"cdict",
"=",
"None",
",",
"legend",
"=",
"True",
",",
"title",
"=",
"None",
",",
"outfile",
"=",
"None",
")",
":",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | PCA.plot_pairwise_dist | Plot pairwise distances between all samples
labels: bool or list
by default labels aren't included. If labels == True, then labels are read in
from the vcf file. Alternatively, labels can be passed in as a list, should
be same length as the number of samples. | ipyrad/analysis/pca.py | def plot_pairwise_dist(self, labels=None, ax=None, cmap=None, cdict=None, metric="euclidean"):
"""
Plot pairwise distances between all samples
labels: bool or list
by default labels aren't included. If labels == True, then labels are read in
from the vcf file. Al... | def plot_pairwise_dist(self, labels=None, ax=None, cmap=None, cdict=None, metric="euclidean"):
"""
Plot pairwise distances between all samples
labels: bool or list
by default labels aren't included. If labels == True, then labels are read in
from the vcf file. Al... | [
"Plot",
"pairwise",
"distances",
"between",
"all",
"samples"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/pca.py#L357-L383 | [
"def",
"plot_pairwise_dist",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"cmap",
"=",
"None",
",",
"cdict",
"=",
"None",
",",
"metric",
"=",
"\"euclidean\"",
")",
":",
"allele_counts",
"=",
"self",
".",
"genotypes",
".",
"to_n... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | PCA.copy | returns a copy of the pca analysis object | ipyrad/analysis/pca.py | def copy(self):
""" returns a copy of the pca analysis object """
cp = copy.deepcopy(self)
cp.genotypes = allel.GenotypeArray(self.genotypes, copy=True)
return cp | def copy(self):
""" returns a copy of the pca analysis object """
cp = copy.deepcopy(self)
cp.genotypes = allel.GenotypeArray(self.genotypes, copy=True)
return cp | [
"returns",
"a",
"copy",
"of",
"the",
"pca",
"analysis",
"object"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/pca.py#L386-L390 | [
"def",
"copy",
"(",
"self",
")",
":",
"cp",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"cp",
".",
"genotypes",
"=",
"allel",
".",
"GenotypeArray",
"(",
"self",
".",
"genotypes",
",",
"copy",
"=",
"True",
")",
"return",
"cp"
] | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | loci2cf | Convert ipyrad .loci file to an iqtree-pomo 'counts' file
Parameters:
-----------
name:
A prefix name for output files that will be produced
locifile:
A .loci file produced by ipyrad.
popdict:
A python dictionary grouping Clade names to Sample names.
Example: {"A":... | ipyrad/file_conversion/loci2cf.py | def loci2cf(name, locifile, popdict, wdir=None, ipyclient=None):
"""
Convert ipyrad .loci file to an iqtree-pomo 'counts' file
Parameters:
-----------
name:
A prefix name for output files that will be produced
locifile:
A .loci file produced by ipyrad.
popdict:
A p... | def loci2cf(name, locifile, popdict, wdir=None, ipyclient=None):
"""
Convert ipyrad .loci file to an iqtree-pomo 'counts' file
Parameters:
-----------
name:
A prefix name for output files that will be produced
locifile:
A .loci file produced by ipyrad.
popdict:
A p... | [
"Convert",
"ipyrad",
".",
"loci",
"file",
"to",
"an",
"iqtree",
"-",
"pomo",
"counts",
"file"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2cf.py#L28-L111 | [
"def",
"loci2cf",
"(",
"name",
",",
"locifile",
",",
"popdict",
",",
"wdir",
"=",
"None",
",",
"ipyclient",
"=",
"None",
")",
":",
"## working directory, make sure it exists",
"if",
"wdir",
":",
"wdir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"wdir",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | loci2migrate | A function to build an input file for the program migrate from an ipyrad
.loci file, and a dictionary grouping Samples into populations.
Parameters:
-----------
name: (str)
The name prefix for the migrate formatted output file.
locifile: (str)
The path to the .loci file produced by ... | ipyrad/file_conversion/loci2migrate.py | def loci2migrate(name, locifile, popdict, mindict=1):
"""
A function to build an input file for the program migrate from an ipyrad
.loci file, and a dictionary grouping Samples into populations.
Parameters:
-----------
name: (str)
The name prefix for the migrate formatted output file... | def loci2migrate(name, locifile, popdict, mindict=1):
"""
A function to build an input file for the program migrate from an ipyrad
.loci file, and a dictionary grouping Samples into populations.
Parameters:
-----------
name: (str)
The name prefix for the migrate formatted output file... | [
"A",
"function",
"to",
"build",
"an",
"input",
"file",
"for",
"the",
"program",
"migrate",
"from",
"an",
"ipyrad",
".",
"loci",
"file",
"and",
"a",
"dictionary",
"grouping",
"Samples",
"into",
"populations",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2migrate.py#L12-L94 | [
"def",
"loci2migrate",
"(",
"name",
",",
"locifile",
",",
"popdict",
",",
"mindict",
"=",
"1",
")",
":",
"## I/O",
"outfile",
"=",
"open",
"(",
"name",
"+",
"\".migrate\"",
",",
"'w'",
")",
"infile",
"=",
"open",
"(",
"locifile",
",",
"'r'",
")",
"##... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | update | updates dictionary with the next .5M reads from the super long string
phylip file. Makes for faster reading. | ipyrad/file_conversion/loci2phynex.py | def update(assembly, idict, count):
""" updates dictionary with the next .5M reads from the super long string
phylip file. Makes for faster reading. """
data = iter(open(os.path.join(assembly.dirs.outfiles,
assembly.name+".phy"), 'r'))
ntax, nchar = data.next().strip().split()
... | def update(assembly, idict, count):
""" updates dictionary with the next .5M reads from the super long string
phylip file. Makes for faster reading. """
data = iter(open(os.path.join(assembly.dirs.outfiles,
assembly.name+".phy"), 'r'))
ntax, nchar = data.next().strip().split()
... | [
"updates",
"dictionary",
"with",
"the",
"next",
".",
"5M",
"reads",
"from",
"the",
"super",
"long",
"string",
"phylip",
"file",
".",
"Makes",
"for",
"faster",
"reading",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2phynex.py#L15-L31 | [
"def",
"update",
"(",
"assembly",
",",
"idict",
",",
"count",
")",
":",
"data",
"=",
"iter",
"(",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"assembly",
".",
"dirs",
".",
"outfiles",
",",
"assembly",
".",
"name",
"+",
"\".phy\"",
")",
",",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | makephy | builds phy output. If large files writes 50000 loci at a time to tmp
files and rebuilds at the end | ipyrad/file_conversion/loci2phynex.py | def makephy(data, samples, longname):
""" builds phy output. If large files writes 50000 loci at a time to tmp
files and rebuilds at the end"""
## order names
names = [i.name for i in samples]
names.sort()
## read in loci file
locifile = os.path.join(data.dirs.outfiles, data.name+".loc... | def makephy(data, samples, longname):
""" builds phy output. If large files writes 50000 loci at a time to tmp
files and rebuilds at the end"""
## order names
names = [i.name for i in samples]
names.sort()
## read in loci file
locifile = os.path.join(data.dirs.outfiles, data.name+".loc... | [
"builds",
"phy",
"output",
".",
"If",
"large",
"files",
"writes",
"50000",
"loci",
"at",
"a",
"time",
"to",
"tmp",
"files",
"and",
"rebuilds",
"at",
"the",
"end"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2phynex.py#L35-L155 | [
"def",
"makephy",
"(",
"data",
",",
"samples",
",",
"longname",
")",
":",
"## order names",
"names",
"=",
"[",
"i",
".",
"name",
"for",
"i",
"in",
"samples",
"]",
"names",
".",
"sort",
"(",
")",
"## read in loci file",
"locifile",
"=",
"os",
".",
"path... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | makenex | PRINT NEXUS | ipyrad/file_conversion/loci2phynex.py | def makenex(assembly, names, longname, partitions):
""" PRINT NEXUS """
## make nexus output
data = iter(open(os.path.join(assembly.dirs.outfiles, assembly.name+".phy" ), 'r' ))
nexout = open(os.path.join(assembly.dirs.outfiles, assembly.name+".nex" ), 'wb' )
ntax, nchar = data.next().strip().spli... | def makenex(assembly, names, longname, partitions):
""" PRINT NEXUS """
## make nexus output
data = iter(open(os.path.join(assembly.dirs.outfiles, assembly.name+".phy" ), 'r' ))
nexout = open(os.path.join(assembly.dirs.outfiles, assembly.name+".nex" ), 'wb' )
ntax, nchar = data.next().strip().spli... | [
"PRINT",
"NEXUS"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2phynex.py#L158-L210 | [
"def",
"makenex",
"(",
"assembly",
",",
"names",
",",
"longname",
",",
"partitions",
")",
":",
"## make nexus output",
"data",
"=",
"iter",
"(",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"assembly",
".",
"dirs",
".",
"outfiles",
",",
"assembly",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | make | Make phylip and nexus formats. This is hackish since I'm recycling the
code whole-hog from pyrad V3. Probably could be good to go back through
and clean up the conversion code some time. | ipyrad/file_conversion/loci2phynex.py | def make(assembly, samples):
""" Make phylip and nexus formats. This is hackish since I'm recycling the
code whole-hog from pyrad V3. Probably could be good to go back through
and clean up the conversion code some time.
"""
## get the longest name
longname = max([len(i) for i in assembly.samp... | def make(assembly, samples):
""" Make phylip and nexus formats. This is hackish since I'm recycling the
code whole-hog from pyrad V3. Probably could be good to go back through
and clean up the conversion code some time.
"""
## get the longest name
longname = max([len(i) for i in assembly.samp... | [
"Make",
"phylip",
"and",
"nexus",
"formats",
".",
"This",
"is",
"hackish",
"since",
"I",
"m",
"recycling",
"the",
"code",
"whole",
"-",
"hog",
"from",
"pyrad",
"V3",
".",
"Probably",
"could",
"be",
"good",
"to",
"go",
"back",
"through",
"and",
"clean",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2phynex.py#L213-L224 | [
"def",
"make",
"(",
"assembly",
",",
"samples",
")",
":",
"## get the longest name",
"longname",
"=",
"max",
"(",
"[",
"len",
"(",
"i",
")",
"for",
"i",
"in",
"assembly",
".",
"samples",
".",
"keys",
"(",
")",
"]",
")",
"names",
"=",
"[",
"i",
".",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | sample_cleanup | Clean up a bunch of loose files. | ipyrad/assemble/refmap.py | def sample_cleanup(data, sample):
"""
Clean up a bunch of loose files.
"""
umap1file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap1.fastq")
umap2file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap2.fastq")
unmapped = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam"... | def sample_cleanup(data, sample):
"""
Clean up a bunch of loose files.
"""
umap1file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap1.fastq")
umap2file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap2.fastq")
unmapped = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam"... | [
"Clean",
"up",
"a",
"bunch",
"of",
"loose",
"files",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L33-L48 | [
"def",
"sample_cleanup",
"(",
"data",
",",
"sample",
")",
":",
"umap1file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"edits",
",",
"sample",
".",
"name",
"+",
"\"-tmp-umap1.fastq\"",
")",
"umap2file",
"=",
"os",
".",
"path",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | index_reference_sequence | Index the reference sequence, unless it already exists. Also make a mapping
of scaffolds to index numbers for later user in steps 5-6. | ipyrad/assemble/refmap.py | def index_reference_sequence(data, force=False):
"""
Index the reference sequence, unless it already exists. Also make a mapping
of scaffolds to index numbers for later user in steps 5-6.
"""
## get ref file from params
refseq_file = data.paramsdict['reference_sequence']
index_files = []
... | def index_reference_sequence(data, force=False):
"""
Index the reference sequence, unless it already exists. Also make a mapping
of scaffolds to index numbers for later user in steps 5-6.
"""
## get ref file from params
refseq_file = data.paramsdict['reference_sequence']
index_files = []
... | [
"Index",
"the",
"reference",
"sequence",
"unless",
"it",
"already",
"exists",
".",
"Also",
"make",
"a",
"mapping",
"of",
"scaffolds",
"to",
"index",
"numbers",
"for",
"later",
"user",
"in",
"steps",
"5",
"-",
"6",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L52-L108 | [
"def",
"index_reference_sequence",
"(",
"data",
",",
"force",
"=",
"False",
")",
":",
"## get ref file from params",
"refseq_file",
"=",
"data",
".",
"paramsdict",
"[",
"'reference_sequence'",
"]",
"index_files",
"=",
"[",
"]",
"## Check for existence of index files. De... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | mapreads | Attempt to map reads to reference sequence. This reads in the fasta files
(samples.files.edits), and maps each read to the reference. Unmapped reads
are dropped right back in the de novo pipeline. Reads that map successfully
are processed and pushed downstream and joined with the rest of the data
post... | ipyrad/assemble/refmap.py | def mapreads(data, sample, nthreads, force):
"""
Attempt to map reads to reference sequence. This reads in the fasta files
(samples.files.edits), and maps each read to the reference. Unmapped reads
are dropped right back in the de novo pipeline. Reads that map successfully
are processed and pushed... | def mapreads(data, sample, nthreads, force):
"""
Attempt to map reads to reference sequence. This reads in the fasta files
(samples.files.edits), and maps each read to the reference. Unmapped reads
are dropped right back in the de novo pipeline. Reads that map successfully
are processed and pushed... | [
"Attempt",
"to",
"map",
"reads",
"to",
"reference",
"sequence",
".",
"This",
"reads",
"in",
"the",
"fasta",
"files",
"(",
"samples",
".",
"files",
".",
"edits",
")",
"and",
"maps",
"each",
"read",
"to",
"the",
"reference",
".",
"Unmapped",
"reads",
"are"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L116-L324 | [
"def",
"mapreads",
"(",
"data",
",",
"sample",
",",
"nthreads",
",",
"force",
")",
":",
"LOGGER",
".",
"info",
"(",
"\"Entering mapreads(): %s %s\"",
",",
"sample",
".",
"name",
",",
"nthreads",
")",
"## This is the input derep file, for paired data we need to split t... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | fetch_cluster_se | Builds a single end cluster from the refmapped data. | ipyrad/assemble/refmap.py | def fetch_cluster_se(data, samfile, chrom, rstart, rend):
"""
Builds a single end cluster from the refmapped data.
"""
## If SE then we enforce the minimum overlap distance to avoid the
## staircase syndrome of multiple reads overlapping just a little.
overlap_buffer = data._hackersonly["min_SE... | def fetch_cluster_se(data, samfile, chrom, rstart, rend):
"""
Builds a single end cluster from the refmapped data.
"""
## If SE then we enforce the minimum overlap distance to avoid the
## staircase syndrome of multiple reads overlapping just a little.
overlap_buffer = data._hackersonly["min_SE... | [
"Builds",
"a",
"single",
"end",
"cluster",
"from",
"the",
"refmapped",
"data",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L331-L429 | [
"def",
"fetch_cluster_se",
"(",
"data",
",",
"samfile",
",",
"chrom",
",",
"rstart",
",",
"rend",
")",
":",
"## If SE then we enforce the minimum overlap distance to avoid the",
"## staircase syndrome of multiple reads overlapping just a little.",
"overlap_buffer",
"=",
"data",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | fetch_cluster_pairs | Builds a paired cluster from the refmapped data. | ipyrad/assemble/refmap.py | def fetch_cluster_pairs(data, samfile, chrom, rstart, rend):
"""
Builds a paired cluster from the refmapped data.
"""
## store pairs
rdict = {}
clust = []
## grab the region and make tuples of info
iterreg = samfile.fetch(chrom, rstart, rend)
## use dict to match up read pairs
... | def fetch_cluster_pairs(data, samfile, chrom, rstart, rend):
"""
Builds a paired cluster from the refmapped data.
"""
## store pairs
rdict = {}
clust = []
## grab the region and make tuples of info
iterreg = samfile.fetch(chrom, rstart, rend)
## use dict to match up read pairs
... | [
"Builds",
"a",
"paired",
"cluster",
"from",
"the",
"refmapped",
"data",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L433-L552 | [
"def",
"fetch_cluster_pairs",
"(",
"data",
",",
"samfile",
",",
"chrom",
",",
"rstart",
",",
"rend",
")",
":",
"## store pairs",
"rdict",
"=",
"{",
"}",
"clust",
"=",
"[",
"]",
"## grab the region and make tuples of info",
"iterreg",
"=",
"samfile",
".",
"fetc... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | ref_build_and_muscle_chunk | 1. Run bedtools to get all overlapping regions
2. Parse out reads from regions using pysam and dump into chunk files.
We measure it out to create 10 chunk files per sample.
3. If we really wanted to speed this up, though it is pretty fast already,
we could parallelize it since we can easily bre... | ipyrad/assemble/refmap.py | def ref_build_and_muscle_chunk(data, sample):
"""
1. Run bedtools to get all overlapping regions
2. Parse out reads from regions using pysam and dump into chunk files.
We measure it out to create 10 chunk files per sample.
3. If we really wanted to speed this up, though it is pretty fast alrea... | def ref_build_and_muscle_chunk(data, sample):
"""
1. Run bedtools to get all overlapping regions
2. Parse out reads from regions using pysam and dump into chunk files.
We measure it out to create 10 chunk files per sample.
3. If we really wanted to speed this up, though it is pretty fast alrea... | [
"1",
".",
"Run",
"bedtools",
"to",
"get",
"all",
"overlapping",
"regions",
"2",
".",
"Parse",
"out",
"reads",
"from",
"regions",
"using",
"pysam",
"and",
"dump",
"into",
"chunk",
"files",
".",
"We",
"measure",
"it",
"out",
"to",
"create",
"10",
"chunk",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L557-L636 | [
"def",
"ref_build_and_muscle_chunk",
"(",
"data",
",",
"sample",
")",
":",
"## get regions using bedtools",
"regions",
"=",
"bedtools_merge",
"(",
"data",
",",
"sample",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\"\\n\"",
")",
"nregions",
"=",
"len",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | ref_muscle_chunker | Run bedtools to get all overlapping regions. Pass this list into the func
'get_overlapping_reads' which will write fastq chunks to the clust.gz file.
1) Run bedtools merge to get a list of all contiguous blocks of bases
in the reference seqeunce where one or more of our reads overlap.
The output will l... | ipyrad/assemble/refmap.py | def ref_muscle_chunker(data, sample):
"""
Run bedtools to get all overlapping regions. Pass this list into the func
'get_overlapping_reads' which will write fastq chunks to the clust.gz file.
1) Run bedtools merge to get a list of all contiguous blocks of bases
in the reference seqeunce where one ... | def ref_muscle_chunker(data, sample):
"""
Run bedtools to get all overlapping regions. Pass this list into the func
'get_overlapping_reads' which will write fastq chunks to the clust.gz file.
1) Run bedtools merge to get a list of all contiguous blocks of bases
in the reference seqeunce where one ... | [
"Run",
"bedtools",
"to",
"get",
"all",
"overlapping",
"regions",
".",
"Pass",
"this",
"list",
"into",
"the",
"func",
"get_overlapping_reads",
"which",
"will",
"write",
"fastq",
"chunks",
"to",
"the",
"clust",
".",
"gz",
"file",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L640-L664 | [
"def",
"ref_muscle_chunker",
"(",
"data",
",",
"sample",
")",
":",
"LOGGER",
".",
"info",
"(",
"'entering ref_muscle_chunker'",
")",
"## Get regions, which will be a giant list of 5-tuples, of which we're ",
"## only really interested in the first three: (chrom, start, end) position.",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_overlapping_reads | For SE data, this pulls mapped reads out of sorted mapped bam files and
appends them to the clust.gz file so they fall into downstream
(muscle alignment) analysis.
For PE data, this pulls mapped reads out of sorted mapped bam files, splits
R1s from R2s and writes them to separate files. Once all re... | ipyrad/assemble/refmap.py | def get_overlapping_reads(data, sample, regions):
"""
For SE data, this pulls mapped reads out of sorted mapped bam files and
appends them to the clust.gz file so they fall into downstream
(muscle alignment) analysis.
For PE data, this pulls mapped reads out of sorted mapped bam files, splits
... | def get_overlapping_reads(data, sample, regions):
"""
For SE data, this pulls mapped reads out of sorted mapped bam files and
appends them to the clust.gz file so they fall into downstream
(muscle alignment) analysis.
For PE data, this pulls mapped reads out of sorted mapped bam files, splits
... | [
"For",
"SE",
"data",
"this",
"pulls",
"mapped",
"reads",
"out",
"of",
"sorted",
"mapped",
"bam",
"files",
"and",
"appends",
"them",
"to",
"the",
"clust",
".",
"gz",
"file",
"so",
"they",
"fall",
"into",
"downstream",
"(",
"muscle",
"alignment",
")",
"ana... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L668-L761 | [
"def",
"get_overlapping_reads",
"(",
"data",
",",
"sample",
",",
"regions",
")",
":",
"## storage and counter",
"locus_list",
"=",
"[",
"]",
"reads_merged",
"=",
"0",
"## Set the write mode for opening clusters file.",
"## 1) if \"reference\" then only keep refmapped, so use 'w... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | split_merged_reads | Takes merged/concat derep file from vsearch derep and split it back into
separate R1 and R2 parts.
- sample_fastq: a list of the two file paths to write out to.
- input_reads: the path to the input merged reads | ipyrad/assemble/refmap.py | def split_merged_reads(outhandles, input_derep):
"""
Takes merged/concat derep file from vsearch derep and split it back into
separate R1 and R2 parts.
- sample_fastq: a list of the two file paths to write out to.
- input_reads: the path to the input merged reads
"""
handle1, handle2 = ou... | def split_merged_reads(outhandles, input_derep):
"""
Takes merged/concat derep file from vsearch derep and split it back into
separate R1 and R2 parts.
- sample_fastq: a list of the two file paths to write out to.
- input_reads: the path to the input merged reads
"""
handle1, handle2 = ou... | [
"Takes",
"merged",
"/",
"concat",
"derep",
"file",
"from",
"vsearch",
"derep",
"and",
"split",
"it",
"back",
"into",
"separate",
"R1",
"and",
"R2",
"parts",
".",
"-",
"sample_fastq",
":",
"a",
"list",
"of",
"the",
"two",
"file",
"paths",
"to",
"write",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L765-L815 | [
"def",
"split_merged_reads",
"(",
"outhandles",
",",
"input_derep",
")",
":",
"handle1",
",",
"handle2",
"=",
"outhandles",
"splitderep1",
"=",
"open",
"(",
"handle1",
",",
"'w'",
")",
"splitderep2",
"=",
"open",
"(",
"handle2",
",",
"'w'",
")",
"with",
"o... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | check_insert_size | check mean insert size for this sample and update
hackersonly.max_inner_mate_distance if need be. This value controls how
far apart mate pairs can be to still be considered for bedtools merging
downstream. | ipyrad/assemble/refmap.py | def check_insert_size(data, sample):
"""
check mean insert size for this sample and update
hackersonly.max_inner_mate_distance if need be. This value controls how
far apart mate pairs can be to still be considered for bedtools merging
downstream.
"""
## pipe stats output to grep
cmd1... | def check_insert_size(data, sample):
"""
check mean insert size for this sample and update
hackersonly.max_inner_mate_distance if need be. This value controls how
far apart mate pairs can be to still be considered for bedtools merging
downstream.
"""
## pipe stats output to grep
cmd1... | [
"check",
"mean",
"insert",
"size",
"for",
"this",
"sample",
"and",
"update",
"hackersonly",
".",
"max_inner_mate_distance",
"if",
"need",
"be",
".",
"This",
"value",
"controls",
"how",
"far",
"apart",
"mate",
"pairs",
"can",
"be",
"to",
"still",
"be",
"consi... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L819-L890 | [
"def",
"check_insert_size",
"(",
"data",
",",
"sample",
")",
":",
"## pipe stats output to grep",
"cmd1",
"=",
"[",
"ipyrad",
".",
"bins",
".",
"samtools",
",",
"\"stats\"",
",",
"sample",
".",
"files",
".",
"mapped_reads",
"]",
"cmd2",
"=",
"[",
"\"grep\"",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | bedtools_merge | Get all contiguous genomic regions with one or more overlapping
reads. This is the shell command we'll eventually run
bedtools bamtobed -i 1A_0.sorted.bam | bedtools merge [-d 100]
-i <input_bam> : specifies the input file to bed'ize
-d <int> : For PE set max distance between reads | ipyrad/assemble/refmap.py | def bedtools_merge(data, sample):
"""
Get all contiguous genomic regions with one or more overlapping
reads. This is the shell command we'll eventually run
bedtools bamtobed -i 1A_0.sorted.bam | bedtools merge [-d 100]
-i <input_bam> : specifies the input file to bed'ize
-d <int> ... | def bedtools_merge(data, sample):
"""
Get all contiguous genomic regions with one or more overlapping
reads. This is the shell command we'll eventually run
bedtools bamtobed -i 1A_0.sorted.bam | bedtools merge [-d 100]
-i <input_bam> : specifies the input file to bed'ize
-d <int> ... | [
"Get",
"all",
"contiguous",
"genomic",
"regions",
"with",
"one",
"or",
"more",
"overlapping",
"reads",
".",
"This",
"is",
"the",
"shell",
"command",
"we",
"ll",
"eventually",
"run"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L894-L946 | [
"def",
"bedtools_merge",
"(",
"data",
",",
"sample",
")",
":",
"LOGGER",
".",
"info",
"(",
"\"Entering bedtools_merge: %s\"",
",",
"sample",
".",
"name",
")",
"mappedreads",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"refmapping",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | trim_reference_sequence | If doing PE and R1/R2 don't overlap then the reference sequence
will be quite long and will cause indel hell during the
alignment stage. Here trim the reference sequence to the length
of the merged reads. Input is a list of alternating locus labels
and sequence data. The first locus label is the refere... | ipyrad/assemble/refmap.py | def trim_reference_sequence(fasta):
"""
If doing PE and R1/R2 don't overlap then the reference sequence
will be quite long and will cause indel hell during the
alignment stage. Here trim the reference sequence to the length
of the merged reads. Input is a list of alternating locus labels
and se... | def trim_reference_sequence(fasta):
"""
If doing PE and R1/R2 don't overlap then the reference sequence
will be quite long and will cause indel hell during the
alignment stage. Here trim the reference sequence to the length
of the merged reads. Input is a list of alternating locus labels
and se... | [
"If",
"doing",
"PE",
"and",
"R1",
"/",
"R2",
"don",
"t",
"overlap",
"then",
"the",
"reference",
"sequence",
"will",
"be",
"quite",
"long",
"and",
"will",
"cause",
"indel",
"hell",
"during",
"the",
"alignment",
"stage",
".",
"Here",
"trim",
"the",
"refere... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L950-L973 | [
"def",
"trim_reference_sequence",
"(",
"fasta",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"pre - {}\"",
".",
"format",
"(",
"fasta",
"[",
"0",
"]",
")",
")",
"## If the reads are merged then the reference sequence should be the",
"## same length as the merged pair. If unmerg... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | bam_region_to_fasta | Take the chromosome position, and start and end bases and return sequences
of all reads that overlap these sites. This is the command we're building:
samtools view -b 1A_sorted.bam 1:116202035-116202060 | \
samtools bam2fq <options> -
-b : output bam format
-0 : ... | ipyrad/assemble/refmap.py | def bam_region_to_fasta(data, sample, proc1, chrom, region_start, region_end):
"""
Take the chromosome position, and start and end bases and return sequences
of all reads that overlap these sites. This is the command we're building:
samtools view -b 1A_sorted.bam 1:116202035-116202060 | \
... | def bam_region_to_fasta(data, sample, proc1, chrom, region_start, region_end):
"""
Take the chromosome position, and start and end bases and return sequences
of all reads that overlap these sites. This is the command we're building:
samtools view -b 1A_sorted.bam 1:116202035-116202060 | \
... | [
"Take",
"the",
"chromosome",
"position",
"and",
"start",
"and",
"end",
"bases",
"and",
"return",
"sequences",
"of",
"all",
"reads",
"that",
"overlap",
"these",
"sites",
".",
"This",
"is",
"the",
"command",
"we",
"re",
"building",
":"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L977-L1234 | [
"def",
"bam_region_to_fasta",
"(",
"data",
",",
"sample",
",",
"proc1",
",",
"chrom",
",",
"region_start",
",",
"region_end",
")",
":",
"## output bam file handle for storing genome regions",
"bamf",
"=",
"sample",
".",
"files",
".",
"mapped_reads",
"if",
"not",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | refmap_stats | Get the number of mapped and unmapped reads for a sample
and update sample.stats | ipyrad/assemble/refmap.py | def refmap_stats(data, sample):
"""
Get the number of mapped and unmapped reads for a sample
and update sample.stats
"""
## shorter names
mapf = os.path.join(data.dirs.refmapping, sample.name+"-mapped-sorted.bam")
umapf = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam")
... | def refmap_stats(data, sample):
"""
Get the number of mapped and unmapped reads for a sample
and update sample.stats
"""
## shorter names
mapf = os.path.join(data.dirs.refmapping, sample.name+"-mapped-sorted.bam")
umapf = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam")
... | [
"Get",
"the",
"number",
"of",
"mapped",
"and",
"unmapped",
"reads",
"for",
"a",
"sample",
"and",
"update",
"sample",
".",
"stats"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L1238-L1268 | [
"def",
"refmap_stats",
"(",
"data",
",",
"sample",
")",
":",
"## shorter names",
"mapf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"refmapping",
",",
"sample",
".",
"name",
"+",
"\"-mapped-sorted.bam\"",
")",
"umapf",
"=",
"os",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | refmap_init | create some file handles for refmapping | ipyrad/assemble/refmap.py | def refmap_init(data, sample, force):
""" create some file handles for refmapping """
## make some persistent file handles for the refmap reads files
sample.files.unmapped_reads = os.path.join(data.dirs.edits,
"{}-refmap_derep.fastq".format(sample.name))
sample.files.m... | def refmap_init(data, sample, force):
""" create some file handles for refmapping """
## make some persistent file handles for the refmap reads files
sample.files.unmapped_reads = os.path.join(data.dirs.edits,
"{}-refmap_derep.fastq".format(sample.name))
sample.files.m... | [
"create",
"some",
"file",
"handles",
"for",
"refmapping"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/refmap.py#L1272-L1278 | [
"def",
"refmap_init",
"(",
"data",
",",
"sample",
",",
"force",
")",
":",
"## make some persistent file handles for the refmap reads files",
"sample",
".",
"files",
".",
"unmapped_reads",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"edits... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | parse_command_line | Parse CLI args. Only three options now. | ipyrad/analysis/__tetrad_cli__.py | def parse_command_line():
""" Parse CLI args. Only three options now. """
## create the parser
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
* Example command-line usage ----------------------------------------------
* Read in seque... | def parse_command_line():
""" Parse CLI args. Only three options now. """
## create the parser
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
* Example command-line usage ----------------------------------------------
* Read in seque... | [
"Parse",
"CLI",
"args",
".",
"Only",
"three",
"options",
"now",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/__tetrad_cli__.py#L26-L170 | [
"def",
"parse_command_line",
"(",
")",
":",
"## create the parser",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"formatter_class",
"=",
"argparse",
".",
"RawDescriptionHelpFormatter",
",",
"epilog",
"=",
"\"\"\"\n * Example command-line usage ---------------------... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | main | main function | ipyrad/analysis/__tetrad_cli__.py | def main():
""" main function """
## parse params file input (returns to stdout if --help or --version)
args = parse_command_line()
print(HEADER.format(ip.__version__))
## set random seed
np.random.seed(args.rseed)
## debugger----------------------------------------
if os.path.exists(... | def main():
""" main function """
## parse params file input (returns to stdout if --help or --version)
args = parse_command_line()
print(HEADER.format(ip.__version__))
## set random seed
np.random.seed(args.rseed)
## debugger----------------------------------------
if os.path.exists(... | [
"main",
"function"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/__tetrad_cli__.py#L174-L263 | [
"def",
"main",
"(",
")",
":",
"## parse params file input (returns to stdout if --help or --version)",
"args",
"=",
"parse_command_line",
"(",
")",
"print",
"(",
"HEADER",
".",
"format",
"(",
"ip",
".",
"__version__",
")",
")",
"## set random seed",
"np",
".",
"rand... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Treemix._command_list | build the command list | ipyrad/analysis/treemix.py | def _command_list(self):
""" build the command list """
## base args
cmd = [self.params.binary,
"-i", OPJ(self.workdir, self.name+".treemix.in.gz"),
"-o", OPJ(self.workdir, self.name),
]
## addon params
args = []
for key,... | def _command_list(self):
""" build the command list """
## base args
cmd = [self.params.binary,
"-i", OPJ(self.workdir, self.name+".treemix.in.gz"),
"-o", OPJ(self.workdir, self.name),
]
## addon params
args = []
for key,... | [
"build",
"the",
"command",
"list"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L148-L174 | [
"def",
"_command_list",
"(",
"self",
")",
":",
"## base args",
"cmd",
"=",
"[",
"self",
".",
"params",
".",
"binary",
",",
"\"-i\"",
",",
"OPJ",
"(",
"self",
".",
"workdir",
",",
"self",
".",
"name",
"+",
"\".treemix.in.gz\"",
")",
",",
"\"-o\"",
",",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Treemix._subsample | returns a subsample of unlinked snp sites | ipyrad/analysis/treemix.py | def _subsample(self):
""" returns a subsample of unlinked snp sites """
spans = self.maparr
samp = np.zeros(spans.shape[0], dtype=np.uint64)
for i in xrange(spans.shape[0]):
samp[i] = np.random.randint(spans[i, 0], spans[i, 1], 1)
return samp | def _subsample(self):
""" returns a subsample of unlinked snp sites """
spans = self.maparr
samp = np.zeros(spans.shape[0], dtype=np.uint64)
for i in xrange(spans.shape[0]):
samp[i] = np.random.randint(spans[i, 0], spans[i, 1], 1)
return samp | [
"returns",
"a",
"subsample",
"of",
"unlinked",
"snp",
"sites"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L188-L194 | [
"def",
"_subsample",
"(",
"self",
")",
":",
"spans",
"=",
"self",
".",
"maparr",
"samp",
"=",
"np",
".",
"zeros",
"(",
"spans",
".",
"shape",
"[",
"0",
"]",
",",
"dtype",
"=",
"np",
".",
"uint64",
")",
"for",
"i",
"in",
"xrange",
"(",
"spans",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Treemix.copy | Returns a copy of the treemix object with the same parameter settings
but with the files attributes cleared, and with a new 'name' attribute.
Parameters
----------
name (str):
A name for the new copied treemix bject that will be used for the
output file... | ipyrad/analysis/treemix.py | def copy(self, name):
"""
Returns a copy of the treemix object with the same parameter settings
but with the files attributes cleared, and with a new 'name' attribute.
Parameters
----------
name (str):
A name for the new copied treemix bject that wi... | def copy(self, name):
"""
Returns a copy of the treemix object with the same parameter settings
but with the files attributes cleared, and with a new 'name' attribute.
Parameters
----------
name (str):
A name for the new copied treemix bject that wi... | [
"Returns",
"a",
"copy",
"of",
"the",
"treemix",
"object",
"with",
"the",
"same",
"parameter",
"settings",
"but",
"with",
"the",
"files",
"attributes",
"cleared",
"and",
"with",
"a",
"new",
"name",
"attribute",
".",
"Parameters",
"----------",
"name",
"(",
"s... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L198-L236 | [
"def",
"copy",
"(",
"self",
",",
"name",
")",
":",
"## make deepcopy of self.__dict__ but do not copy async objects",
"subdict",
"=",
"{",
"i",
":",
"j",
"for",
"i",
",",
"j",
"in",
"self",
".",
"__dict__",
".",
"iteritems",
"(",
")",
"if",
"i",
"!=",
"\"a... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Treemix.draw | Returns a treemix plot on a toyplot.axes object. | ipyrad/analysis/treemix.py | def draw(self, axes):
"""
Returns a treemix plot on a toyplot.axes object.
"""
## create a toytree object from the treemix tree result
tre = toytree.tree(newick=self.results.tree)
tre.draw(
axes=axes,
use_edge_lengths=True,
... | def draw(self, axes):
"""
Returns a treemix plot on a toyplot.axes object.
"""
## create a toytree object from the treemix tree result
tre = toytree.tree(newick=self.results.tree)
tre.draw(
axes=axes,
use_edge_lengths=True,
... | [
"Returns",
"a",
"treemix",
"plot",
"on",
"a",
"toyplot",
".",
"axes",
"object",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/treemix.py#L305-L347 | [
"def",
"draw",
"(",
"self",
",",
"axes",
")",
":",
"## create a toytree object from the treemix tree result",
"tre",
"=",
"toytree",
".",
"tree",
"(",
"newick",
"=",
"self",
".",
"results",
".",
"tree",
")",
"tre",
".",
"draw",
"(",
"axes",
"=",
"axes",
",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _resolveambig | Randomly resolves iupac hetero codes. This is a shortcut
for now, we could instead use the phased alleles in RAD loci. | ipyrad/analysis/bucky.py | def _resolveambig(subseq):
"""
Randomly resolves iupac hetero codes. This is a shortcut
for now, we could instead use the phased alleles in RAD loci.
"""
N = []
for col in subseq:
rand = np.random.binomial(1, 0.5)
N.append([_AMBIGS[i][rand] for i in col])
return np.array(N) | def _resolveambig(subseq):
"""
Randomly resolves iupac hetero codes. This is a shortcut
for now, we could instead use the phased alleles in RAD loci.
"""
N = []
for col in subseq:
rand = np.random.binomial(1, 0.5)
N.append([_AMBIGS[i][rand] for i in col])
return np.array(N) | [
"Randomly",
"resolves",
"iupac",
"hetero",
"codes",
".",
"This",
"is",
"a",
"shortcut",
"for",
"now",
"we",
"could",
"instead",
"use",
"the",
"phased",
"alleles",
"in",
"RAD",
"loci",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L599-L608 | [
"def",
"_resolveambig",
"(",
"subseq",
")",
":",
"N",
"=",
"[",
"]",
"for",
"col",
"in",
"subseq",
":",
"rand",
"=",
"np",
".",
"random",
".",
"binomial",
"(",
"1",
",",
"0.5",
")",
"N",
".",
"append",
"(",
"[",
"_AMBIGS",
"[",
"i",
"]",
"[",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _count_PIS | filters for loci with >= N PIS | ipyrad/analysis/bucky.py | def _count_PIS(seqsamp, N):
""" filters for loci with >= N PIS """
counts = [Counter(col) for col in seqsamp.T if not ("-" in col or "N" in col)]
pis = [i.most_common(2)[1][1] > 1 for i in counts if len(i.most_common(2))>1]
if sum(pis) >= N:
return sum(pis)
else:
return 0 | def _count_PIS(seqsamp, N):
""" filters for loci with >= N PIS """
counts = [Counter(col) for col in seqsamp.T if not ("-" in col or "N" in col)]
pis = [i.most_common(2)[1][1] > 1 for i in counts if len(i.most_common(2))>1]
if sum(pis) >= N:
return sum(pis)
else:
return 0 | [
"filters",
"for",
"loci",
"with",
">",
"=",
"N",
"PIS"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L612-L619 | [
"def",
"_count_PIS",
"(",
"seqsamp",
",",
"N",
")",
":",
"counts",
"=",
"[",
"Counter",
"(",
"col",
")",
"for",
"col",
"in",
"seqsamp",
".",
"T",
"if",
"not",
"(",
"\"-\"",
"in",
"col",
"or",
"\"N\"",
"in",
"col",
")",
"]",
"pis",
"=",
"[",
"i"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky.write_nexus_files | Write nexus files to {workdir}/{name}/[0-N].nex, If the directory already
exists an exception will be raised unless you use the force flag which
will remove all files in the directory.
Parameters:
-----------
force (bool):
If True then all files in {workdir}/{name}... | ipyrad/analysis/bucky.py | def write_nexus_files(self, force=False, quiet=False):
"""
Write nexus files to {workdir}/{name}/[0-N].nex, If the directory already
exists an exception will be raised unless you use the force flag which
will remove all files in the directory.
Parameters:
-----------
... | def write_nexus_files(self, force=False, quiet=False):
"""
Write nexus files to {workdir}/{name}/[0-N].nex, If the directory already
exists an exception will be raised unless you use the force flag which
will remove all files in the directory.
Parameters:
-----------
... | [
"Write",
"nexus",
"files",
"to",
"{",
"workdir",
"}",
"/",
"{",
"name",
"}",
"/",
"[",
"0",
"-",
"N",
"]",
".",
"nex",
"If",
"the",
"directory",
"already",
"exists",
"an",
"exception",
"will",
"be",
"raised",
"unless",
"you",
"use",
"the",
"force",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L158-L264 | [
"def",
"write_nexus_files",
"(",
"self",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"## clear existing files ",
"existing",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"workdir",
",",
"self",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky.run | Submits an ordered list of jobs to a load-balancer to complete
the following tasks, and reports a progress bar:
(1) Write nexus files for each locus
(2) Run mrBayes on each locus to get a posterior of gene trees
(3) Run mbsum (a bucky tool) on the posterior set of trees
(4) Run ... | ipyrad/analysis/bucky.py | def run(self, steps=None, ipyclient=None, force=False, quiet=False):
"""
Submits an ordered list of jobs to a load-balancer to complete
the following tasks, and reports a progress bar:
(1) Write nexus files for each locus
(2) Run mrBayes on each locus to get a posterior of gene ... | def run(self, steps=None, ipyclient=None, force=False, quiet=False):
"""
Submits an ordered list of jobs to a load-balancer to complete
the following tasks, and reports a progress bar:
(1) Write nexus files for each locus
(2) Run mrBayes on each locus to get a posterior of gene ... | [
"Submits",
"an",
"ordered",
"list",
"of",
"jobs",
"to",
"a",
"load",
"-",
"balancer",
"to",
"complete",
"the",
"following",
"tasks",
"and",
"reports",
"a",
"progress",
"bar",
":",
"(",
"1",
")",
"Write",
"nexus",
"files",
"for",
"each",
"locus",
"(",
"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L269-L324 | [
"def",
"run",
"(",
"self",
",",
"steps",
"=",
"None",
",",
"ipyclient",
"=",
"None",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"## require ipyclient",
"if",
"not",
"ipyclient",
":",
"raise",
"IPyradWarningExit",
"(",
"\"an ipyclient... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky._write_nex | function that takes a dictionary mapping names to sequences,
and a locus number, and writes it as a NEXUS file with a mrbayes
analysis block given a set of mcmc arguments. | ipyrad/analysis/bucky.py | def _write_nex(self, mdict, nlocus):
"""
function that takes a dictionary mapping names to sequences,
and a locus number, and writes it as a NEXUS file with a mrbayes
analysis block given a set of mcmc arguments.
"""
## create matrix as a string
max_name_len =... | def _write_nex(self, mdict, nlocus):
"""
function that takes a dictionary mapping names to sequences,
and a locus number, and writes it as a NEXUS file with a mrbayes
analysis block given a set of mcmc arguments.
"""
## create matrix as a string
max_name_len =... | [
"function",
"that",
"takes",
"a",
"dictionary",
"mapping",
"names",
"to",
"sequences",
"and",
"a",
"locus",
"number",
"and",
"writes",
"it",
"as",
"a",
"NEXUS",
"file",
"with",
"a",
"mrbayes",
"analysis",
"block",
"given",
"a",
"set",
"of",
"mcmc",
"argume... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L328-L357 | [
"def",
"_write_nex",
"(",
"self",
",",
"mdict",
",",
"nlocus",
")",
":",
"## create matrix as a string",
"max_name_len",
"=",
"max",
"(",
"[",
"len",
"(",
"i",
")",
"for",
"i",
"in",
"mdict",
"]",
")",
"namestring",
"=",
"\"{:<\"",
"+",
"str",
"(",
"ma... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky.run_mbsum | Sums two replicate mrbayes runs for each locus | ipyrad/analysis/bucky.py | def run_mbsum(self, ipyclient, force=False, quiet=False):
"""
Sums two replicate mrbayes runs for each locus
"""
minidir = os.path.realpath(os.path.join(self.workdir, self.name))
trees1 = glob.glob(os.path.join(minidir, "*.run1.t"))
trees2 = glob.glob(os.path.join(minidir... | def run_mbsum(self, ipyclient, force=False, quiet=False):
"""
Sums two replicate mrbayes runs for each locus
"""
minidir = os.path.realpath(os.path.join(self.workdir, self.name))
trees1 = glob.glob(os.path.join(minidir, "*.run1.t"))
trees2 = glob.glob(os.path.join(minidir... | [
"Sums",
"two",
"replicate",
"mrbayes",
"runs",
"for",
"each",
"locus"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L361-L409 | [
"def",
"run_mbsum",
"(",
"self",
",",
"ipyclient",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"minidir",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"workdir",
",",
"self",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky.run_mrbayes | calls the mrbayes block in each nexus file. | ipyrad/analysis/bucky.py | def run_mrbayes(self, ipyclient, force=False, quiet=False):
"""
calls the mrbayes block in each nexus file.
"""
## get all the nexus files for this object
minidir = os.path.realpath(os.path.join(self.workdir, self.name))
nexus_files = glob.glob(os.path.join(minidir, "*.n... | def run_mrbayes(self, ipyclient, force=False, quiet=False):
"""
calls the mrbayes block in each nexus file.
"""
## get all the nexus files for this object
minidir = os.path.realpath(os.path.join(self.workdir, self.name))
nexus_files = glob.glob(os.path.join(minidir, "*.n... | [
"calls",
"the",
"mrbayes",
"block",
"in",
"each",
"nexus",
"file",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L413-L462 | [
"def",
"run_mrbayes",
"(",
"self",
",",
"ipyclient",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"## get all the nexus files for this object",
"minidir",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"join",
"(... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Bucky.run_bucky | Runs bucky for a given set of parameters and stores the result
to the ipa.bucky object. The results will be stored by default
with the name '{name}-{alpha}' unless a argument is passed for
'subname' to customize the output name.
Parameters:
-----------
subname (str):
... | ipyrad/analysis/bucky.py | def run_bucky(self, ipyclient, force=False, quiet=False, subname=False):
"""
Runs bucky for a given set of parameters and stores the result
to the ipa.bucky object. The results will be stored by default
with the name '{name}-{alpha}' unless a argument is passed for
'subname' to ... | def run_bucky(self, ipyclient, force=False, quiet=False, subname=False):
"""
Runs bucky for a given set of parameters and stores the result
to the ipa.bucky object. The results will be stored by default
with the name '{name}-{alpha}' unless a argument is passed for
'subname' to ... | [
"Runs",
"bucky",
"for",
"a",
"given",
"set",
"of",
"parameters",
"and",
"stores",
"the",
"result",
"to",
"the",
"ipa",
".",
"bucky",
"object",
".",
"The",
"results",
"will",
"be",
"stored",
"by",
"default",
"with",
"the",
"name",
"{",
"name",
"}",
"-",... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/bucky.py#L466-L538 | [
"def",
"run_bucky",
"(",
"self",
",",
"ipyclient",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"subname",
"=",
"False",
")",
":",
"## check for existing results files",
"minidir",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_samples | Internal function. Prelude for each step() to read in perhaps
non empty list of samples to process. Input is a list of sample names,
output is a list of sample objects. | ipyrad/core/assembly.py | def _get_samples(self, samples):
"""
Internal function. Prelude for each step() to read in perhaps
non empty list of samples to process. Input is a list of sample names,
output is a list of sample objects."""
## if samples not entered use all samples
if not samples:
samples = self.sample... | def _get_samples(self, samples):
"""
Internal function. Prelude for each step() to read in perhaps
non empty list of samples to process. Input is a list of sample names,
output is a list of sample objects."""
## if samples not entered use all samples
if not samples:
samples = self.sample... | [
"Internal",
"function",
".",
"Prelude",
"for",
"each",
"step",
"()",
"to",
"read",
"in",
"perhaps",
"non",
"empty",
"list",
"of",
"samples",
"to",
"process",
".",
"Input",
"is",
"a",
"list",
"of",
"sample",
"names",
"output",
"is",
"a",
"list",
"of",
"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1398-L1433 | [
"def",
"_get_samples",
"(",
"self",
",",
"samples",
")",
":",
"## if samples not entered use all samples",
"if",
"not",
"samples",
":",
"samples",
"=",
"self",
".",
"samples",
".",
"keys",
"(",
")",
"## Be nice and allow user to pass in only one sample as a string,",
"#... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _name_from_file | internal func: get the sample name from any pyrad file | ipyrad/core/assembly.py | def _name_from_file(fname, splitnames, fields):
""" internal func: get the sample name from any pyrad file """
## allowed extensions
file_extensions = [".gz", ".fastq", ".fq", ".fasta", ".clustS", ".consens"]
base, _ = os.path.splitext(os.path.basename(fname))
## remove read number from name
ba... | def _name_from_file(fname, splitnames, fields):
""" internal func: get the sample name from any pyrad file """
## allowed extensions
file_extensions = [".gz", ".fastq", ".fq", ".fasta", ".clustS", ".consens"]
base, _ = os.path.splitext(os.path.basename(fname))
## remove read number from name
ba... | [
"internal",
"func",
":",
"get",
"the",
"sample",
"name",
"from",
"any",
"pyrad",
"file"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1437-L1471 | [
"def",
"_name_from_file",
"(",
"fname",
",",
"splitnames",
",",
"fields",
")",
":",
"## allowed extensions",
"file_extensions",
"=",
"[",
"\".gz\"",
",",
"\".fastq\"",
",",
"\".fq\"",
",",
"\".fasta\"",
",",
"\".clustS\"",
",",
"\".consens\"",
"]",
"base",
",",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _read_sample_names | Read in sample names from a plain text file. This is a convenience
function for branching so if you have tons of sample names you can
pass in a file rather than having to set all the names at the command
line. | ipyrad/core/assembly.py | def _read_sample_names(fname):
""" Read in sample names from a plain text file. This is a convenience
function for branching so if you have tons of sample names you can
pass in a file rather than having to set all the names at the command
line.
"""
try:
with open(fname, 'r') as infile:
... | def _read_sample_names(fname):
""" Read in sample names from a plain text file. This is a convenience
function for branching so if you have tons of sample names you can
pass in a file rather than having to set all the names at the command
line.
"""
try:
with open(fname, 'r') as infile:
... | [
"Read",
"in",
"sample",
"names",
"from",
"a",
"plain",
"text",
"file",
".",
"This",
"is",
"a",
"convenience",
"function",
"for",
"branching",
"so",
"if",
"you",
"have",
"tons",
"of",
"sample",
"names",
"you",
"can",
"pass",
"in",
"a",
"file",
"rather",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1475-L1489 | [
"def",
"_read_sample_names",
"(",
"fname",
")",
":",
"try",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"infile",
":",
"subsamples",
"=",
"[",
"x",
".",
"split",
"(",
")",
"[",
"0",
"]",
"for",
"x",
"in",
"infile",
".",
"readlines",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _expander | expand ./ ~ and ../ designators in location names | ipyrad/core/assembly.py | def _expander(namepath):
""" expand ./ ~ and ../ designators in location names """
if "~" in namepath:
namepath = os.path.expanduser(namepath)
else:
namepath = os.path.abspath(namepath)
return namepath | def _expander(namepath):
""" expand ./ ~ and ../ designators in location names """
if "~" in namepath:
namepath = os.path.expanduser(namepath)
else:
namepath = os.path.abspath(namepath)
return namepath | [
"expand",
".",
"/",
"~",
"and",
"..",
"/",
"designators",
"in",
"location",
"names"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1493-L1499 | [
"def",
"_expander",
"(",
"namepath",
")",
":",
"if",
"\"~\"",
"in",
"namepath",
":",
"namepath",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"namepath",
")",
"else",
":",
"namepath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"namepath",
")",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | merge | Creates and returns a new Assembly object in which samples from two or more
Assembly objects with matching names are 'merged'. Merging does not affect
the actual files written on disk, but rather creates new Samples that are
linked to multiple data files, and with stats summed. | ipyrad/core/assembly.py | def merge(name, assemblies):
"""
Creates and returns a new Assembly object in which samples from two or more
Assembly objects with matching names are 'merged'. Merging does not affect
the actual files written on disk, but rather creates new Samples that are
linked to multiple data files, and with ... | def merge(name, assemblies):
"""
Creates and returns a new Assembly object in which samples from two or more
Assembly objects with matching names are 'merged'. Merging does not affect
the actual files written on disk, but rather creates new Samples that are
linked to multiple data files, and with ... | [
"Creates",
"and",
"returns",
"a",
"new",
"Assembly",
"object",
"in",
"which",
"samples",
"from",
"two",
"or",
"more",
"Assembly",
"objects",
"with",
"matching",
"names",
"are",
"merged",
".",
"Merging",
"does",
"not",
"affect",
"the",
"actual",
"files",
"wri... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1503-L1585 | [
"def",
"merge",
"(",
"name",
",",
"assemblies",
")",
":",
"## checks",
"assemblies",
"=",
"list",
"(",
"assemblies",
")",
"## create new Assembly as a branch (deepcopy)",
"merged",
"=",
"assemblies",
"[",
"0",
"]",
".",
"branch",
"(",
"name",
")",
"## get all sa... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _bufcountlines | fast line counter. Used to quickly sum number of input reads when running
link_fastqs to append files. | ipyrad/core/assembly.py | def _bufcountlines(filename, gzipped):
"""
fast line counter. Used to quickly sum number of input reads when running
link_fastqs to append files. """
if gzipped:
fin = gzip.open(filename)
else:
fin = open(filename)
nlines = 0
buf_size = 1024 * 1024
read_f = fin.read # loo... | def _bufcountlines(filename, gzipped):
"""
fast line counter. Used to quickly sum number of input reads when running
link_fastqs to append files. """
if gzipped:
fin = gzip.open(filename)
else:
fin = open(filename)
nlines = 0
buf_size = 1024 * 1024
read_f = fin.read # loo... | [
"fast",
"line",
"counter",
".",
"Used",
"to",
"quickly",
"sum",
"number",
"of",
"input",
"reads",
"when",
"running",
"link_fastqs",
"to",
"append",
"files",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1589-L1605 | [
"def",
"_bufcountlines",
"(",
"filename",
",",
"gzipped",
")",
":",
"if",
"gzipped",
":",
"fin",
"=",
"gzip",
".",
"open",
"(",
"filename",
")",
"else",
":",
"fin",
"=",
"open",
"(",
"filename",
")",
"nlines",
"=",
"0",
"buf_size",
"=",
"1024",
"*",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _zbufcountlines | faster line counter | ipyrad/core/assembly.py | def _zbufcountlines(filename, gzipped):
""" faster line counter """
if gzipped:
cmd1 = ["gunzip", "-c", filename]
else:
cmd1 = ["cat", filename]
cmd2 = ["wc"]
proc1 = sps.Popen(cmd1, stdout=sps.PIPE, stderr=sps.PIPE)
proc2 = sps.Popen(cmd2, stdin=proc1.stdout, stdout=sps.PIPE, s... | def _zbufcountlines(filename, gzipped):
""" faster line counter """
if gzipped:
cmd1 = ["gunzip", "-c", filename]
else:
cmd1 = ["cat", filename]
cmd2 = ["wc"]
proc1 = sps.Popen(cmd1, stdout=sps.PIPE, stderr=sps.PIPE)
proc2 = sps.Popen(cmd2, stdin=proc1.stdout, stdout=sps.PIPE, s... | [
"faster",
"line",
"counter"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1609-L1624 | [
"def",
"_zbufcountlines",
"(",
"filename",
",",
"gzipped",
")",
":",
"if",
"gzipped",
":",
"cmd1",
"=",
"[",
"\"gunzip\"",
",",
"\"-c\"",
",",
"filename",
"]",
"else",
":",
"cmd1",
"=",
"[",
"\"cat\"",
",",
"filename",
"]",
"cmd2",
"=",
"[",
"\"wc\"",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _tuplecheck | Takes a string argument and returns value as a tuple.
Needed for paramfile conversion from CLI to set_params args | ipyrad/core/assembly.py | def _tuplecheck(newvalue, dtype=str):
"""
Takes a string argument and returns value as a tuple.
Needed for paramfile conversion from CLI to set_params args
"""
if isinstance(newvalue, list):
newvalue = tuple(newvalue)
if isinstance(newvalue, str):
newvalue = newvalue.rstrip(")"... | def _tuplecheck(newvalue, dtype=str):
"""
Takes a string argument and returns value as a tuple.
Needed for paramfile conversion from CLI to set_params args
"""
if isinstance(newvalue, list):
newvalue = tuple(newvalue)
if isinstance(newvalue, str):
newvalue = newvalue.rstrip(")"... | [
"Takes",
"a",
"string",
"argument",
"and",
"returns",
"value",
"as",
"a",
"tuple",
".",
"Needed",
"for",
"paramfile",
"conversion",
"from",
"CLI",
"to",
"set_params",
"args"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1628-L1658 | [
"def",
"_tuplecheck",
"(",
"newvalue",
",",
"dtype",
"=",
"str",
")",
":",
"if",
"isinstance",
"(",
"newvalue",
",",
"list",
")",
":",
"newvalue",
"=",
"tuple",
"(",
"newvalue",
")",
"if",
"isinstance",
"(",
"newvalue",
",",
"str",
")",
":",
"newvalue"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _paramschecker | Raises exceptions when params are set to values they should not be | ipyrad/core/assembly.py | def _paramschecker(self, param, newvalue):
""" Raises exceptions when params are set to values they should not be"""
if param == 'assembly_name':
## Make sure somebody doesn't try to change their assembly_name, bad
## things would happen. Calling set_params on assembly_name only raises
... | def _paramschecker(self, param, newvalue):
""" Raises exceptions when params are set to values they should not be"""
if param == 'assembly_name':
## Make sure somebody doesn't try to change their assembly_name, bad
## things would happen. Calling set_params on assembly_name only raises
... | [
"Raises",
"exceptions",
"when",
"params",
"are",
"set",
"to",
"values",
"they",
"should",
"not",
"be"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1662-L2015 | [
"def",
"_paramschecker",
"(",
"self",
",",
"param",
",",
"newvalue",
")",
":",
"if",
"param",
"==",
"'assembly_name'",
":",
"## Make sure somebody doesn't try to change their assembly_name, bad",
"## things would happen. Calling set_params on assembly_name only raises",
"## an info... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.stats | Returns a data frame with Sample data and state. | ipyrad/core/assembly.py | def stats(self):
""" Returns a data frame with Sample data and state. """
nameordered = self.samples.keys()
nameordered.sort()
## Set pandas to display all samples instead of truncating
pd.options.display.max_rows = len(self.samples)
statdat = pd.DataFrame([self.samples[... | def stats(self):
""" Returns a data frame with Sample data and state. """
nameordered = self.samples.keys()
nameordered.sort()
## Set pandas to display all samples instead of truncating
pd.options.display.max_rows = len(self.samples)
statdat = pd.DataFrame([self.samples[... | [
"Returns",
"a",
"data",
"frame",
"with",
"Sample",
"data",
"and",
"state",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L244-L257 | [
"def",
"stats",
"(",
"self",
")",
":",
"nameordered",
"=",
"self",
".",
"samples",
".",
"keys",
"(",
")",
"nameordered",
".",
"sort",
"(",
")",
"## Set pandas to display all samples instead of truncating",
"pd",
".",
"options",
".",
"display",
".",
"max_rows",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.files | Returns a data frame with Sample files. Not very readable... | ipyrad/core/assembly.py | def files(self):
""" Returns a data frame with Sample files. Not very readable... """
nameordered = self.samples.keys()
nameordered.sort()
## replace curdir with . for shorter printing
#fullcurdir = os.path.realpath(os.path.curdir)
return pd.DataFrame([self.samples[i].fil... | def files(self):
""" Returns a data frame with Sample files. Not very readable... """
nameordered = self.samples.keys()
nameordered.sort()
## replace curdir with . for shorter printing
#fullcurdir = os.path.realpath(os.path.curdir)
return pd.DataFrame([self.samples[i].fil... | [
"Returns",
"a",
"data",
"frame",
"with",
"Sample",
"files",
".",
"Not",
"very",
"readable",
"..."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L261-L268 | [
"def",
"files",
"(",
"self",
")",
":",
"nameordered",
"=",
"self",
".",
"samples",
".",
"keys",
"(",
")",
"nameordered",
".",
"sort",
"(",
")",
"## replace curdir with . for shorter printing",
"#fullcurdir = os.path.realpath(os.path.curdir)",
"return",
"pd",
".",
"D... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._build_stat | Returns a data frame with Sample stats for each step | ipyrad/core/assembly.py | def _build_stat(self, idx):
""" Returns a data frame with Sample stats for each step """
nameordered = self.samples.keys()
nameordered.sort()
newdat = pd.DataFrame([self.samples[i].stats_dfs[idx] \
for i in nameordered], index=nameordered)\
... | def _build_stat(self, idx):
""" Returns a data frame with Sample stats for each step """
nameordered = self.samples.keys()
nameordered.sort()
newdat = pd.DataFrame([self.samples[i].stats_dfs[idx] \
for i in nameordered], index=nameordered)\
... | [
"Returns",
"a",
"data",
"frame",
"with",
"Sample",
"stats",
"for",
"each",
"step"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L271-L278 | [
"def",
"_build_stat",
"(",
"self",
",",
"idx",
")",
":",
"nameordered",
"=",
"self",
".",
"samples",
".",
"keys",
"(",
")",
"nameordered",
".",
"sort",
"(",
")",
"newdat",
"=",
"pd",
".",
"DataFrame",
"(",
"[",
"self",
".",
"samples",
"[",
"i",
"]"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._link_fastqs | Create Sample objects from demultiplexed fastq files in sorted_fastq_path,
or append additional fastq files to existing Samples. This provides
more flexible file input through the API than available in step1 of the
command line interface. If passed ipyclient it will run in parallel.
Not... | ipyrad/core/assembly.py | def _link_fastqs(self, path=None, force=False, append=False, splitnames="_",
fields=None, ipyclient=None):
"""
Create Sample objects from demultiplexed fastq files in sorted_fastq_path,
or append additional fastq files to existing Samples. This provides
more flexible file input t... | def _link_fastqs(self, path=None, force=False, append=False, splitnames="_",
fields=None, ipyclient=None):
"""
Create Sample objects from demultiplexed fastq files in sorted_fastq_path,
or append additional fastq files to existing Samples. This provides
more flexible file input t... | [
"Create",
"Sample",
"objects",
"from",
"demultiplexed",
"fastq",
"files",
"in",
"sorted_fastq_path",
"or",
"append",
"additional",
"fastq",
"files",
"to",
"existing",
"Samples",
".",
"This",
"provides",
"more",
"flexible",
"file",
"input",
"through",
"the",
"API",... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L289-L556 | [
"def",
"_link_fastqs",
"(",
"self",
",",
"path",
"=",
"None",
",",
"force",
"=",
"False",
",",
"append",
"=",
"False",
",",
"splitnames",
"=",
"\"_\"",
",",
"fields",
"=",
"None",
",",
"ipyclient",
"=",
"None",
")",
":",
"## cannot both force and append at... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._link_barcodes | Private function. Links Sample barcodes in a dictionary as
[Assembly].barcodes, with barcodes parsed from the 'barcodes_path'
parameter. This function is called during set_params() when setting
the barcodes_path. | ipyrad/core/assembly.py | def _link_barcodes(self):
"""
Private function. Links Sample barcodes in a dictionary as
[Assembly].barcodes, with barcodes parsed from the 'barcodes_path'
parameter. This function is called during set_params() when setting
the barcodes_path.
"""
## parse barcode... | def _link_barcodes(self):
"""
Private function. Links Sample barcodes in a dictionary as
[Assembly].barcodes, with barcodes parsed from the 'barcodes_path'
parameter. This function is called during set_params() when setting
the barcodes_path.
"""
## parse barcode... | [
"Private",
"function",
".",
"Links",
"Sample",
"barcodes",
"in",
"a",
"dictionary",
"as",
"[",
"Assembly",
"]",
".",
"barcodes",
"with",
"barcodes",
"parsed",
"from",
"the",
"barcodes_path",
"parameter",
".",
"This",
"function",
"is",
"called",
"during",
"set_... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L560-L620 | [
"def",
"_link_barcodes",
"(",
"self",
")",
":",
"## parse barcodefile",
"try",
":",
"## allows fuzzy match to barcodefile name",
"barcodefile",
"=",
"glob",
".",
"glob",
"(",
"self",
".",
"paramsdict",
"[",
"\"barcodes_path\"",
"]",
")",
"[",
"0",
"]",
"## read in... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._link_populations | Creates self.populations dictionary to save mappings of individuals to
populations/sites, and checks that individual names match with Samples.
The self.populations dict keys are pop names and the values are lists
of length 2. The first element is the min number of samples per pop
for fin... | ipyrad/core/assembly.py | def _link_populations(self, popdict=None, popmins=None):
"""
Creates self.populations dictionary to save mappings of individuals to
populations/sites, and checks that individual names match with Samples.
The self.populations dict keys are pop names and the values are lists
of len... | def _link_populations(self, popdict=None, popmins=None):
"""
Creates self.populations dictionary to save mappings of individuals to
populations/sites, and checks that individual names match with Samples.
The self.populations dict keys are pop names and the values are lists
of len... | [
"Creates",
"self",
".",
"populations",
"dictionary",
"to",
"save",
"mappings",
"of",
"individuals",
"to",
"populations",
"/",
"sites",
"and",
"checks",
"that",
"individual",
"names",
"match",
"with",
"Samples",
".",
"The",
"self",
".",
"populations",
"dict",
"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L624-L730 | [
"def",
"_link_populations",
"(",
"self",
",",
"popdict",
"=",
"None",
",",
"popmins",
"=",
"None",
")",
":",
"if",
"not",
"popdict",
":",
"## glob it in case of fuzzy matching",
"popfile",
"=",
"glob",
".",
"glob",
"(",
"self",
".",
"paramsdict",
"[",
"\"pop... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.get_params | pretty prints params if called as a function | ipyrad/core/assembly.py | def get_params(self, param=""):
""" pretty prints params if called as a function """
fullcurdir = os.path.realpath(os.path.curdir)
if not param:
for index, (key, value) in enumerate(self.paramsdict.items()):
if isinstance(value, str):
value = value... | def get_params(self, param=""):
""" pretty prints params if called as a function """
fullcurdir = os.path.realpath(os.path.curdir)
if not param:
for index, (key, value) in enumerate(self.paramsdict.items()):
if isinstance(value, str):
value = value... | [
"pretty",
"prints",
"params",
"if",
"called",
"as",
"a",
"function"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L734-L752 | [
"def",
"get_params",
"(",
"self",
",",
"param",
"=",
"\"\"",
")",
":",
"fullcurdir",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"curdir",
")",
"if",
"not",
"param",
":",
"for",
"index",
",",
"(",
"key",
",",
"value",
")... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.set_params | Set a parameter to a new value. Raises error if newvalue is wrong type.
Note
----
Use [Assembly].get_params() to see the parameter values currently
linked to the Assembly object.
Parameters
----------
param : int or str
The index (e.g., 1) or string ... | ipyrad/core/assembly.py | def set_params(self, param, newvalue):
"""
Set a parameter to a new value. Raises error if newvalue is wrong type.
Note
----
Use [Assembly].get_params() to see the parameter values currently
linked to the Assembly object.
Parameters
----------
pa... | def set_params(self, param, newvalue):
"""
Set a parameter to a new value. Raises error if newvalue is wrong type.
Note
----
Use [Assembly].get_params() to see the parameter values currently
linked to the Assembly object.
Parameters
----------
pa... | [
"Set",
"a",
"parameter",
"to",
"a",
"new",
"value",
".",
"Raises",
"error",
"if",
"newvalue",
"is",
"wrong",
"type",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L756-L818 | [
"def",
"set_params",
"(",
"self",
",",
"param",
",",
"newvalue",
")",
":",
"## this includes current params and some legacy params for conversion",
"legacy_params",
"=",
"[",
"\"edit_cutsites\"",
",",
"\"trim_overhang\"",
"]",
"current_params",
"=",
"self",
".",
"paramsdi... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.write_params | Write out the parameters of this assembly to a file properly
formatted as input for `ipyrad -p <params.txt>`. A good and
simple way to share/archive parameter settings for assemblies.
This is also the function that's used by __main__ to
generate default params.txt files for `ipyrad -n` | ipyrad/core/assembly.py | def write_params(self, outfile=None, force=False):
""" Write out the parameters of this assembly to a file properly
formatted as input for `ipyrad -p <params.txt>`. A good and
simple way to share/archive parameter settings for assemblies.
This is also the function that's used by __main__... | def write_params(self, outfile=None, force=False):
""" Write out the parameters of this assembly to a file properly
formatted as input for `ipyrad -p <params.txt>`. A good and
simple way to share/archive parameter settings for assemblies.
This is also the function that's used by __main__... | [
"Write",
"out",
"the",
"parameters",
"of",
"this",
"assembly",
"to",
"a",
"file",
"properly",
"formatted",
"as",
"input",
"for",
"ipyrad",
"-",
"p",
"<params",
".",
"txt",
">",
".",
"A",
"good",
"and",
"simple",
"way",
"to",
"share",
"/",
"archive",
"p... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L822-L866 | [
"def",
"write_params",
"(",
"self",
",",
"outfile",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"if",
"outfile",
"is",
"None",
":",
"outfile",
"=",
"\"params-\"",
"+",
"self",
".",
"name",
"+",
"\".txt\"",
"## Test if params file already exists?",
"##... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.branch | Returns a copy of the Assembly object. Does not allow Assembly
object names to be replicated in namespace or path. | ipyrad/core/assembly.py | def branch(self, newname, subsamples=None, infile=None):
"""
Returns a copy of the Assembly object. Does not allow Assembly
object names to be replicated in namespace or path.
"""
## subsample by removal or keeping.
remove = 0
## is there a better way to ask if i... | def branch(self, newname, subsamples=None, infile=None):
"""
Returns a copy of the Assembly object. Does not allow Assembly
object names to be replicated in namespace or path.
"""
## subsample by removal or keeping.
remove = 0
## is there a better way to ask if i... | [
"Returns",
"a",
"copy",
"of",
"the",
"Assembly",
"object",
".",
"Does",
"not",
"allow",
"Assembly",
"object",
"names",
"to",
"be",
"replicated",
"in",
"namespace",
"or",
"path",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L870-L931 | [
"def",
"branch",
"(",
"self",
",",
"newname",
",",
"subsamples",
"=",
"None",
",",
"infile",
"=",
"None",
")",
":",
"## subsample by removal or keeping.",
"remove",
"=",
"0",
"## is there a better way to ask if it already exists?",
"if",
"(",
"newname",
"==",
"self"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step1func | hidden wrapped function to start step 1 | ipyrad/core/assembly.py | def _step1func(self, force, ipyclient):
""" hidden wrapped function to start step 1 """
## check input data files
sfiles = self.paramsdict["sorted_fastq_path"]
rfiles = self.paramsdict["raw_fastq_path"]
## do not allow both a sorted_fastq_path and a raw_fastq
if sfiles ... | def _step1func(self, force, ipyclient):
""" hidden wrapped function to start step 1 """
## check input data files
sfiles = self.paramsdict["sorted_fastq_path"]
rfiles = self.paramsdict["raw_fastq_path"]
## do not allow both a sorted_fastq_path and a raw_fastq
if sfiles ... | [
"hidden",
"wrapped",
"function",
"to",
"start",
"step",
"1"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L945-L988 | [
"def",
"_step1func",
"(",
"self",
",",
"force",
",",
"ipyclient",
")",
":",
"## check input data files",
"sfiles",
"=",
"self",
".",
"paramsdict",
"[",
"\"sorted_fastq_path\"",
"]",
"rfiles",
"=",
"self",
".",
"paramsdict",
"[",
"\"raw_fastq_path\"",
"]",
"## do... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step2func | hidden wrapped function to start step 2 | ipyrad/core/assembly.py | def _step2func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 2"""
## print header
if self._headers:
print("\n Step 2: Filtering reads ")
## If no samples in this assembly then it means you skipped step1,
if not self.samples.keys():
... | def _step2func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 2"""
## print header
if self._headers:
print("\n Step 2: Filtering reads ")
## If no samples in this assembly then it means you skipped step1,
if not self.samples.keys():
... | [
"hidden",
"wrapped",
"function",
"to",
"start",
"step",
"2"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L992-L1013 | [
"def",
"_step2func",
"(",
"self",
",",
"samples",
",",
"force",
",",
"ipyclient",
")",
":",
"## print header",
"if",
"self",
".",
"_headers",
":",
"print",
"(",
"\"\\n Step 2: Filtering reads \"",
")",
"## If no samples in this assembly then it means you skipped step1,",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step3func | hidden wrapped function to start step 3 | ipyrad/core/assembly.py | def _step3func(self, samples, noreverse, maxindels, force, ipyclient):
""" hidden wrapped function to start step 3 """
## print headers
if self._headers:
print("\n Step 3: Clustering/Mapping reads")
## Require reference seq for reference-based methods
if self.params... | def _step3func(self, samples, noreverse, maxindels, force, ipyclient):
""" hidden wrapped function to start step 3 """
## print headers
if self._headers:
print("\n Step 3: Clustering/Mapping reads")
## Require reference seq for reference-based methods
if self.params... | [
"hidden",
"wrapped",
"function",
"to",
"start",
"step",
"3"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1017-L1065 | [
"def",
"_step3func",
"(",
"self",
",",
"samples",
",",
"noreverse",
",",
"maxindels",
",",
"force",
",",
"ipyclient",
")",
":",
"## print headers",
"if",
"self",
".",
"_headers",
":",
"print",
"(",
"\"\\n Step 3: Clustering/Mapping reads\"",
")",
"## Require refe... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step4func | hidden wrapped function to start step 4 | ipyrad/core/assembly.py | def _step4func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 4 """
if self._headers:
print("\n Step 4: Joint estimation of error rate and heterozygosity")
## Get sample objects from list of strings
samples = _get_samples(self, samples)
... | def _step4func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 4 """
if self._headers:
print("\n Step 4: Joint estimation of error rate and heterozygosity")
## Get sample objects from list of strings
samples = _get_samples(self, samples)
... | [
"hidden",
"wrapped",
"function",
"to",
"start",
"step",
"4"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1069-L1089 | [
"def",
"_step4func",
"(",
"self",
",",
"samples",
",",
"force",
",",
"ipyclient",
")",
":",
"if",
"self",
".",
"_headers",
":",
"print",
"(",
"\"\\n Step 4: Joint estimation of error rate and heterozygosity\"",
")",
"## Get sample objects from list of strings",
"samples"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step5func | hidden wrapped function to start step 5 | ipyrad/core/assembly.py | def _step5func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 5 """
## print header
if self._headers:
print("\n Step 5: Consensus base calling ")
## Get sample objects from list of strings
samples = _get_samples(self, samples)
#... | def _step5func(self, samples, force, ipyclient):
""" hidden wrapped function to start step 5 """
## print header
if self._headers:
print("\n Step 5: Consensus base calling ")
## Get sample objects from list of strings
samples = _get_samples(self, samples)
#... | [
"hidden",
"wrapped",
"function",
"to",
"start",
"step",
"5"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1093-L1112 | [
"def",
"_step5func",
"(",
"self",
",",
"samples",
",",
"force",
",",
"ipyclient",
")",
":",
"## print header",
"if",
"self",
".",
"_headers",
":",
"print",
"(",
"\"\\n Step 5: Consensus base calling \"",
")",
"## Get sample objects from list of strings",
"samples",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step6func | Hidden function to start Step 6. | ipyrad/core/assembly.py | def _step6func(self,
samples,
noreverse,
force,
randomseed,
ipyclient,
**kwargs):
"""
Hidden function to start Step 6.
"""
## Get sample objects from list of strings
samples = _get_samples(self, samples)
## remove ... | def _step6func(self,
samples,
noreverse,
force,
randomseed,
ipyclient,
**kwargs):
"""
Hidden function to start Step 6.
"""
## Get sample objects from list of strings
samples = _get_samples(self, samples)
## remove ... | [
"Hidden",
"function",
"to",
"start",
"Step",
"6",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1116-L1157 | [
"def",
"_step6func",
"(",
"self",
",",
"samples",
",",
"noreverse",
",",
"force",
",",
"randomseed",
",",
"ipyclient",
",",
"*",
"*",
"kwargs",
")",
":",
"## Get sample objects from list of strings",
"samples",
"=",
"_get_samples",
"(",
"self",
",",
"samples",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._step7func | Step 7: Filter and write output files | ipyrad/core/assembly.py | def _step7func(self, samples, force, ipyclient):
""" Step 7: Filter and write output files """
## Get sample objects from list of strings
samples = _get_samples(self, samples)
if self._headers:
print("\n Step 7: Filter and write output files for {} Samples".\
... | def _step7func(self, samples, force, ipyclient):
""" Step 7: Filter and write output files """
## Get sample objects from list of strings
samples = _get_samples(self, samples)
if self._headers:
print("\n Step 7: Filter and write output files for {} Samples".\
... | [
"Step",
"7",
":",
"Filter",
"and",
"write",
"output",
"files"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1161-L1204 | [
"def",
"_step7func",
"(",
"self",
",",
"samples",
",",
"force",
",",
"ipyclient",
")",
":",
"## Get sample objects from list of strings",
"samples",
"=",
"_get_samples",
"(",
"self",
",",
"samples",
")",
"if",
"self",
".",
"_headers",
":",
"print",
"(",
"\"\\n... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._samples_precheck | Return a list of samples that are actually ready for the next step.
Each step runs this prior to calling run, makes it easier to
centralize and normalize how each step is checking sample states.
mystep is the state produced by the current step. | ipyrad/core/assembly.py | def _samples_precheck(self, samples, mystep, force):
""" Return a list of samples that are actually ready for the next step.
Each step runs this prior to calling run, makes it easier to
centralize and normalize how each step is checking sample states.
mystep is the state prod... | def _samples_precheck(self, samples, mystep, force):
""" Return a list of samples that are actually ready for the next step.
Each step runs this prior to calling run, makes it easier to
centralize and normalize how each step is checking sample states.
mystep is the state prod... | [
"Return",
"a",
"list",
"of",
"samples",
"that",
"are",
"actually",
"ready",
"for",
"the",
"next",
"step",
".",
"Each",
"step",
"runs",
"this",
"prior",
"to",
"calling",
"run",
"makes",
"it",
"easier",
"to",
"centralize",
"and",
"normalize",
"how",
"each",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1208-L1222 | [
"def",
"_samples_precheck",
"(",
"self",
",",
"samples",
",",
"mystep",
",",
"force",
")",
":",
"subsample",
"=",
"[",
"]",
"## filter by state",
"for",
"sample",
"in",
"samples",
":",
"if",
"sample",
".",
"stats",
".",
"state",
"<",
"mystep",
"-",
"1",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly._compatible_params_check | check for mindepths after all params are set, b/c doing it while each
is being set becomes complicated | ipyrad/core/assembly.py | def _compatible_params_check(self):
""" check for mindepths after all params are set, b/c doing it while each
is being set becomes complicated """
## do not allow statistical < majrule
val1 = self.paramsdict["mindepth_statistical"]
val2 = self.paramsdict['mindepth_majrule']
... | def _compatible_params_check(self):
""" check for mindepths after all params are set, b/c doing it while each
is being set becomes complicated """
## do not allow statistical < majrule
val1 = self.paramsdict["mindepth_statistical"]
val2 = self.paramsdict['mindepth_majrule']
... | [
"check",
"for",
"mindepths",
"after",
"all",
"params",
"are",
"set",
"b",
"/",
"c",
"doing",
"it",
"while",
"each",
"is",
"being",
"set",
"becomes",
"complicated"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1226-L1240 | [
"def",
"_compatible_params_check",
"(",
"self",
")",
":",
"## do not allow statistical < majrule",
"val1",
"=",
"self",
".",
"paramsdict",
"[",
"\"mindepth_statistical\"",
"]",
"val2",
"=",
"self",
".",
"paramsdict",
"[",
"'mindepth_majrule'",
"]",
"if",
"val1",
"<"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Assembly.run | Run assembly steps of an ipyrad analysis. Enter steps as a string,
e.g., "1", "123", "12345". This step checks for an existing
ipcluster instance otherwise it raises an exception. The ipyparallel
connection is made using information from the _ipcluster dict of the
Assembly class object. | ipyrad/core/assembly.py | def run(self, steps=0, force=False, ipyclient=None,
show_cluster=0, **kwargs):
"""
Run assembly steps of an ipyrad analysis. Enter steps as a string,
e.g., "1", "123", "12345". This step checks for an existing
ipcluster instance otherwise it raises an exception. The ipyparallel
... | def run(self, steps=0, force=False, ipyclient=None,
show_cluster=0, **kwargs):
"""
Run assembly steps of an ipyrad analysis. Enter steps as a string,
e.g., "1", "123", "12345". This step checks for an existing
ipcluster instance otherwise it raises an exception. The ipyparallel
... | [
"Run",
"assembly",
"steps",
"of",
"an",
"ipyrad",
"analysis",
".",
"Enter",
"steps",
"as",
"a",
"string",
"e",
".",
"g",
".",
"1",
"123",
"12345",
".",
"This",
"step",
"checks",
"for",
"an",
"existing",
"ipcluster",
"instance",
"otherwise",
"it",
"raises... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/assembly.py#L1244-L1393 | [
"def",
"run",
"(",
"self",
",",
"steps",
"=",
"0",
",",
"force",
"=",
"False",
",",
"ipyclient",
"=",
"None",
",",
"show_cluster",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"## check that mindepth params are compatible, fix and report warning.",
"self",
"."... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Sample._to_fulldict | Write to dict including data frames. All sample dicts
are combined in save() to dump JSON output | ipyrad/core/sample.py | def _to_fulldict(self):
"""
Write to dict including data frames. All sample dicts
are combined in save() to dump JSON output """
##
returndict = OrderedDict([
("name", self.name),
("barcode", self.barcode),
("files", self.files),
... | def _to_fulldict(self):
"""
Write to dict including data frames. All sample dicts
are combined in save() to dump JSON output """
##
returndict = OrderedDict([
("name", self.name),
("barcode", self.barcode),
("files", self.files),
... | [
"Write",
"to",
"dict",
"including",
"data",
"frames",
".",
"All",
"sample",
"dicts",
"are",
"combined",
"in",
"save",
"()",
"to",
"dump",
"JSON",
"output"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/sample.py#L103-L124 | [
"def",
"_to_fulldict",
"(",
"self",
")",
":",
"## ",
"returndict",
"=",
"OrderedDict",
"(",
"[",
"(",
"\"name\"",
",",
"self",
".",
"name",
")",
",",
"(",
"\"barcode\"",
",",
"self",
".",
"barcode",
")",
",",
"(",
"\"files\"",
",",
"self",
".",
"file... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | combinefiles | Joins first and second read file names | ipyrad/assemble/demultiplex.py | def combinefiles(filepath):
""" Joins first and second read file names """
## unpack seq files in filepath
fastqs = glob.glob(filepath)
firsts = [i for i in fastqs if "_R1_" in i]
## check names
if not firsts:
raise IPyradWarningExit("First read files names must contain '_R1_'.")
#... | def combinefiles(filepath):
""" Joins first and second read file names """
## unpack seq files in filepath
fastqs = glob.glob(filepath)
firsts = [i for i in fastqs if "_R1_" in i]
## check names
if not firsts:
raise IPyradWarningExit("First read files names must contain '_R1_'.")
#... | [
"Joins",
"first",
"and",
"second",
"read",
"file",
"names"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L31-L43 | [
"def",
"combinefiles",
"(",
"filepath",
")",
":",
"## unpack seq files in filepath",
"fastqs",
"=",
"glob",
".",
"glob",
"(",
"filepath",
")",
"firsts",
"=",
"[",
"i",
"for",
"i",
"in",
"fastqs",
"if",
"\"_R1_\"",
"in",
"i",
"]",
"## check names",
"if",
"n... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | findbcode | find barcode sequence in the beginning of read | ipyrad/assemble/demultiplex.py | def findbcode(cutters, longbar, read1):
""" find barcode sequence in the beginning of read """
## default barcode string
for cutter in cutters[0]:
## If the cutter is unambiguous there will only be one.
if not cutter:
continue
search = read1[1][:int(longbar[0]+len(cutter)... | def findbcode(cutters, longbar, read1):
""" find barcode sequence in the beginning of read """
## default barcode string
for cutter in cutters[0]:
## If the cutter is unambiguous there will only be one.
if not cutter:
continue
search = read1[1][:int(longbar[0]+len(cutter)... | [
"find",
"barcode",
"sequence",
"in",
"the",
"beginning",
"of",
"read"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L47-L59 | [
"def",
"findbcode",
"(",
"cutters",
",",
"longbar",
",",
"read1",
")",
":",
"## default barcode string",
"for",
"cutter",
"in",
"cutters",
"[",
"0",
"]",
":",
"## If the cutter is unambiguous there will only be one.",
"if",
"not",
"cutter",
":",
"continue",
"search"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | find3radbcode | find barcode sequence in the beginning of read | ipyrad/assemble/demultiplex.py | def find3radbcode(cutters, longbar, read1):
""" find barcode sequence in the beginning of read """
## default barcode string
for ambigcuts in cutters:
for cutter in ambigcuts:
## If the cutter is unambiguous there will only be one.
if not cutter:
continue
... | def find3radbcode(cutters, longbar, read1):
""" find barcode sequence in the beginning of read """
## default barcode string
for ambigcuts in cutters:
for cutter in ambigcuts:
## If the cutter is unambiguous there will only be one.
if not cutter:
continue
... | [
"find",
"barcode",
"sequence",
"in",
"the",
"beginning",
"of",
"read"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L63-L76 | [
"def",
"find3radbcode",
"(",
"cutters",
",",
"longbar",
",",
"read1",
")",
":",
"## default barcode string",
"for",
"ambigcuts",
"in",
"cutters",
":",
"for",
"cutter",
"in",
"ambigcuts",
":",
"## If the cutter is unambiguous there will only be one.",
"if",
"not",
"cut... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | make_stats | Write stats and stores to Assembly object. | ipyrad/assemble/demultiplex.py | def make_stats(data, perfile, fsamplehits, fbarhits, fmisses, fdbars):
"""
Write stats and stores to Assembly object.
"""
## out file
outhandle = os.path.join(data.dirs.fastqs, 's1_demultiplex_stats.txt')
outfile = open(outhandle, 'w')
## write the header for file stats -------------------... | def make_stats(data, perfile, fsamplehits, fbarhits, fmisses, fdbars):
"""
Write stats and stores to Assembly object.
"""
## out file
outhandle = os.path.join(data.dirs.fastqs, 's1_demultiplex_stats.txt')
outfile = open(outhandle, 'w')
## write the header for file stats -------------------... | [
"Write",
"stats",
"and",
"stores",
"to",
"Assembly",
"object",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L80-L202 | [
"def",
"make_stats",
"(",
"data",
",",
"perfile",
",",
"fsamplehits",
",",
"fbarhits",
",",
"fmisses",
",",
"fdbars",
")",
":",
"## out file",
"outhandle",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"fastqs",
",",
"'s1_demultiple... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | barmatch2 | cleaner barmatch func... | ipyrad/assemble/demultiplex.py | def barmatch2(data, tups, cutters, longbar, matchdict, fnum):
"""
cleaner barmatch func...
"""
## how many reads to store before writing to disk
waitchunk = int(1e6)
## pid name for this engine
epid = os.getpid()
## counters for total reads, those with cutsite, and those that matched
... | def barmatch2(data, tups, cutters, longbar, matchdict, fnum):
"""
cleaner barmatch func...
"""
## how many reads to store before writing to disk
waitchunk = int(1e6)
## pid name for this engine
epid = os.getpid()
## counters for total reads, those with cutsite, and those that matched
... | [
"cleaner",
"barmatch",
"func",
"..."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L207-L373 | [
"def",
"barmatch2",
"(",
"data",
",",
"tups",
",",
"cutters",
",",
"longbar",
",",
"matchdict",
",",
"fnum",
")",
":",
"## how many reads to store before writing to disk",
"waitchunk",
"=",
"int",
"(",
"1e6",
")",
"## pid name for this engine",
"epid",
"=",
"os",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_barcode_func | returns the fastest func given data & longbar | ipyrad/assemble/demultiplex.py | def get_barcode_func(data, longbar):
""" returns the fastest func given data & longbar"""
## build func for finding barcode
if longbar[1] == 'same':
if data.paramsdict["datatype"] == '2brad':
def getbarcode(cutters, read1, longbar):
""" find barcode for 2bRAD data """
... | def get_barcode_func(data, longbar):
""" returns the fastest func given data & longbar"""
## build func for finding barcode
if longbar[1] == 'same':
if data.paramsdict["datatype"] == '2brad':
def getbarcode(cutters, read1, longbar):
""" find barcode for 2bRAD data """
... | [
"returns",
"the",
"fastest",
"func",
"given",
"data",
"&",
"longbar"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L377-L394 | [
"def",
"get_barcode_func",
"(",
"data",
",",
"longbar",
")",
":",
"## build func for finding barcode",
"if",
"longbar",
"[",
"1",
"]",
"==",
"'same'",
":",
"if",
"data",
".",
"paramsdict",
"[",
"\"datatype\"",
"]",
"==",
"'2brad'",
":",
"def",
"getbarcode",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_quart_iter | returns an iterator to grab four lines at a time | ipyrad/assemble/demultiplex.py | def get_quart_iter(tups):
""" returns an iterator to grab four lines at a time """
if tups[0].endswith(".gz"):
ofunc = gzip.open
else:
ofunc = open
## create iterators
ofile1 = ofunc(tups[0], 'r')
fr1 = iter(ofile1)
quart1 = itertools.izip(fr1, fr1, fr1, fr1)
if tups[... | def get_quart_iter(tups):
""" returns an iterator to grab four lines at a time """
if tups[0].endswith(".gz"):
ofunc = gzip.open
else:
ofunc = open
## create iterators
ofile1 = ofunc(tups[0], 'r')
fr1 = iter(ofile1)
quart1 = itertools.izip(fr1, fr1, fr1, fr1)
if tups[... | [
"returns",
"an",
"iterator",
"to",
"grab",
"four",
"lines",
"at",
"a",
"time"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L398-L426 | [
"def",
"get_quart_iter",
"(",
"tups",
")",
":",
"if",
"tups",
"[",
"0",
"]",
".",
"endswith",
"(",
"\".gz\"",
")",
":",
"ofunc",
"=",
"gzip",
".",
"open",
"else",
":",
"ofunc",
"=",
"open",
"## create iterators ",
"ofile1",
"=",
"ofunc",
"(",
"tups",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | writetofastq | Writes sorted data 'dsort dict' to a tmp files | ipyrad/assemble/demultiplex.py | def writetofastq(data, dsort, read):
"""
Writes sorted data 'dsort dict' to a tmp files
"""
if read == 1:
rrr = "R1"
else:
rrr = "R2"
for sname in dsort:
## skip writing if empty. Write to tmpname
handle = os.path.join(data.dirs.fastqs,
"{}_{}_.... | def writetofastq(data, dsort, read):
"""
Writes sorted data 'dsort dict' to a tmp files
"""
if read == 1:
rrr = "R1"
else:
rrr = "R2"
for sname in dsort:
## skip writing if empty. Write to tmpname
handle = os.path.join(data.dirs.fastqs,
"{}_{}_.... | [
"Writes",
"sorted",
"data",
"dsort",
"dict",
"to",
"a",
"tmp",
"files"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L624-L638 | [
"def",
"writetofastq",
"(",
"data",
",",
"dsort",
",",
"read",
")",
":",
"if",
"read",
"==",
"1",
":",
"rrr",
"=",
"\"R1\"",
"else",
":",
"rrr",
"=",
"\"R2\"",
"for",
"sname",
"in",
"dsort",
":",
"## skip writing if empty. Write to tmpname",
"handle",
"=",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | collate_files | Collate temp fastq files in tmp-dir into 1 gzipped sample. | ipyrad/assemble/demultiplex.py | def collate_files(data, sname, tmp1s, tmp2s):
"""
Collate temp fastq files in tmp-dir into 1 gzipped sample.
"""
## out handle
out1 = os.path.join(data.dirs.fastqs, "{}_R1_.fastq.gz".format(sname))
out = io.BufferedWriter(gzip.open(out1, 'w'))
## build cmd
cmd1 = ['cat']
for tmpfil... | def collate_files(data, sname, tmp1s, tmp2s):
"""
Collate temp fastq files in tmp-dir into 1 gzipped sample.
"""
## out handle
out1 = os.path.join(data.dirs.fastqs, "{}_R1_.fastq.gz".format(sname))
out = io.BufferedWriter(gzip.open(out1, 'w'))
## build cmd
cmd1 = ['cat']
for tmpfil... | [
"Collate",
"temp",
"fastq",
"files",
"in",
"tmp",
"-",
"dir",
"into",
"1",
"gzipped",
"sample",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L684-L738 | [
"def",
"collate_files",
"(",
"data",
",",
"sname",
",",
"tmp1s",
",",
"tmp2s",
")",
":",
"## out handle",
"out1",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"fastqs",
",",
"\"{}_R1_.fastq.gz\"",
".",
"format",
"(",
"sname",
")"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | prechecks2 | A new simplified version of prechecks func before demux
Checks before starting analysis.
-----------------------------------
1) Is there data in raw_fastq_path
2) Is there a barcode file
3) Is there a workdir and fastqdir
4) remove old fastq/tmp_sample_R*_ dirs/
5) return file names as pair... | ipyrad/assemble/demultiplex.py | def prechecks2(data, force):
"""
A new simplified version of prechecks func before demux
Checks before starting analysis.
-----------------------------------
1) Is there data in raw_fastq_path
2) Is there a barcode file
3) Is there a workdir and fastqdir
4) remove old fastq/tmp_sample_R... | def prechecks2(data, force):
"""
A new simplified version of prechecks func before demux
Checks before starting analysis.
-----------------------------------
1) Is there data in raw_fastq_path
2) Is there a barcode file
3) Is there a workdir and fastqdir
4) remove old fastq/tmp_sample_R... | [
"A",
"new",
"simplified",
"version",
"of",
"prechecks",
"func",
"before",
"demux",
"Checks",
"before",
"starting",
"analysis",
".",
"-----------------------------------",
"1",
")",
"Is",
"there",
"data",
"in",
"raw_fastq_path",
"2",
")",
"Is",
"there",
"a",
"bar... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L741-L816 | [
"def",
"prechecks2",
"(",
"data",
",",
"force",
")",
":",
"## check for data using glob for fuzzy matching",
"if",
"not",
"glob",
".",
"glob",
"(",
"data",
".",
"paramsdict",
"[",
"\"raw_fastq_path\"",
"]",
")",
":",
"raise",
"IPyradWarningExit",
"(",
"NO_RAWS",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | inverse_barcodes | Build full inverse barcodes dictionary | ipyrad/assemble/demultiplex.py | def inverse_barcodes(data):
""" Build full inverse barcodes dictionary """
matchdict = {}
bases = set("CATGN")
poss = set()
## do perfect matches
for sname, barc in data.barcodes.items():
## remove -technical-replicate-N if present
if "-technical-replicate-" in sname:
... | def inverse_barcodes(data):
""" Build full inverse barcodes dictionary """
matchdict = {}
bases = set("CATGN")
poss = set()
## do perfect matches
for sname, barc in data.barcodes.items():
## remove -technical-replicate-N if present
if "-technical-replicate-" in sname:
... | [
"Build",
"full",
"inverse",
"barcodes",
"dictionary"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L820-L880 | [
"def",
"inverse_barcodes",
"(",
"data",
")",
":",
"matchdict",
"=",
"{",
"}",
"bases",
"=",
"set",
"(",
"\"CATGN\"",
")",
"poss",
"=",
"set",
"(",
")",
"## do perfect matches",
"for",
"sname",
",",
"barc",
"in",
"data",
".",
"barcodes",
".",
"items",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | estimate_optim | Estimate a reasonable optim value by grabbing a chunk of sequences,
decompressing and counting them, to estimate the full file size. | ipyrad/assemble/demultiplex.py | def estimate_optim(data, testfile, ipyclient):
"""
Estimate a reasonable optim value by grabbing a chunk of sequences,
decompressing and counting them, to estimate the full file size.
"""
## count the len of one file and assume all others are similar len
insize = os.path.getsize(testfile)
... | def estimate_optim(data, testfile, ipyclient):
"""
Estimate a reasonable optim value by grabbing a chunk of sequences,
decompressing and counting them, to estimate the full file size.
"""
## count the len of one file and assume all others are similar len
insize = os.path.getsize(testfile)
... | [
"Estimate",
"a",
"reasonable",
"optim",
"value",
"by",
"grabbing",
"a",
"chunk",
"of",
"sequences",
"decompressing",
"and",
"counting",
"them",
"to",
"estimate",
"the",
"full",
"file",
"size",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L883-L912 | [
"def",
"estimate_optim",
"(",
"data",
",",
"testfile",
",",
"ipyclient",
")",
":",
"## count the len of one file and assume all others are similar len",
"insize",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"testfile",
")",
"tmp_file_name",
"=",
"os",
".",
"path",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | run2 | One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it. | ipyrad/assemble/demultiplex.py | def run2(data, ipyclient, force):
"""
One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it.
"""
## get file handles, name-lens, cutters, and matchdict
raws, longbar, cutters, matchdict = prechecks2(data, force)
## wra... | def run2(data, ipyclient, force):
"""
One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it.
"""
## get file handles, name-lens, cutters, and matchdict
raws, longbar, cutters, matchdict = prechecks2(data, force)
## wra... | [
"One",
"input",
"file",
"(",
"or",
"pair",
")",
"is",
"run",
"on",
"two",
"processors",
"one",
"for",
"reading",
"and",
"decompressing",
"the",
"data",
"and",
"the",
"other",
"for",
"demuxing",
"it",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L915-L955 | [
"def",
"run2",
"(",
"data",
",",
"ipyclient",
",",
"force",
")",
":",
"## get file handles, name-lens, cutters, and matchdict",
"raws",
",",
"longbar",
",",
"cutters",
",",
"matchdict",
"=",
"prechecks2",
"(",
"data",
",",
"force",
")",
"## wrap funcs to ensure we c... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _cleanup_and_die | cleanup func for step 1 | ipyrad/assemble/demultiplex.py | def _cleanup_and_die(data):
""" cleanup func for step 1 """
tmpfiles = glob.glob(os.path.join(data.dirs.fastqs, "tmp_*_R*.fastq"))
tmpfiles += glob.glob(os.path.join(data.dirs.fastqs, "tmp_*.p"))
for tmpf in tmpfiles:
os.remove(tmpf) | def _cleanup_and_die(data):
""" cleanup func for step 1 """
tmpfiles = glob.glob(os.path.join(data.dirs.fastqs, "tmp_*_R*.fastq"))
tmpfiles += glob.glob(os.path.join(data.dirs.fastqs, "tmp_*.p"))
for tmpf in tmpfiles:
os.remove(tmpf) | [
"cleanup",
"func",
"for",
"step",
"1"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L958-L963 | [
"def",
"_cleanup_and_die",
"(",
"data",
")",
":",
"tmpfiles",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"dirs",
".",
"fastqs",
",",
"\"tmp_*_R*.fastq\"",
")",
")",
"tmpfiles",
"+=",
"glob",
".",
"glob",
"(",
"os... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | run3 | One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it. | ipyrad/assemble/demultiplex.py | def run3(data, ipyclient, force):
"""
One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it.
"""
start = time.time()
## get file handles, name-lens, cutters, and matchdict,
## and remove any existing files if a previou... | def run3(data, ipyclient, force):
"""
One input file (or pair) is run on two processors, one for reading
and decompressing the data, and the other for demuxing it.
"""
start = time.time()
## get file handles, name-lens, cutters, and matchdict,
## and remove any existing files if a previou... | [
"One",
"input",
"file",
"(",
"or",
"pair",
")",
"is",
"run",
"on",
"two",
"processors",
"one",
"for",
"reading",
"and",
"decompressing",
"the",
"data",
"and",
"the",
"other",
"for",
"demuxing",
"it",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L968-L1026 | [
"def",
"run3",
"(",
"data",
",",
"ipyclient",
",",
"force",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"## get file handles, name-lens, cutters, and matchdict, ",
"## and remove any existing files if a previous run failed.",
"raws",
",",
"longbar",
",",
"cut... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | splitfiles | sends raws to be chunked | ipyrad/assemble/demultiplex.py | def splitfiles(data, raws, ipyclient):
""" sends raws to be chunked"""
## create a tmpdir for chunked_files and a chunk optimizer
tmpdir = os.path.join(data.paramsdict["project_dir"], "tmp-chunks-"+data.name)
if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
os.makedirs(tmpdir)
## chun... | def splitfiles(data, raws, ipyclient):
""" sends raws to be chunked"""
## create a tmpdir for chunked_files and a chunk optimizer
tmpdir = os.path.join(data.paramsdict["project_dir"], "tmp-chunks-"+data.name)
if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
os.makedirs(tmpdir)
## chun... | [
"sends",
"raws",
"to",
"be",
"chunked"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/demultiplex.py#L1030-L1065 | [
"def",
"splitfiles",
"(",
"data",
",",
"raws",
",",
"ipyclient",
")",
":",
"## create a tmpdir for chunked_files and a chunk optimizer ",
"tmpdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data",
".",
"paramsdict",
"[",
"\"project_dir\"",
"]",
",",
"\"tmp-chunks... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.