minepy / mictools

A practical tool for Maximal Information Coefficient (MIC) analysis
GNU General Public License v3.0
128 stars 23 forks source link

mictools in macOS high sierra - Python 3.7 #10

Closed jimmyherawan closed 4 years ago

jimmyherawan commented 4 years ago

Dear Mr. Davide

I try the datasaurus dataset and it worked perfectly until the end. But when I try to use another dataset from https://data.mendeley.com/datasets/h3cgnj8hft/1, There are problems:

  1. When enter this line command: mictools adjust $ODIR/pval.txt $ODIR the warning shown from numpy, but files pval_adj.txt and pi0_None.png were created. Applications/Anaconda/anaconda3/lib/python3.7/site-packages/numpy/lib/arraysetops.py:569: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison mask |= (ar1 == a)
  2. On the next step when enter this line command: mictools strength $X $ODIR/pval_adj.txt $ODIR/strength.txt File "/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/scripts/mictools_cmd.py", line 265, in strength thr, alpha, clumps) File "/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/mictools/strength.py", line 119, in strength_cmd c=clumps) File "/Applications/Anaconda/anaconda3/lib/python3.7/site-packages/mictools/strength.py", line 84, in compute_strength mine.compute_score(x, y) File "minepy/mine.pyx", line 84, in minepy.mine.MINE.compute_score ValueError: Buffer has wrong number of dimensions (expected 1, got 2) file strenght.txt is empty Screen Shot 2020-05-10 at 9 52 18 PM

Thank you for your help. Jimmy

MichaelMMeskhi commented 4 years ago

Am experiencing the same problem. I tried re-exporting my .csv files into tab delimited files. Yet end up with the same error even though the sample file and my files are identical?

Update 06-19-2020:

I figured out the issue I believe. So my custom data is of type float64, large decimal numbers as entries. I think due to pd.to_csv(delimited='\t'), some rows get overwritten and causing MICtools to include samples as variables. I noticed this as my original data has 59 variable but running MICtools sets X = 179? I tested on a small data set with 4 variables and integer entries and got it working perfectly fine.

Fixed it this way. If your data is in .csv, export it using x.T.to_csv(r'mydata.txt', header=True, index=True, sep='\t', mode='a')

davidealbanese commented 4 years ago

@jimmyherawan, @MichaelMMeskhi, could you share the datasets? I would try to reproduce the error.

MichaelMMeskhi commented 4 years ago

@davidealbanese Here's my original .csv file.

meta_features.csv.zip

jimmyherawan commented 4 years ago

@davidealbanese, thank you for your response Here's my dataset

dataset for MIC.zip

davidealbanese commented 4 years ago

@jimmyherawan, the warning in mictools adjust seems to be related to https://github.com/numpy/numpy/issues/6784 and to the version installed in conda. I suggest to use the mictools docker version instead.

@MichaelMMeskhi, mictools takes TAB-delimited files, not CSVs.

MichaelMMeskhi commented 4 years ago

@davidealbanese I know, I was converting from .csv to tab delimited .txt and was having issues due to that but I fixed it.

jimmyherawan commented 4 years ago

@jimmyherawan, the warning in mictools adjust seems to be related to numpy/numpy#6784 and to the version installed in conda. I suggest to use the mictools docker version instead.

@MichaelMMeskhi, mictools takes TAB-delimited files, not CSVs.

Thank you @davidealbanese, work perfectly using docker