BinPro / CONCOCT

Clustering cONtigs with COverage and ComposiTion
Other
124 stars 48 forks source link

issue between concoct_refine and fit function #248

Closed ldumond closed 5 years ago

ldumond commented 5 years ago

I have been trying to use concoct_refine on my binning using the following line

~/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filte
red/anvio/Concoct/concoct_refine clustering_contigs_R.csv original_data_gt1000.c
sv clustering_contigs_scg_1_sort.csv -t 1 > concoct_ref.out

in which Concoct version=1.0.0 and concoct_refine was modified according to issue #243 Unfortunately I get the following message:

/home/ldumond/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filtered/anvio/Concoct/con
coct_refine:39: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
original_data_matrix = original_data.as_matrix()
/home/ldumond/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filtered/anvio/Concoct/con
coct_refine:43: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
scg_freq_matrix = scg_freq.as_matrix()
/home/ldumond/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filtered/anvio/Concoct/con
coct_refine:47: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
clusters_matrix = clusters.as_matrix()
Traceback (most recent call last):
File "/home/ldumond/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filtered/anvio/Con
coct/concoct_refine", line 81, in <module>
main(sys.argv[1:])
File "/home/ldumond/work/Projects/Project_LIGNOME.972/Run_pool-lignome.12492/workinp/contigs_filtered/anvio/Con
coct/concoct_refine", line 68, in main
assigns = vbgmm.fit(np.copy(transform_k,order='C'),int(NK),int(args.threads))
File "c-concoct/vbgmm.pyx", line 19, in vbgmm.fit
TypeError: fit() takes exactly 4 positional arguments (3 given) 

Here is the vbgmm.pyx script

"""
vbgmm.pyx

simple cython wrapper for variational Gaussian mixture model in C

"""

import cython

# import both numpy and the Cython declarations for numpy
import numpy as np
cimport numpy as np

# declare the interface to the C code
cdef extern void c_vbgmm_fit (double* adX, int nN, int nD, int nK, int seed, int* anAssign, int nThre
ads)
@cython.boundscheck(False)
@cython.wraparound(False)

def fit(np.ndarray[double, ndim=2, mode="c"] xarray not None, nClusters, seed, threads):
    """
    fit (xarray, nClusters, seed, threads)

    Takes a numpy array xarray as input, fits the vbgmm using nClsuters initial clusters

    param: xarray -- a 2-d numpy array of np.float64
    param: nClusters -- an int, number of start clusters
    param: seed -- an int, the random seed
    param: threads -- int, the number of threads to use

    """
    cdef int nN, nD, nK, nThreads

    nN, nD = xarray.shape[0], xarray.shape[1]

    nK = nClusters

    nThreads = threads

    cdef np.ndarray[int, ndim=1,mode="c"] assign = np.zeros((nN), dtype=np.intc)

    c_vbgmm_fit (&xarray[0,0], nN, nD, nK, seed, &assign[0], nThreads)

    return assign

Thank you for your support

alneberg commented 5 years ago

Hi @ldumond, I'm not sure you're still working on this. The error seems to be that the seed variable is not given in the concoct_refine script. Since you have already started modifying the source code you are probably confident enough to just add a number of your choice in the function call, for example:

assigns = vbgmm.fit(np.copy(transform_k,order='C'),int(NK), 11, int(args.threads))

I'll keep this issue open until this is fixed in the develop version.