In [1]:
import ipyrad as ip

In [2]:
data = ip.Assembly("test")


New Assembly: test

In [3]:
data.set_params("project_dir", "sixseven")
data.set_params("raw_fastq_path", "./ipsimdata/rad_example_R1_.fastq.gz")
data.set_params("barcodes_path", "./ipsimdata/rad_example_barcodes.txt")

In [4]:
data.run("12345")


Assembly: test
[####################] 100%  sorting reads         | 0:00:02 | s1 | 
[####################] 100%  writing/compressing   | 0:00:00 | s1 | 
[####################] 100%  processing reads      | 0:00:02 | s2 | 
[####################] 100%  dereplicating         | 0:00:00 | s3 | 
[####################] 100%  clustering            | 0:00:01 | s3 | 
[####################] 100%  building clusters     | 0:00:00 | s3 | 
[####################] 100%  chunking              | 0:00:00 | s3 | 
[####################] 100%  aligning              | 0:00:10 | s3 | 
[####################] 100%  concatenating         | 0:00:00 | s3 | 
[####################] 100%  inferring [H, E]      | 0:00:03 | s4 | 
[####################] 100%  calculating depths    | 0:00:00 | s5 | 
[####################] 100%  chunking clusters     | 0:00:00 | s5 | 
[####################] 100%  consens calling       | 0:00:13 | s5 | 

Set populations


In [12]:
# define the groups
popdata = {
    "1": [i for i in data.samples if "1" in i], 
    "2": [i for i in data.samples if "2" in i],
    "3": [i for i in data.samples if "3" in i],
    }

# mincov values for the groups
popmins = {"1": 3, "2": 3, "3": 3}

# link the two dictionaries into a populations attribute
data._link_populations(popdict=popdata, popmins=popmins)

# view populations
data.populations


Out[12]:
{'1': (3, ['1A_0', '1B_0', '1C_0', '1D_0']),
 '2': (3, ['2G_0', '2E_0', '2F_0', '2H_0']),
 '3': (3, ['3K_0', '3J_0', '3I_0', '3L_0'])}

run six and seven with pops


In [13]:
data.run("6")


Assembly: test
[####################] 100%  concat/shuffle input  | 0:00:00 | s6 | 
[####################] 100%  clustering across     | 0:00:01 | s6 | 
[####################] 100%  building clusters     | 0:00:00 | s6 | 
[####################] 100%  aligning clusters     | 0:00:04 | s6 | 
[####################] 100%  database indels       | 0:00:00 | s6 | 
[####################] 100%  indexing clusters     | 0:00:01 | s6 | 
[####################] 100%  building database     | 0:00:00 | s6 | 

In [15]:
data.run("7")


Assembly: test
[####################] 100%  filtering loci        | 0:00:06 | s7 | 
[####################] 100%  building loci/stats   | 0:00:00 | s7 | 
[####################] 100%  building vcf file     | 0:00:03 | s7 | 
[####################] 100%  writing vcf file      | 0:00:00 | s7 | 
[####################] 100%  building arrays       | 0:00:00 | s7 | 
[####################] 100%  writing outfiles      | 0:00:00 | s7 | 
Outfiles written to: ~/scratch/ipyrad-hot/tests/sixseven/test_outfiles

But, now if we branch it breaks


In [26]:
# branch assembly
d2 = data.branch("d2", subsamples=[i for i in data.samples if i != "1A_0"])

# update pops to match new samples 
d2.populations['1'] = (3, ['1B_0', '1C_0', '1D_0'])

# run 7
d2.run("7", force=True)


Assembly: d2
[####################] 100%  filtering loci        | 0:00:00 | s7 | 

  Encountered an unexpected error (see ./ipyrad_log.txt)
  Error message is below -------------------------------
error in filter_stacks on chunk 0: IndexError(index 11 is out of bounds for axis 1 with size 11)

The same above retried after fix to code


In [1]:
import ipyrad as ip

In [2]:
d2 = ip.load_json("sixseven/d2.json")
d2.run("7", force=True)


loading Assembly: d2
from saved path: ~/scratch/ipyrad-hot/tests/sixseven/d2.json
Assembly: d2
[####################] 100%  filtering loci        | 0:00:07 | s7 | 
[####################] 100%  building loci/stats   | 0:00:00 | s7 | 
[####################] 100%  building vcf file     | 0:00:02 | s7 | 
[####################] 100%  writing vcf file      | 0:00:00 | s7 | 
[####################] 100%  building arrays       | 0:00:00 | s7 | 
[####################] 100%  writing outfiles      | 0:00:00 | s7 | 
Outfiles written to: ~/scratch/ipyrad-hot/tests/sixseven/d2_outfiles

modify pops again


In [5]:
# update pops to be diff from samples
d2.populations['1'] = (2, ['1C_0', '1D_0'])

# run 7
d2.run("7", force=True)


Assembly: d2
[####################] 100%  filtering loci        | 0:00:00 | s7 | 
[####################] 100%  building loci/stats   | 0:00:00 | s7 | 
[####################] 100%  building vcf file     | 0:00:01 | s7 | 
[####################] 100%  writing vcf file      | 0:00:00 | s7 | 
[####################] 100%  building arrays       | 0:00:00 | s7 | 
[####################] 100%  writing outfiles      | 0:00:00 | s7 | 
Outfiles written to: ~/scratch/ipyrad-hot/tests/sixseven/d2_outfiles


In [8]:
# update pops to be diff from samples
d3 = d2.branch("d3", subsamples=[i for i in d2.samples if i != "1B_0"])
d3.populations['1'] = (2, ['1C_0', '1D_0'])

# run 7
d3.run("7", force=True)


Assembly: d3
[####################] 100%  filtering loci        | 0:00:00 | s7 | 
[####################] 100%  building loci/stats   | 0:00:00 | s7 | 
[####################] 100%  building vcf file     | 0:00:01 | s7 | 
[####################] 100%  writing vcf file      | 0:00:00 | s7 | 
[####################] 100%  building arrays       | 0:00:00 | s7 | 
[####################] 100%  writing outfiles      | 0:00:00 | s7 | 
Outfiles written to: ~/scratch/ipyrad-hot/tests/sixseven/d3_outfiles


In [ ]: