cozygene / FEAST

Fast expectation maximization for microbial source tracking
Other
115 stars 60 forks source link

'x' must be an array of at least two dimensions #49

Closed AkilaMuthalagu closed 11 months ago

AkilaMuthalagu commented 1 year ago

I am trying to run the code as given in the example, however, the error keeps on popping up "Error in rowSums(C[c(train.ix, test.ix), ]) : 'x' must be an array of at least two dimensions In addition: Warning message: In [<-.factor(*tmp*, source_ids, value = "Source") : invalid factor level, NA generated"

I checked the data dimension using the dim() function, and the output is 5*577

I don't know why the error keeps on coming. can anyone help me to figure it out? The code which I use is below.

metadata1 <- Load_metadata(metadata_path = "D:/Swiss proposal/Office campaign/Results/metadata.txt") otus <- Load_CountMatrix(CountMatrix_path = "D:/Swiss proposal/Office campaign/Results/Stationary1.txt") otus3<- ceiling(otus*1000) dim(otus3)#to check dimension of the dataframe FEAST_output <- FEAST(C = otus3, metadata = metadata1, different_sources_flag = 1, dir_path = "D:/Swiss proposal/Office campaign/Results", outfile="bac2")

I am also attaching my metadata file and sample file metadata.txt bacsoucesink.txt bacsoucesink.txt

liashenhav commented 1 year ago

Hi,

You need to use the option: different_sources_flag = 0 (and not = 1). That solves the problem.

Best, Liat

AkilaMuthalagu commented 11 months ago

That helped. Thanks