Appropriate rownames error (new error with version update)

Hi Jacob -

Thanks for your quick reply!

Both the metadata object and the taxonomic abundance table are read in as a data.frame (I added a few more columns from my actual metadata file for reproducibility and attached here).

metadata_subset.csv (1.1 KB)

Also, the rowNames of both of these data.frames match up. I also tried putting the row.names in the exact same order within both data.frames, but that made no difference (order of the sample.id’s didn’t matter in the previous version I used, but I wanted to double check).


Previously, I had no issues with this first way of importing my data using v. 1.10.1… now Maaslin does not run with this way of importing data and throws this error.

Error in Maaslin2(input_data = df, input_metadata = metadata, output = "fit_data_cplm_none_category", : If supplying input_data as a data frame, it must have appropriate rownames!

# 1. Load metadata ####
> metadata <- read.csv(file = "metadata_subset.csv", sep = ",", header= TRUE)

> str(metadata)
'data.frame':	48 obs. of  4 variables:
 $ sample.id     : chr  "PM01" "PF01" "PM02" "PF02" ...
 $ category_broad: chr  "mites" "feather" "mites" "feather" ...
 $ bird_sex      : chr  "Male" "Male" "Male" "Male" ...
 $ bird_age      : chr  "ASY" "ASY" "ASY" "ASY" ...

> # 2. Load Data ####

> df <- read.csv(file = "OTU_FUNguild_subset.csv", sep = ",", header= TRUE)

> str(df)
'data.frame':	48 obs. of  46 variables:
 $ SampleID                         : chr  "PF01" "PF02" "PF04" "PF05" ...
 $ X6e5c88724ce4ad5457ab9e3e47170818: num  NA 0 0 0 0 NA NA 0 NA NA ...
 $ X2a57bb2d180f703fc42c5c6a09daeb2c: num  NA 0 0 0 0 NA NA 0 NA NA ...
 $ a91aab690b10d15fa4bb3f92f4bcb1bb : num  NA 0 0 0 0 NA NA 0 NA NA ...
[[truncated]]

But then with this way from the tutorial (I’m not sure if this import step was updated since v. 1.10.1), if I load with row.names = 1, stringsAsFactors = FALSE… it starts to run… but then gets stuck on this error:

Error in rownames<-(x, value) : attempt to set 'rownames' on an object with no dimensions

> # 1. Load metadata ####
> metadata <- read.csv(file = "metadata_subset.csv", sep = ",", header= TRUE, row.names = 1, stringsAsFactors = FALSE)

> str(metadata)
'data.frame':	48 obs. of  3 variables:
 $ category_broad: chr  "mites" "feather" "mites" "feather" ...
 $ bird_sex      : chr  "Male" "Male" "Male" "Male" ...
 $ bird_age      : chr  "ASY" "ASY" "ASY" "ASY" ...

> # 2. Load Data ####
> df <- read.csv(file = "OTU_FUNguild_subset.csv", sep = ",", header= TRUE, row.names = 1, stringsAsFactors = FALSE)

> str(df)
'data.frame':	48 obs. of  45 variables:
 $ X6e5c88724ce4ad5457ab9e3e47170818: num  NA 0 0 0 0 NA NA 0 NA NA ...
 $ X2a57bb2d180f703fc42c5c6a09daeb2c: num  NA 0 0 0 0 NA NA 0 NA NA ...
 $ a91aab690b10d15fa4bb3f92f4bcb1bb : num  NA 0 0 0 0 NA NA 0 NA NA ...
[[truncated]]

Any other ideas of what the issue could be? Thank you again!