Skip to content

Commit

Permalink
ipyparallel now called in ipyrad/__init__.py with ipcontroller functi…
Browse files Browse the repository at this point in the history
…on to modifiy controller types.
  • Loading branch information
dereneaton committed Nov 18, 2015
1 parent 258947b commit 6794f8a
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 135 deletions.
15 changes: 14 additions & 1 deletion ipyrad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
from . import plotting
from . import dstats
#from . import core

## create an ipyparallel controller with an exit call to close at sys
## exit, and a unique cluster-id name
from ipyrad.core.parallel import ipcontroller_init
from ipyrad.core.parallel import ipcontroller_set

global __IPNAME__
ipcontroller_init()

## load the functional modules
from ipyrad.core.assembly import Assembly
from ipyrad.core.assembly import merge
from ipyrad.core.sample import Sample
from ipyrad.core.paramsinfo import get_params_info
from ipyrad.core.load_dataobj import load_assembly

__version__ = "0.0.65"

__version__ = "0.0.66"


22 changes: 20 additions & 2 deletions ipyrad/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
""" the main CLI for calling ipyrad """

from __future__ import print_function, division # Requires Python 2.7+
import optparse


def main():
def parse_params():
""" a toy func """
## create a default Assembly object
data =
params = open(paramsfile).readlines()

xpoint = 3
print(xpoint, "CLI not ready yet")


def parse_command_line():
""" Parse CLI. Only three options now. """
## -p choose params file
## -s subselect steps
## -n create new params file
print("not yet")


if __name__ == "__main__":
main()

## parse params file input
parse_params()

##
2 changes: 2 additions & 0 deletions ipyrad/assemble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
from . import jointestimate
from . import consens_se



2 changes: 1 addition & 1 deletion ipyrad/assemble/cluster_within.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def cleanup(data, sample):
sample.depths.mjmin = keepmj
sample.depths.statmin = keepstat

data.stamp("s3 clustering on "+sample.name)
data._stamp("s3 clustering on "+sample.name)
else:
print("no clusters found for {}".format(sample.name))

Expand Down
10 changes: 5 additions & 5 deletions ipyrad/assemble/demultiplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,16 @@ def parallel_chunker(data, raws, paired, ipyclient):



def parallel_sorter(data, rawfilename, chunks, cutter, longbar, filenum, ipyclient):
def parallel_sorter(data, rawtups, chunks, cutter, longbar, filenum, ipyclient):
""" takes list of chunk files and runs barmatch function
on them across N processors and outputs temp file results.
on them across all engines and outputs temp file results.
This is parallelized on N chunks.
"""
## send file to multiprocess queue"
chunknum = 0
submitted_args = []
for tmptuple in chunks:
submitted_args.append([data, rawfilename, tmptuple, cutter,
submitted_args.append([data, rawtups, tmptuple, cutter,
longbar, chunknum, filenum])
chunknum += 1

Expand Down Expand Up @@ -754,15 +754,15 @@ def run(data, preview, ipyclient):

## run test
import ipyrad as ip
from ipyrad.core.assembly import Assembly
#from ipyrad.core.assembly import Assembly

## get current location
PATH = os.path.abspath(os.path.dirname(__file__))
## get location of test files
IPATH = os.path.dirname(os.path.dirname(PATH))

DATA = os.path.join(IPATH, "tests", "test_rad")
TEST = Assembly("test-demultiplex")
TEST = ip.Assembly("test-demultiplex")
#TEST = ip.load_assembly(os.path.join(DATA, "testrad"))
TEST.set_params(1, "./")
TEST.set_params(2, "./tests/data/sim_rad_test_R1_.fastq.gz")
Expand Down
7 changes: 2 additions & 5 deletions ipyrad/assemble/jointestimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import scipy.optimize
import numpy as np
import itertools
import glob
import os
import multiprocessing
import gzip
from ipyrad.assemble import worker
from collections import Counter


Expand Down Expand Up @@ -246,7 +243,7 @@ def run(data, samples, ipyclient, force):
lbview = ipyclient.load_balanced_view()
results = lbview.map_async(optim, submitted_args)
fakeres = results.get()
print(fakeres)
#print(fakeres)

## get results and remove temp files
cleanup(data, samples)
Expand All @@ -273,7 +270,7 @@ def cleanup(data, samples):
sampobj.stats["state"] = 4
sampobj.stats["hetero_est"] = est_h
sampobj.stats["error_est"] = est_e
data.stamp("s4 params estimated on "+sampobj.name)
data._stamp("s4 params estimated on "+sampobj.name)
os.remove(tempres)
else:
pass
Expand Down
2 changes: 1 addition & 1 deletion ipyrad/assemble/rawedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def cleanup(data, sample, submitted, results, force):
sample.stats.reads_filtered = fcounts["keep"]

## save stats to the sample??
data.stamp("s2 rawediting on "+sample.name)
data._stamp("s2 rawediting on "+sample.name)



Expand Down

0 comments on commit 6794f8a

Please sign in to comment.