ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
181 stars 55 forks source link

Issue with dimnames(x) <- dn #325

Closed UsernameUrie closed 4 months ago

UsernameUrie commented 4 months ago

Hello,

I am trying to use Tax4Fun but I have an issue with the function : t1$cal_tax4fun(folderReferenceData = "./SILVA123")

I get an error :

Error in dimnames(x) <- dn : 
  the length of 'dimnames' [1] is not equal to the range of the array

I tried to check the dimensions of my tables and they appeared coherent as well as my column titles and length. I do not understand the issu, specially as I used the same script on similar data in another project without problems.

Could you help me ?

Here's the script :

SampTest3 <- read.csv2("SampTest3-Copie.csv", row.names = 1) 

ff=read.csv2("TableTest-Copie.csv", row.names = 1)

fff <- ff %>% as.data.frame(.)

  Taxo=fff[,c(1:7)]   
  Taxo%<>%tidy_taxonomy() 

  ASV=fff[,c(8:18)]
  ASV=as.data.frame(ASV)

  SAMP1= (SampTest3)

  dataset <- microtable$new(sample_table = SAMP1,
                            otu_table = ASV,
                            tax_table = Taxo)

  dataset$tidy_dataset()

  t1 <- trans_func$new(dataset)

  t1$cal_tax4fun(folderReferenceData = "./SILVA123")

my data look like : SampTest3-Copie :

    Sample  Stage
nii1    nii1    nii
nii2    nii2    nii
nii3    nii3    nii
nii4    nii4    nii
nii5    nii5    nii
Noo1    Noo1    Noo
Noo2    Noo2    Noo
Noo3    Noo3    Noo
Noo4    Noo4    Noo
Noo5    Noo5    Noo
Noo6    Noo6    Noo

with my asv and taxo table, TableTest-Copie.csv :

ASV Kingdom Phylum  Class   Order   Family  Genus   Species nii1    nii2    nii3    nii4    nii5    Noo1    Noo2    Noo3    Noo4    Noo5    Noo6
ASV1025 Bacteria    Bacteroidota    Bacteroidia Flavobacteriales    Cryomorphaceae  Owenweeksia ASV1025 8   0   29  0   8   0   3   20  66  37  13
ASV1036 Bacteria    Proteobacteria  Alphaproteobacteria Caulobacterales Parvularculaceae    Parvularcula    ASV1036 4   0   17  16  0   0   0   18  3   0   19
ASV1045 Bacteria    Deinococcota    Deinococci  Deinococcales   Trueperaceae    Truepera    ASV1045 0   12  0   3   0   5   0   0   0   0   0
ASV1073 Bacteria    Proteobacteria  Alphaproteobacteria Rhizobiales Stappiaceae Labrenzia   ASV1073 0   0   0   0   0   0   0   0   0   0   0
ASV1074 Bacteria    Fusobacteriota  Fusobacteriia   Fusobacteriales Fusobacteriaceae    Propionigenium  ASV1074 70  46  8   21  0   0   0   0   0   0   0
ASV1084 Bacteria    Proteobacteria  Alphaproteobacteria Rhodobacterales Rhodobacteraceae    Limimaricola    ASV1084 0   0   0   0   54  0   0   0   0   0   30
ASV1090 Bacteria    Chloroflexi Anaerolineae    SBR1031 A4b ASV1090 ASV1090 0   0   0   0   0   0   0   0   0   0   0
ASV1098 Bacteria    Proteobacteria  Gammaproteobacteria Salinisphaerales    Algiphilaceae   Algiphilus  ASV1098 0   0   12  36  12  9   8   17  0   0   0
ASV1107 Bacteria    Proteobacteria  Alphaproteobacteria Caulobacterales Hyphomonadaceae Hyphomonas  ASV1107 0   14  12  18  0   6   0   0   0   26  0
ASV1118 Bacteria    Actinobacteriota    Actinobacteria  Corynebacteriales   Corynebacteriaceae  Corynebacterium ASV1118 0   0   0   0   0   0   0   0   0   0   0

thanks for your time and help.

ChiLiubio commented 4 months ago

Hi. Could you please attach your dataset object so that I can reproduce your issue? To save the dataset, please follow the steps in the tutorial (https://chiliubio.github.io/microeco_tutorial/notes.html#save-function) and attach the compressed object.

UsernameUrie commented 4 months ago

Hello here's both dataset object and t1 used for the cal_tax4fun RDataObjects.zip

Thank you

ChiLiubio commented 4 months ago

Hi. This issue comes from no matched ASV/OTU against the reference database. It generally happens when the number of features is low or the taxonomy assignment is not precise. Please switch to other method, e.g. tax4fun2 or picrust2.

UsernameUrie commented 4 months ago

Thank you, I will try !