Troubles with xtfrm.data.frame

Hello!

I am trying to run maaslin3 with my data and I have found this error:

Error in xtfrm.data.frame(x): 
  It is not possible to apply xtfrm to a data frame

This is the code that I am trying to run:

fit_out ← maaslin3(input_data = wmotu_df,
input_metadata = wmmeta_df,
output = ‘watmag_output’,
formula = ‘~ SST + Ecological_zone +
Year’,
normalization = ‘TSS’,
transform = ‘LOG’,
augment = TRUE,
standardize = TRUE,
max_significance = 0.1,
median_comparison_abundance = TRUE,
median_comparison_prevalence = FALSE,
max_pngs = 250,
cores = 1)

This is a glimpse of my starting files:

wmotu_df[1:5,1:5];
       ASV1:g__Clade Ia ASV2:g__Amylibacter ASV3:g__Sulfitobacter
AG_100       0.26603125          0.01934375            0.04462500
AG_101       0.15906250          0.03893750            0.03446875
AG_102       0.06403125          0.06275000            0.18528125
AG_103       0.17775000          0.06340625            0.01593750
AG_105       0.19678125          0.02240625            0.02968750
       ASV4:g__Synechococcus CC9902 ASV5:g__Planktomarina
AG_100                   0.04156250            0.00990625
AG_101                   0.04409375            0.04300000
AG_102                   0.01028125            0.02275000
AG_103                   0.04725000            0.03018750
AG_105                   0.03165625            0.01296875
> wmmeta_df[1:5,1:5]
Sample Data:        [5 samples by 5 sample variables]:
       Ecological_zone Year Sample_type    Eco_year      Eco_region
AG_100  Beagle_channel 2024       Water Beagle_2024 Magellan_strait
AG_101  Beagle_channel 2024       Water Beagle_2024 Magellan_strait
AG_102  Beagle_channel 2024       Water Beagle_2024 Magellan_strait
AG_103  Beagle_channel 2024       Water Beagle_2024 Magellan_strait
AG_105            AMCP 2024       Water   AMCP_2024 Magellan_strait

Thanks in advance for your time and help, it is deeply appreciated

Hi,

Can you post the code above the maaslin3 call in your script? I think this can happen if the datasets are imported in a particular way, though I haven’t seen it in a while.

Will

Hello Will!

I obtained the objects in this way:

watmag2 ← add_refseq(watmag, tag = “ASV”)

watmag2 ← format_to_besthit(watmag2)

watmag_genus ← tax_glom(watmag2, taxrank = “Genus”)

wmotu_df ← as.data.frame(otu_table(watmag_genus))
wmmeta_df ← as.data.frame(sample_data(watmag_genus))

After reading your reply I checked and I realize this mistake:

wmmeta_df ← as.data.frame(sample_data(watmag_genus)) does not retrieve a dataframe, so I ensure that I got a data frame and maaslin3 run. I did it in this way:

wmmeta_df ← data.frame(sample_data(watmag_genus))

class(wmmeta_df)

> class(wmmeta_df)
[1] "data.frame"

However, after it finalized, I explored the object and it appears that lacks some features, like the files with the results, tsv and pdf files (I attach a screenshot from the available contents of the fit_out object)

Could you help to realize what is missing to correctly conduct the test?

I deeply appreaciate your help, thanks a lot Will!

Glad to hear data.frame worked - that’s what I was going to suggest based on the historical threads.

Are you saying there’s nothing in fit_out$results now? Can you post the logging output of the maaslin3 command running?

Hello Will!

Exactly, there is no fit_out$results file. Actually the only options available from the fit_out object are:

fit_out$data, fit_out$normalized_data, fit_out$filtered_data, fit_out$transformed_data, fit_out$metadata, fit_out$standarized_metadata, fit_out$formula, fit_out$fit_data_abundance, fit_out$fit_data_prevalence. Also there is no log file from the command maaslin3, it did not produce any folder in my working directory.

Did something print in the console or terminal though when you ran it?

Yes, it is actually a huge message, with several lines.

It starts with this:

2026-06-01 11:26:29.92 INFO::Writing function arguments to log file
2026-06-01 11:26:29.95 INFO::Verifying options selected are valid
2026-06-01 11:26:29.96 INFO::Determining format of input files
2026-06-01 11:26:29.96 INFO::Input format is data samples as rows and metadata samples as rows
2026-06-01 11:26:29.97 INFO::Running selected normalization method: TSS
2026-06-01 11:26:30.00 INFO::Writing normalized data to file watmag_output/features/data_norm.tsv
2026-06-01 11:26:30.09 INFO::Filter data based on min abundance, min prevalence, and max prevalence
2026-06-01 11:26:30.09 INFO::Total samples in data: 47
2026-06-01 11:26:30.09 INFO::Min samples required with min abundance for a feature not to be filtered: 0.000000
2026-06-01 11:26:30.09 INFO::Max samples allowed with min abundance for a feature not to be filtered: 47.470000
2026-06-01 11:26:30.16 INFO::Total filtered features: 93
2026-06-01 11:26:30.22 INFO::Running selected transform method: LOG
2026-06-01 11:26:30.22 INFO::Writing normalized, filtered, transformed data to file watmag_output/features/data_transformed.tsv
2026-06-01 11:26:30.27 INFO::Applying z-score to standardize continuous metadata
2026-06-01 11:26:30.27 INFO::Running the linear model component

“2026-06-01 11:26:32.79 INFO::Fitting model to feature number 230, ASV812:g__Candidatus Hepatincola”

After some fitting model messages, appear this:

026-06-01 11:26:32.88 INFO::Performing tests against medians
2026-06-01 11:26:37.81 INFO::Counting total values for each feature
2026-06-01 11:26:37.85 INFO::Running the logistic model component

Then, again after more fitting messages appear this:

2026-06-01 11:26:40.55 INFO::Counting total values for each feature
2026-06-01 11:26:40.58 INFO::Re-running abundances for warn_prevalence
2026-06-01 11:26:40.58 INFO::Running selected normalization method: TSS
2026-06-01 11:26:40.60 INFO::Running selected transform method: LOG

Others like this:

“2026-06-01 11:26:32.80 WARNING::Fitting problem for feature 230 returning NA”

After several fitting messages it apparently starts to create the results:

2026-06-01 11:26:42.74 WARNING::Deleting existing residuals file: watmag_output/fits/residuals_linear.rds
2026-06-01 11:26:42.74 INFO::Writing residuals to file watmag_output/fits/residuals_linear.rds
2026-06-01 11:26:42.74 WARNING::Deleting existing fitted file: watmag_output/fits/fitted_linear.rds
2026-06-01 11:26:42.75 INFO::Writing fitted values to file watmag_output/fits/fitted_linear.rds
2026-06-01 11:26:42.75 WARNING::Deleting existing residuals file: watmag_output/fits/residuals_logistic.rds
2026-06-01 11:26:42.76 INFO::Writing residuals to file watmag_output/fits/residuals_logistic.rds
2026-06-01 11:26:42.77 WARNING::Deleting existing fitted file: watmag_output/fits/fitted_logistic.rds
2026-06-01 11:26:42.77 INFO::Writing fitted values to file watmag_output/fits/fitted_logistic.rds
2026-06-01 11:26:42.79 INFO::Writing all the results to file (ordered 
            by increasing individual q-values): watmag_output/all_results.tsv
2026-06-01 11:26:42.85 INFO::Writing the significant results without errors (those which have joint q-values less than or equal to the threshold of 0.100000 ) to file (ordered by increasing individual q-values): watmag_output/significant_results.tsv
2026-06-01 11:26:42.87 INFO::Writing summary plot of significant
                        results to file: watmag_output/figures/summary_plot.pdf
2026-06-01 11:26:46.56 INFO::Writing association plots (one for each significant association) to output folder: watmag_output/figures
2026-06-01 11:26:46.56 INFO::Plotting associations from most to least significant, grouped by metadata
2026-06-01 11:26:46.63 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV13:g__Pseudoalteromonas
2026-06-01 11:26:47.07 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV136:sabulinigri
2026-06-01 11:26:47.53 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV377:f__PS1 clade
2026-06-01 11:26:48.03 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV82:venustensis
2026-06-01 11:26:48.49 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV181:g__Paraglaciecola
2026-06-01 11:26:48.95 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV33:f__Nitrincolaceae
2026-06-01 11:26:49.42 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV87:g__LS-NOB
2026-06-01 11:26:49.96 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV174:g__Magnetospira
2026-06-01 11:26:50.48 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV95:g__Pelagicoccus
2026-06-01 11:26:51.61 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV133:f__Gimesiaceae
2026-06-01 11:26:52.14 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV287:g__CSP1-2
2026-06-01 11:26:52.66 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV374:g__FS140-16B-02 marine group
2026-06-01 11:26:53.13 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV376:g__Colwellia
2026-06-01 11:26:53.59 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV73:g__Candidatus Nitrosoarchaeum
2026-06-01 11:26:54.15 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV87:g__LS-NOB
2026-06-01 11:26:54.61 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV464:f__Methylophagaceae
2026-06-01 11:26:55.11 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV10:g__NS5 marine group
2026-06-01 11:26:55.61 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV154:g__Nitrosomonas
2026-06-01 11:26:56.12 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV4:g__Synechococcus CC9902
2026-06-01 11:26:56.61 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV405:g__Litorivicinus
2026-06-01 11:26:57.08 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV46:nivimaris
2026-06-01 11:26:57.58 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV19:g__Flavicella
2026-06-01 11:26:58.04 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV82:venustensis
2026-06-01 11:26:58.49 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV107:g__SCGC AAA164-E04
2026-06-01 11:26:59.05 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV67:g__IS-44
2026-06-01 11:26:59.48 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV154:g__Nitrosomonas
2026-06-01 11:26:59.97 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV232:g__Luminiphilus
2026-06-01 11:27:00.45 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV176:g__Nitrospina
2026-06-01 11:27:00.95 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV123:f__KI89A clade
2026-06-01 11:27:01.46 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV424:f__Arenicellaceae
2026-06-01 11:27:02.00 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV73:g__Candidatus Nitrosoarchaeum
2026-06-01 11:27:02.47 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV114:f__Paracoccaceae
2026-06-01 11:27:02.97 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV383:marina
2026-06-01 11:27:03.48 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV189:f__NS7 marine group
2026-06-01 11:27:04.07 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV396:f__Bacteriovoracaceae
2026-06-01 11:27:04.60 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV374:g__FS140-16B-02 marine group
2026-06-01 11:27:05.20 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV424:f__Arenicellaceae
2026-06-01 11:27:05.75 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV159:g__Planktotalea
2026-06-01 11:27:06.26 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV377:f__PS1 clade
2026-06-01 11:27:06.78 INFO::Creating tile plot for categorical data (logistic), Year vs ASV424:f__Arenicellaceae
2026-06-01 11:27:07.26 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV118:g__OM75 clade
2026-06-01 11:27:07.78 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV355:g__Polaromonas
2026-06-01 11:27:08.33 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV4:g__Synechococcus CC9902
2026-06-01 11:27:08.82 INFO::Creating tile plot for categorical data (logistic), Year vs ASV309:f__Micavibrionaceae
2026-06-01 11:27:09.32 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV72:g__Paracoccus
2026-06-01 11:27:09.87 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV161:nonamiensis
2026-06-01 11:27:10.33 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV108:f__Parvibaculaceae
2026-06-01 11:27:10.88 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV27:atlanticus
2026-06-01 11:27:11.49 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV276:g__Thalassotalea
2026-06-01 11:27:12.06 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV287:g__CSP1-2
2026-06-01 11:27:12.55 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV343:g__Profundibacterium
2026-06-01 11:27:13.04 INFO::Creating tile plot for categorical data (logistic), Year vs ASV343:g__Profundibacterium
2026-06-01 11:27:13.53 INFO::Creating boxplot for continuous data (logistic), SST vs ASV579:faeni
2026-06-01 11:27:14.15 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV675:f__Rickettsiaceae
2026-06-01 11:27:14.66 INFO::Creating boxplot for continuous data (logistic), SST vs ASV72:g__Paracoccus
2026-06-01 11:27:15.23 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV546:g__Aureispira
2026-06-01 11:27:15.69 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV133:f__Gimesiaceae
2026-06-01 11:27:16.18 INFO::Creating box plot for categorical data (linear), 
                        Year vs ASV276:g__Thalassotalea
2026-06-01 11:27:16.67 INFO::Creating tile plot for categorical data (logistic), Year vs ASV72:g__Paracoccus
2026-06-01 11:27:17.14 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV737:g__Francisella
2026-06-01 11:27:17.62 INFO::Creating tile plot for categorical data (logistic), Year vs ASV446:f__Stappiaceae
2026-06-01 11:27:18.08 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV176:g__Nitrospina
2026-06-01 11:27:18.58 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV355:g__Polaromonas
2026-06-01 11:27:19.10 INFO::Creating scatter plot for continuous 
                        data (linear), SST vs ASV549:f__Rubritaleaceae
2026-06-01 11:27:19.59 INFO::Creating box plot for categorical data (linear), 
                        Ecological_zone vs ASV628:g__Endozoicomonas
2026-06-01 11:27:20.07 INFO::Creating tile plot for categorical data (logistic), Ecological_zone vs ASV292:g__Zhongshania

However, in the output there is no results/significant file.

Hmm, the logging seems normal, so that’s odd that it neither returns the right object nor writes the results. If you run the tutorial code do you get the outputs in the returned object? If that works properly, is there an anonymized chunk of the data you can send me (willnickols@g.harvard.edu) that will reproduce the problem so I can run it on my side and investigate?