#!/usr/bin/env python # coding: utf-8 # In[1]: import ipyrad as ip # In[2]: data = ip.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") # ### 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 # ### run six and seven with pops # In[13]: data.run("6") # In[15]: data.run("7") # ### 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) # ### 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) # ### 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) # 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) # In[ ]: