Adonis not recognizing metadata columns in formula


(Rhmills) #1

Hello,

While attempting to perform an adonis using qiime2-2019.1, I have not been able to successfully run the command.

The error relates to not detecting the metadata column specified in the formula. After attempting multiple formulas and metadata columns that I’ve verified are in the metadata file, I am hoping to hear from you all about what might be the next steps in troubleshooting.

The formula I used is here:

qiime diversity adonis \
  --i-distance-matrix core-metrics-results_LMDistanceFiltered/unweighted_unifrac_distance_matrix.qza \
  --m-metadata-file ./10933_prep_3336_qiime_20170619-140801.txt \
  --p-formula 'conditions' \
  --o-visualization core-metrics-results_LMDistanceFiltered/unweighted-unifrac-adonisconditions-significance.qzv

The error I’m finding is here:

Running external command line application. This may print messages to stdout and/or stderr.

The command being run is below. This command cannot be manually re-run as it will depend on temporary files that no longer exist.

Command: run_adonis.R /var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/tmp1ta5sdx8/dm.tsv /var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/tmp1ta5sdx8/md.tsv conditions 999 1 /var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/qiime2-temp-_hlr1at_/adonis.tsv

R version 3.4.1 (2017-06-30) 

Loading required package: permute

Loading required package: lattice

This is vegan 2.5-3

Error in eval(predvars, data, env) : object 'conditions' not found

Calls: adonis -> model.frame -> model.frame.default -> eval -> eval

Execution halted

Traceback (most recent call last):

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2cli/commands.py", line 274, in __call__

results = action(**arguments)

File "</Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/decorator.py:decorator-gen-417>", line 2, in adonis

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/action.py", line 231, in bound_callable

output_types, provenance)

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/action.py", line 427, in _callable_executor_

ret_val = self._callable(output_dir=temp_dir, **view_args)

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_diversity/_beta/_visualizer.py", line 365, in adonis

_run_command(cmd)

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_diversity/_beta/_visualizer.py", line 391, in _run_command

subprocess.run(cmd, check=True)

File "/Users/rhmills/miniconda3/envs/qiime2-2019.1/lib/python3.6/subprocess.py", line 418, in run

output=stdout, stderr=stderr)

subprocess.CalledProcessError: Command '['run_adonis.R', '/var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/tmp1ta5sdx8/dm.tsv', '/var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/tmp1ta5sdx8/md.tsv', 'conditions', '999', '1', '/var/folders/wh/jp3wkyrj5jsfjt9x_s07y21c0000gn/T/qiime2-temp-_hlr1at_/adonis.tsv']' returned non-zero exit status 1.

**Please let me know what I might try next.

Thanks,
Robert Mills**


(Matthew Ryan Dillon) #2

Hi there @rhmills! Do you have a metadata column called conditions? Can you run the following and provide the output here?

qiime tools inspect-metadata ./10933_prep_3336_qiime_20170619-140801.txt

Thanks!


(Rhmills) #3

Hello,

I’ve run the command, and yes I have the column conditions:


                  COLUMN NAME  TYPE       
=============================  ===========
              BarcodeSequence  categorical
         LinkerPrimerSequence  categorical
                  center_name  categorical
experiment_design_description  categorical
             extraction_robot  categorical
            extractionkit_lot  numeric    
             instrument_model  categorical
library_construction_protocol  categorical
                       linker  categorical
                mastermix_lot  numeric    
                    orig_name  categorical
                  pcr_primers  categorical
                     platform  categorical
                      plating  categorical
                  primer_date  numeric    
                 primer_plate  numeric    
             processing_robot  categorical
                 project_name  categorical
                   run_center  categorical
                     run_date  categorical
                   run_prefix  categorical
                 sample_plate  categorical
              sequencing_meth  categorical
                  target_gene  categorical
           target_subfragment  categorical
                tm1000_8_tool  categorical
                 tm300_8_tool  categorical
                  tm50_8_tool  categorical
                    water_lot  categorical
             well_description  categorical
                      well_id  categorical
                qiita_prep_id  numeric    
                     age_days  categorical
                    age_units  categorical
              anonymized_name  categorical
                 body_habitat  categorical
                 body_product  categorical
                    body_site  categorical
          brain_sample_volume  categorical
                  cage_number  categorical
        cage_number_reference  categorical
         collection_timestamp  categorical
    collection_timestamp_edit  categorical
                   conditions  categorical
                dna_extracted  categorical
                    elevation  numeric    
                    env_biome  categorical
                  env_feature  categorical
                 env_material  categorical
                  env_package  categorical
                 geo_loc_name  categorical
         host_scientific_name  categorical
              host_subject_id  categorical
                   host_taxid  categorical
                     latitude  numeric    
                   life_stage  categorical
                    longitude  numeric    
   physical_specimen_location  categorical
  physical_specimen_remaining  categorical
                       public  categorical
               qiita_study_id  numeric    
                  sample_type  categorical
                sample_weight  categorical
              scientific_name  categorical
                          sex  categorical
              subject_id_fair  categorical
                     taxon_id  numeric    
                        title  categorical
                    LM_CENTER  categorical
            LM_Total_Distance  categorical
                   TIME_LIGHT  categorical
                     wave_age  categorical
                  Description  categorical
                    state_lme  numeric    
                       ROI_23  categorical
                      ROI_243  categorical
                      ROI_254  categorical
=============================  ===========
                         IDS:  96
                     COLUMNS:  77

Thanks,
Robert


(Matthew Ryan Dillon) #8

Thanks @rhmills! The problem appears to be that adonis is tripping when attempting to load up this metadata column. I had a look through the q2-diversity code implicated here and can’t come up with a good explanation. Would you be willing to share your files with me, so that I can re-run this exact command? If so, feel free to DM me a download link. Thanks!


(Matthew Ryan Dillon) #9

Thanks for the data @rhmills! I pulled everything down and confirmed that I can reproduce the error you reported above. I will take a look at this as soon as I get a chance - thanks!


(Matthew Ryan Dillon) assigned thermokarst #10

(Matthew Ryan Dillon) #11

Ah ha! You found a bug (:bug:), @rhmills! Turns out that we weren’t handling the special case of #SampleID in the R code calling adonis — this was causing your header row to be ignored as a comment line. I have opened a PR to fix this issue. In the meantime, update your #SampleID label to something like sample-id or id, and re-run! :tada:


(Matthew Ryan Dillon) unassigned thermokarst #12

(Rhmills) #13

That worked, thank you!