Undefined columns error in MaAsLin2

I am trying to run MaAsLin2 on my metagenomics data, but have run into the following errors:

  1. Error in [.data.frame(input_df_all, c(x_label, y_label)) : undefined columns selected
  2. 1: In max(nchar(x_axis_labels), na.rm = TRUE) : no non-missing arguments to max; returning -Inf

I have attached my metadata and abundance files. Any ideas what might be going on or how to fix this error?

The code that I am running (R version 3.6.2):

#BiocManager::version() #3.10
library(tidyverse)
library(Maaslin2) 
library(data.table)
library(vegan)
library(broom)
rm(list=ls())
getwd() #lists current working directory
setwd("~/Desktop")
dir.create("R_Maaslin")
setwd("R_Maaslin")
getwd()

data <- "humann_filtered_genefamilies_cpm_gofeatures.tsv"
df_input_data = read_tsv(data)
df_input_data <- df_input_data[-c(11,39),] #removed unknown samples
map <- "maptranspose3.txt"
map <- read_tsv(map)
map <- map[-c(11,39),] #removed unknown samples
fit_data3=Maaslin2(
  input_data = df_input_data,
  input_metadata = map,
  output = "sym_output",
  fixed_effects = c("ph","Sym")
)

humann_filtered_genefamilies_cpm_gofeatures.tsv (1.3 MB) maptranspose3.txt (2.2 KB)

Hi!

This error is often the result of special characters in the feature table (gene families). If you remove those you should have no issues running. Doing something as simple as transposing the dataframe in R without the check.names = F call, will allow you to quickly check if that is the issue.

We are aware of this issue and have added a fix to our list of improvements, but hopefully the above suggestion is a quick fix.

Let me know if you keep experiencing issues!

Best,
Kelsey

Hi Kelsey,

Thanks for you reply. I tried transposing my file, but am unsure what to look for in the output.

Here is the code I ran:
data <- “humann_filtered_genefamilies_cpm_gofeatures.tsv”
df_input_data = read_tsv(data)
specchar <- transpose(df_input_data)

Specchar is listed as a Large list in R with each sample as an element.

Hi!

Can you make the Specchar object a data.frame? So changing the Specchar command to specchar = data.frame(t(df_input_data)). Then you will probably have to flip it back so that the specchar object matches the metadata you are comparing it to.

I hope this helps!

Hi Kelsey,

I will try this out!

I did get things working by replacing all potential special characters with underscores. On to the next issue.

Thanks,
Jack

Hi Jack,

Great! Yes it was definitely an issue with special characters. Apologies if I confused you with my hacky fix. Glad that you were able to find a work around. I have downloaded your above data so that I can look into the issue you are having in your next post.

Best,
Kelsey