picrust / picrust2

Code, unit tests, and tutorials for running PICRUSt2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytest fails 1 test on test_place_seqs.py

mavino opened this issue · comments

pytest                                                                                                                                 
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.4.0                                                                                                                                                        
rootdir: /home/mariano/Downloads/picrust2-2.5.2                                                                                                                                                                    
plugins: cov-4.1.0                                                                                                                                                                                                 
collected 61 items                                                                                                                                                                                                 
                                                                                                                                                                                                                   
tests/test_hsp.py ........                                                                                                                                                                                  [ 13%] 
tests/test_metagenome_pipeline.py ...............                                                                                                                                                           [ 37%] 
tests/test_pathway_pipeline.py ....                                                                                                                                                                         [ 44%] 
tests/test_place_seqs.py ........F                                                                                                                                                                          [ 59%] 
tests/test_util.py ....................                                                                                                                                                                     [ 91%] 
tests/test_workflow.py .....                                                                                                                                                                                [100%] 
                                                                                                                                                                                                                   
==================================================================================================== FAILURES =====================================================================================================
_______________________________________________________________________________ place_seqs_tests.test_run_place_seqs_pipeline_sepp ________________________________________________________________________________
                                                                                                                                                                                                                   
self = <tests.test_place_seqs.place_seqs_tests testMethod=test_run_place_seqs_pipeline_sepp>                                                                                                                       
                                                                                                                                                                                                                   
    def test_run_place_seqs_pipeline_sepp(self):                                                                                                                                                                   
        '''Basic test of full place seqs pipeline with SEPP. Just run to                                                                                                                                           
           see if any errors occur'''                                                                                                                                                                              
        with TemporaryDirectory() as temp_dir:                                                                                                                                                                     
            tmp_tree = path.join(temp_dir, "out.tre")                                                                                                                                                              
                                                                                                                                                                                                                   
>           place_seqs_pipeline(study_fasta=test_study_seqs,                                                                                                                                                       
                                ref_dir=default_ref_dir,                                                                                                                                                           
                                placement_tool="sepp",                                                                                                                                                             
                                out_tree=tmp_tree,                                                                                                                                                                 
                                threads=1,
                                out_dir=temp_dir,
                                min_align=0.8,
                                chunk_size=5000,
                                verbose=True)

tests/test_place_seqs.py:160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
picrust2/place_seqs.py:95: in place_seqs_pipeline
    run_sepp(tree=tree,
picrust2/place_seqs.py:458: in run_sepp
    system_call_check(sepp_command, print_command=print_cmds,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmd = ['run_sepp.py', '--tree', '/home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.t..., '/home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.raxml_info', '--cpu', ...]
print_command = True, print_stdout = True, print_stderr = True

    def system_call_check(cmd, print_command=False, print_stdout=False,
                          print_stderr=False):
        '''Run system command and throw and error if return is not 0. Input command
        can be a list containing the command or a string.'''
    
        # Convert command to list if input as string.
        if type(cmd) is str:
            cmd = cmd.split()
    
        # Print command out if option set.
        if print_command:
            print(" ".join(cmd), file=sys.stderr)
    
        stdout_log = ""
        stderr_log = ""
    
        # Write stdout and stderr of command to temporary files.
        # Only output the content of these files if the job fails.
        with TemporaryDirectory() as temp_dir:
    
            stdout_file = join(temp_dir, "stdout.txt")
            stderr_file = join(temp_dir, "stderr.txt")
    
            with open(stdout_file, "wb") as stdout_fh, \
                 open(stderr_file, "wb") as stderr_fh:
    
                return_value = call(cmd, stdout=stdout_fh,
                                    stderr=stderr_fh)
    
            # Capture stdout and stderr.
            with open(stdout_file, 'r') as stdout_fh:
                stdout_log = stdout_fh.read()
    
            with open(stderr_file, 'r') as stderr_fh:
                stderr_log = stderr_fh.read()
    
            # Exit with error if command did not finish successfully.
            if return_value != 0:
                print("\nError running this command:\n" + " ".join(cmd),
                      file=sys.stderr)
    
                if stdout_log:
                    print("\nStandard output of the above failed command:\n" +
                          stdout_log, file=sys.stderr)
    
                if stderr_log:
                    print("\nStandard error of the above failed command:\n" +
                          stderr_log, file=sys.stderr)
    
>               sys.exit(1)
E               SystemExit: 1

picrust2/util.py:258: SystemExit
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
hmmalign --trim --dna --mapali /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.fna --informat FASTA -o /tmp/tmptadj0m7j/query_align.stockholm /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.hmm /home/mariano/Downloads/picrust2-2.5.2/tests/test_data/place_seqs/study_seqs_test.fasta

All raw input sequences were the same length (400)

run_sepp.py --tree /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.tre --raxml /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.raxml_info --cpu 1 --molecule dna --outdir /tmp/tmptadj0m7j/sepp_out -seed 297834 --alignment /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.fna --fragment /tmp/tmptadj0m7j/study_seqs_filtered.fasta

Error running this command:
run_sepp.py --tree /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.tre --raxml /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.raxml_info --cpu 1 --molecule dna --outdir /tmp/tmptadj0m7j/sepp_out -seed 297834 --alignment /home/mariano/Downloads/picrust2-2.5.2/picrust2/default_files/prokaryotic/pro_ref/pro_ref.fna --fragment /tmp/tmptadj0m7j/study_seqs_filtered.fasta

Standard error of the above failed command:
Traceback (most recent call last):
  File "/home/mariano/miniconda3/envs/picrust2/bin/run_sepp.py", line 3, in <module>
    from sepp.exhaustive import ExhaustiveAlgorithm
  File "/home/mariano/miniconda3/envs/picrust2/lib/python3.8/site-packages/sepp/exhaustive.py", line 6, in <module>
    from sepp.algorithm import AbstractAlgorithm
  File "/home/mariano/miniconda3/envs/picrust2/lib/python3.8/site-packages/sepp/algorithm.py", line 11, in <module>
    from sepp.tree import PhylogeneticTree
  File "/home/mariano/miniconda3/envs/picrust2/lib/python3.8/site-packages/sepp/tree.py", line 25, in <module>
    from dendropy.datamodel.treemodel import _convert_node_to_root_polytomy as \
ImportError: cannot import name '_convert_node_to_root_polytomy' from 'dendropy.datamodel.treemodel' (/home/mariano/miniconda3/envs/picrust2/lib/python3.8/site-packages/dendropy/datamodel/treemodel/__init__.py)

============================================================================================= short test summary info =============================================================================================
FAILED tests/test_place_seqs.py::place_seqs_tests::test_run_place_seqs_pipeline_sepp - SystemExit: 1
===================================================================================== 1 failed, 60 passed in 92.27s (0:01:32) =====================================================================================

Hello,

Can you please provide some more details? Did you install PICRUSt2 from source, as indicated in the installation instructions? pytest is only expected to work if you did this, but without more information than this, I can't help.

Robyn

It is OK, it works anyways even if it failed that test. Thank you