Maaslin3 error message

Hello again,

I am trying to process relative abundance species data which is already TSS normalised, so I selected normalisation = NONE. However, I am getting an error message ‘Error in d[setdiff(unique(metadata[, names(l)]), names(d))] ← NA :
only 0’s may be mixed with negative subscripts’.
When I look in the features folder all of the zeros in my data are converted to N/A. Do you know what is happening here, and how I might work around it?
Many thanks,
Katherine

Hi Katherine,

I’m not sure what’s going on without looking at the log file or a small reproducible example. However, you might check that your inputs are being read as numerics rather than e.g. characters, and if you just turn on TSS it shouldn’t change anything for data that are already TSS.

Will

Hi Will,

I provided the OTU table with raw count as the input. I am getting the same error:

Error in d[setdiff(unique(metadata[, names(l)]), names(d))] ← NA :
only 0’s may be mixed with negative subscripts.

The log is as follows:

2026-02-12 01:44:45.123159 INFO::Writing function arguments to log file
2026-02-12 01:44:45.124721 DEBUG::Function arguments
2026-02-12 01:44:45.12504 DEBUG::Output folder: results/maaslin3/model1_diet_time
2026-02-12 01:44:45.125311 DEBUG::Formula: ~ log_day + diet + (1 | family_id)
2026-02-12 01:44:45.125569 DEBUG::Fixed effects:
2026-02-12 01:44:45.125812 DEBUG::Reference:
2026-02-12 01:44:45.126053 DEBUG::Random effects:
2026-02-12 01:44:45.126291 DEBUG::Group effects:
2026-02-12 01:44:45.126527 DEBUG::Ordered effects:
2026-02-12 01:44:45.126825 DEBUG::Strata effects:
2026-02-12 01:44:45.127052 DEBUG::Min Abundance: 0.002500
2026-02-12 01:44:45.127469 DEBUG::Min Prevalence: 0.050000
2026-02-12 01:44:45.128091 DEBUG::Max Prevalence: 1.010000
2026-02-12 01:44:45.128549 DEBUG::Zero Threshold: 0.000000
2026-02-12 01:44:45.128866 DEBUG::Min variance: 0.000000
2026-02-12 01:44:45.129244 DEBUG::Max significance: 0.100000
2026-02-12 01:44:45.129536 DEBUG::Normalization: TSS
2026-02-12 01:44:45.129821 DEBUG::Transform: LOG
2026-02-12 01:44:45.130088 DEBUG::Correction method: BH
2026-02-12 01:44:45.130329 DEBUG::Standardize: TRUE
2026-02-12 01:44:45.130549 DEBUG::Abundance median comparison: TRUE
2026-02-12 01:44:45.130759 DEBUG::Prevalence median comparison: FALSE
2026-02-12 01:44:45.130988 DEBUG::Abundance median comparison threshold: 0
2026-02-12 01:44:45.131198 DEBUG::Prevalence median comparison threshold: 0
2026-02-12 01:44:45.131438 DEBUG::Subtract median: FALSE
2026-02-12 01:44:45.131657 DEBUG::Warn prevalence: TRUE
2026-02-12 01:44:45.13187 DEBUG::Small random effects: TRUE
2026-02-12 01:44:45.132089 DEBUG::Augment: TRUE
2026-02-12 01:44:45.132312 DEBUG::Evaluate only:
2026-02-12 01:44:45.132519 DEBUG::Cores: 1
2026-02-12 01:44:45.132742 DEBUG::Balanced Summary plot: FALSE
2026-02-12 01:44:45.133016 INFO::Verifying options selected are valid
2026-02-12 01:44:45.133727 WARNING::Input is a matrix,
passing through as.data.frame() .
2026-02-12 01:44:45.135699 INFO::Determining format of input files
2026-02-12 01:44:45.136622 INFO::Input format is data samples as rows and metadata samples as rows
2026-02-12 01:44:45.137569 DEBUG::A total of 128 samples were found in both the data and metadata
2026-02-12 01:44:45.137921 DEBUG::Reordering data/metadata to use same sample ordering
2026-02-12 01:44:45.139178 INFO::Running selected normalization method: TSS
2026-02-12 01:44:45.142808 INFO::Writing normalized data to file results/maaslin3/model1_diet_time/features/data_norm.tsv
2026-02-12 01:44:45.148167 INFO::Filter data based on min abundance, min prevalence, and max prevalence
2026-02-12 01:44:45.148903 INFO::Total samples in data: 128
2026-02-12 01:44:45.149429 INFO::Min samples required with min abundance for a feature not to be filtered: 6.400000
2026-02-12 01:44:45.1499 INFO::Max samples allowed with min abundance for a feature not to be filtered: 129.280000
2026-02-12 01:44:45.209411 INFO::Total filtered features: 125
2026-02-12 01:44:45.2103 INFO::Filtered feature names from abundance, min prevalence, and max prevalence filtering: g__Acidaminococcus, g__Actinomyces, g__Adlercreutzia, g__Alistipes, g__Allisonella, g__Alloprevotella, g__Anaeroplasma, g__Anaerovibrio, g__Asteroleplasma, g__Atopobium, g__Bacteroidales_RF16_group, g__Barnesiella, g__Bilophila, g__Bradyrhizobium, g__Butyricimonas, g__Butyrivibrio, g__CAG_352, g__CAG_873, g__Candidatus_Stoquefichus, g__Catenibacterium, g__Catenisphaera, g__Christensenellaceae_R_7_group, g__Clostridia_UCG_014, g__Clostridia_vadinBB60_group, g__Colidextribacter, g__Coprobacter, g__Coprococcus, g__Coriobacteriaceae_UCG_002, g__Corynebacterium, g__Cutibacterium, g__Defluviitaleaceae_UCG_011, g__Desulfovibrio, g__Dialister, g__Dolosigranulum, g__Dorea, g__Eggerthella, g__Eisenbergiella, g__Elusimicrobium, g__Enterorhabdus, g__Erysipelotrichaceae_UCG_003, g__Eubacterium, g__Ezakiella, g__Faecalibaculum, g__Faecalitalea, g__Family_XIII_AD3011_group, g__Family_XIII_UCG_001, g__Fournierella, g__Frisingicoccus, g__Fusobacterium, g__Gastranaerophilales, g__Gemella, g__Gordonibacter, g__Halomonas, g__Holdemanella, g__Holdemania, g__Howardella, g__Hungatella, g__Incertae_Sedis, g__Lachnospiraceae, g__Lachnospiraceae_FCS020_group, g__Lachnospiraceae_NK3A20_group, g__Lachnospiraceae_UCG_001, g__Lachnospiraceae_UCG_003, g__Lachnospiraceae_UCG_004, g__Lactococcus, g__Mailhella, g__Marvinbryantia, g__Megamonas, g__Megasphaera, g__Merdibacter, g__Methanosphaera, g__Mitsuokella, g__Mogibacterium, g__Monoglobus, g__Muribaculaceae, g__NK4A214_group, g__Negativibacillus, g__Neisseria, g__Odoribacter, g__Olsenella, g__Oribacterium, g__Oscillibacter, g__Oxalobacter, g__Paraprevotella, g__Parasutterella, g__Peptococcus, g__Peptoniphilus, g__Phascolarctobacterium, g__Prevotella, g__Prevotellaceae_NK3B31_group, g__Prevotellaceae_UCG_003, g__RF39, g__Rikenellaceae_RC9_gut_group, g__Rothia, g__Ruminiclostridium, g__Sellimonas, g__Senegalimassilia, g__Shuttleworthia, g__Slackia, g__Solobacterium, g__Succinivibrio, g__Terrisporobacter, g__Treponema, g__Turicibacter, g__UBA1819, g__UCG_002, g__UCG_003, g__UCG_004, g__UCG_005, g__UCG_009, g__UCG_010, g__Varibaculum, g__Victivallaceae, g__Weissella, g__Z20, g__Bacteroides_pectinophilus_group, g__Eubacterium_brachy_group, g__Eubacterium_coprostanoligenes_group, g__Eubacterium_eligens_group, g__Eubacterium_ruminantium_group, g__Eubacterium_siraeum_group, g__Eubacterium_ventriosum_group, g__Eubacterium_xylanophilum_group, g__Ruminococcus_gauvreauii_group, g__vadinBE97
2026-02-12 01:44:45.211535 INFO::Total features filtered by non-zero variance filtering: 0
2026-02-12 01:44:45.212192 INFO::Filtered feature names from variance filtering:
2026-02-12 01:44:45.212645 INFO::Writing filtered data to file results/maaslin3/model1_diet_time/features/filtered_data.tsv
2026-02-12 01:44:45.214871 INFO::Running selected transform method: LOG
2026-02-12 01:44:45.215851 INFO::Writing normalized, filtered, transformed data to file results/maaslin3/model1_diet_time/features/data_transformed.tsv
2026-02-12 01:44:45.218049 INFO::Factor detected for categorial metadata ‘diet’. Using as-is.
2026-02-12 01:44:45.218596 INFO::Applying z-score to standardize continuous metadata
2026-02-12 01:44:45.222082 INFO::Running the linear model component
2026-02-12 01:44:45.223837 DEBUG::Object: augment, Size: 56
2026-02-12 01:44:45.224081 DEBUG::Object: cluster, Size: 0
2026-02-12 01:44:45.224249 DEBUG::Object: cores, Size: 56
2026-02-12 01:44:45.224432 DEBUG::Object: correction, Size: 112
2026-02-12 01:44:45.224593 DEBUG::Object: extract_out, Size: 2144
2026-02-12 01:44:45.224756 DEBUG::Object: feature_specific_covariate, Size: 0
2026-02-12 01:44:45.224915 DEBUG::Object: feature_specific_covariate_name, Size: 0
2026-02-12 01:44:45.225092 DEBUG::Object: feature_specific_covariate_record, Size: 0
2026-02-12 01:44:45.225281 DEBUG::Object: features, Size: 50000
2026-02-12 01:44:45.225433 DEBUG::Object: formula, Size: 1736
2026-02-12 01:44:45.225623 DEBUG::Object: fun_list, Size: 124640
2026-02-12 01:44:45.225839 DEBUG::Object: func_to_run, Size: 435336
2026-02-12 01:44:45.225988 DEBUG::Object: groups, Size: 48
2026-02-12 01:44:45.226137 DEBUG::Object: median_comparison, Size: 56
2026-02-12 01:44:45.226297 DEBUG::Object: median_comparison_threshold, Size: 56
2026-02-12 01:44:45.226462 DEBUG::Object: metadata, Size: 17120
2026-02-12 01:44:45.226617 DEBUG::Object: model, Size: 112
2026-02-12 01:44:45.226774 DEBUG::Object: model_function, Size: 71464
2026-02-12 01:44:45.226916 DEBUG::Object: ordereds, Size: 48
2026-02-12 01:44:45.227063 DEBUG::Object: random_effects_formula, Size: 1736
2026-02-12 01:44:45.22722 DEBUG::Object: ranef_function, Size: 1240
2026-02-12 01:44:45.227368 DEBUG::Object: save_models, Size: 56
2026-02-12 01:44:45.22763 DEBUG::Object: small_random_effects, Size: 56
2026-02-12 01:44:45.227796 DEBUG::Object: strata, Size: 48
2026-02-12 01:44:45.227941 DEBUG::Object: subtract_median, Size: 56
2026-02-12 01:44:45.228106 DEBUG::Object: summary_function, Size: 51456
2026-02-12 01:44:45.228306 DEBUG::Object: func_to_run, Size: 435336
2026-02-12 01:44:45.228675 INFO::Fitting model to feature number 1, g__Akkermansia
2026-02-12 01:44:45.313186 WARNING::Fitting problem for feature 1 a warning was issued

Could you please let me know how to run this correctly?

Thank you in advance!

Aritra

It looks like something is off in the metadata. Are you sure family_id has been converted to a factor variable beforehand? If you’ve already done that, can you post here or email me (willnickols@g.harvard.edu) a sample of the metadata and OTU table that reproduces the problem?

Will

Thank Will for your quick reply. I found that there was an issue in the sample naming convention (started with numbers). It’s working now.

Another thing, this is running fine for formula = “~ log_day * diet” but not for formula = “~ log_day * diet + (1|family_id)”. For the 2nd case, I need put them as fixed_effects, random_effects.

Regards,
Aritra

Glad the first issue got sorted out. For the second, were you able to get it working that way or is it still causing issues? If it still has issues can you send the log?