dereneaton / ipyrad

Interactive assembly and analysis of RAD-seq data sets
http://ipyrad.readthedocs.io
GNU General Public License v3.0
70 stars 39 forks source link

Problems wwith ipyrad.bpp #385

Closed k-sanchez closed 4 years ago

k-sanchez commented 4 years ago

Hi! I'm trying to replicate the analysis of 'Eaton & Ree (2013) single-end RAD data set', specifically species delimitation with BPP with my own data, the problem appears when I try to initiate a bpp object (runnnig in a jupyter notebook), here is the code and the error:

import ipyrad as ipa
import ipyrad.analysis as ipa

imap = {
    "L_sarmientoi": ["Clade8_sarmientoi_11448", "Clade8_sarmientoi_11450"],
    "L_escarchadosi": ["Clade1_escarchadosi_11465", "Clade1_escarchadosi_11468", "Clade1_escarchadosi_11477", "Clade1_escarchadosi_11484", "Clade1_escarchadosi_11486", "Clade1_escarchadosi_11541"],
    "L_11582": ["Clade3_baguali_11582"],
    "L_baguali": ["Clade3_baguali_11569", "Clade3_baguali_11572", "Clade3_baguali_9394", "Clade3_baguali_9395", "Clade3_baguali_9422", "Clade3_baguali_9434", "Clade3_baguali_9436"],
    "L_tari": ["Clade2_tari_7253", "Clade2_tari_9349", "Clade2_tari_9400", "Clade2_tari_9405", "Clade2_tari_9408"],
    "L_somuncurae": ["aff_somuncurae_9183"],
    }

#a tree hypothesis (guidetree) (here based on tetrad results) for the 'species' we've collapsed samples into.
newick = "((L_sarmientoi, ((L_escarchadosi, L_tari), (L_11582, L_baguali))), L_somuncurae);"

#.alleles.loci file
input_loci = '/media/kevin/KEVIN_HDD/ghp/datos/procesados/snps_g_kingii/spp_australes/ipyrad.process_radtags/clust90_min12_9183og_25_outfiles/clust90_min12_9183og_25.loci'

#initiate a bpp object
b = ipa.bpp(name='clust90_min12_9183og_25',
            locifile=input_loci,
            imap=imap,
            minmap=None,
            guidetree=newick,
           )

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-37-9126499ccbcb> in <module>
      4             imap=imap,
      5             minmap=None,
----> 6             guidetree='/home/kevin/Desktop/tre.nwk'
      7            )

~/miniconda3/envs/mypython3/lib/python3.6/site-packages/ipyrad/analysis/bpp.py in __init__(self, name, data, workdir, guidetree, imap, load_existing_results, *args, **kwargs)
    170         # store args
    171         self.name = name
--> 172         self.data = os.path.realpath(os.path.expanduser(data))
    173         self.workdir = os.path.realpath(os.path.expanduser(workdir))
    174         self.guidetree = guidetree

~/miniconda3/envs/mypython3/lib/python3.6/posixpath.py in expanduser(path)
    233     """Expand ~ and ~user constructions.  If user or $HOME is unknown,
    234     do nothing."""
--> 235     path = os.fspath(path)
    236     if isinstance(path, bytes):
    237         tilde = b'~'

TypeError: expected str, bytes or os.PathLike object, not NoneType

It appears that the problem is with the newick guide tree. Any help would be welcome! Thanks!!

isaacovercast commented 4 years ago

First of all, congratulations on being really good at making issues! You'd be surprised how many people are incapable of including the right details to solve the problem, but you got it all here, so good job.

The problem is here:

b = ipa.bpp(name='clust90_min12_9183og_25',
            locifile=input_loci,                                      <------
            imap=imap,
            minmap=None,
            guidetree=newick,
           )

The argument format in the analysis tools changed in the 0.9 branch and we didn't update the docs for this function. The problem is analysis tools need to be passed a data argument, which for bpp replaced the locifile argument. If you change locifile in the above command to data it'll work. I updated the docs and fixed the bpp.py to be more explicit about asking for data.

k-sanchez commented 4 years ago

Thanks a lot Isaac! that was the solution!

Cheers