From 79a09a2de84aef8b93f5164536bbb2c66f89c39a Mon Sep 17 00:00:00 2001 From: Gavin Douglas Date: Sun, 30 Oct 2022 19:51:36 -0300 Subject: [PATCH 1/2] Fixed incompatibility issues --- picrust2/metagenome_pipeline.py | 2 +- picrust2/pathway_pipeline.py | 7 ++++++- picrust2/util.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/picrust2/metagenome_pipeline.py b/picrust2/metagenome_pipeline.py index 21f13da..600a26b 100755 --- a/picrust2/metagenome_pipeline.py +++ b/picrust2/metagenome_pipeline.py @@ -338,7 +338,7 @@ def metagenome_contributions(func_abun, sample_abun, rare_seqs=[], func_abun_subset_melt['taxon_rel_function_abun'] = func_abun_subset_melt['genome_function_count'] * func_abun_subset_melt['taxon_rel_abun'] func_abun_subset_melt['norm_taxon_function_contrib'] = func_abun_subset_melt['taxon_function_abun'] / \ - func_abun_subset_melt.groupby("function").sum()["taxon_function_abun"][func_abun_subset_melt["function"]].to_numpy() + func_abun_subset_melt.groupby("function").sum(numeric_only = True)["taxon_function_abun"][func_abun_subset_melt["function"]].to_numpy() # Collapse sequences identified as "rare" to the same category. rare_seqs = [r for r in rare_seqs if r in func_abun_subset_melt['taxon'].to_list()] diff --git a/picrust2/pathway_pipeline.py b/picrust2/pathway_pipeline.py index 8f71994..8846a95 100755 --- a/picrust2/pathway_pipeline.py +++ b/picrust2/pathway_pipeline.py @@ -498,6 +498,8 @@ def pathway_pipeline(inputfile, path_abun_unstrat_by_seq = contrib_to_unstrat(contrib_table=path_abun_strat, sample_order=list(path_abun_unstrat.columns.values)) + path_abun_unstrat_by_seq.index.name = 'pathway' + # Check if an abundance table is empty, which can happen when very few gene # families are input. if len(path_abun_unstrat.index) == 0: @@ -530,7 +532,7 @@ def prep_pathway_df_out(in_tab, strat_index=False, num_digits=4): if not in_tab_df.empty: # Split stratified index into 2 new columns. - split_df = pd.DataFrame.from_records(list(in_tab_df.index.str.split('\\|\\|\\|', 1)), columns=['pathway', 'sequence']) + split_df = pd.DataFrame.from_records(list(in_tab_df.index.str.split(pat = '\\|\\|\\|', n = 1)), columns=['pathway', 'sequence']) in_tab_df.reset_index(inplace=True) in_tab_df[['pathway', 'sequence']] = split_df @@ -540,6 +542,9 @@ def prep_pathway_df_out(in_tab, strat_index=False, num_digits=4): # Add these columns to be first. in_tab_df = in_tab_df[['pathway', 'sequence'] + orig_col] + else: + in_tab_df.index.name = 'pathway' + return(in_tab_df) diff --git a/picrust2/util.py b/picrust2/util.py index 2e92092..a3c2719 100755 --- a/picrust2/util.py +++ b/picrust2/util.py @@ -544,7 +544,7 @@ def convert_humann2_to_picrust2(infiles, outfile, stratified): original_col = list(humann2_combined.columns) - split_df = pd.DataFrame.from_records(list(humann2_combined.index.str.split('\\|', 1)), columns=[first_col, 'sequence']) + split_df = pd.DataFrame.from_records(list(humann2_combined.index.str.split(pat = '\\|', n = 1)), columns=[first_col, 'sequence']) humann2_combined.reset_index(inplace=True) From 3d229dd169f41055517191153b95bbb8a473ebc6 Mon Sep 17 00:00:00 2001 From: Gavin Douglas Date: Sun, 30 Oct 2022 19:52:00 -0300 Subject: [PATCH 2/2] Bump version --- picrust2/__init__.py | 2 +- picrust2/default.py | 2 +- picrust2/metagenome_pipeline.py | 2 +- picrust2/pathway_pipeline.py | 2 +- picrust2/pipeline.py | 2 +- picrust2/place_seqs.py | 2 +- picrust2/util.py | 2 +- picrust2/wrap_hsp.py | 2 +- scripts/add_descriptions.py | 2 +- scripts/convert_table.py | 2 +- scripts/hsp.py | 2 +- scripts/metagenome_pipeline.py | 2 +- scripts/pathway_pipeline.py | 2 +- scripts/picrust2_pipeline.py | 2 +- scripts/place_seqs.py | 2 +- scripts/print_picrust2_config.py | 2 +- scripts/shuffle_predictions.py | 2 +- setup.py | 2 +- tests/test_hsp.py | 2 +- tests/test_metagenome_pipeline.py | 2 +- tests/test_pathway_pipeline.py | 2 +- tests/test_place_seqs.py | 2 +- tests/test_util.py | 2 +- tests/test_workflow.py | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/picrust2/__init__.py b/picrust2/__init__.py index 7bd64ec..723007f 100755 --- a/picrust2/__init__.py +++ b/picrust2/__init__.py @@ -4,4 +4,4 @@ __copyright__ = "Copyright 2018-2022, PICRUSt Project" __license__ = "GPL" __url__ = "https://github.com/picrust/picrust2" -__version__ = "2.5.0" +__version__ = "2.5.1" diff --git a/picrust2/default.py b/picrust2/default.py index c496689..9580ebe 100755 --- a/picrust2/default.py +++ b/picrust2/default.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" from os import path diff --git a/picrust2/metagenome_pipeline.py b/picrust2/metagenome_pipeline.py index 600a26b..a0b3252 100755 --- a/picrust2/metagenome_pipeline.py +++ b/picrust2/metagenome_pipeline.py @@ -1,7 +1,7 @@ #!/usr/bin/env python __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import sys import pandas as pd diff --git a/picrust2/pathway_pipeline.py b/picrust2/pathway_pipeline.py index 8846a95..aabd435 100755 --- a/picrust2/pathway_pipeline.py +++ b/picrust2/pathway_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import sys from collections import defaultdict diff --git a/picrust2/pipeline.py b/picrust2/pipeline.py index 743ca69..837866e 100755 --- a/picrust2/pipeline.py +++ b/picrust2/pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" from os import path import sys diff --git a/picrust2/place_seqs.py b/picrust2/place_seqs.py index 306a41a..685aef3 100755 --- a/picrust2/place_seqs.py +++ b/picrust2/place_seqs.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import sys from os import path, chdir, getcwd diff --git a/picrust2/util.py b/picrust2/util.py index a3c2719..f9c9148 100755 --- a/picrust2/util.py +++ b/picrust2/util.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" from os import makedirs, chmod from os.path import abspath, dirname, isdir, join, exists, splitext diff --git a/picrust2/wrap_hsp.py b/picrust2/wrap_hsp.py index 6b7e336..ed6c569 100755 --- a/picrust2/wrap_hsp.py +++ b/picrust2/wrap_hsp.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" from os import path import sys diff --git a/scripts/add_descriptions.py b/scripts/add_descriptions.py index cb9208d..42f16c5 100755 --- a/scripts/add_descriptions.py +++ b/scripts/add_descriptions.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.default import default_map diff --git a/scripts/convert_table.py b/scripts/convert_table.py index 9e77ec3..6150d67 100755 --- a/scripts/convert_table.py +++ b/scripts/convert_table.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.util import (check_files_exist, contrib_to_legacy, diff --git a/scripts/hsp.py b/scripts/hsp.py index b1e2142..3f4035b 100755 --- a/scripts/hsp.py +++ b/scripts/hsp.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.wrap_hsp import castor_hsp_workflow diff --git a/scripts/metagenome_pipeline.py b/scripts/metagenome_pipeline.py index 1655a96..d96aded 100755 --- a/scripts/metagenome_pipeline.py +++ b/scripts/metagenome_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from os import path diff --git a/scripts/pathway_pipeline.py b/scripts/pathway_pipeline.py index 4d320d6..bd18293 100755 --- a/scripts/pathway_pipeline.py +++ b/scripts/pathway_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.pathway_pipeline import pathway_pipeline diff --git a/scripts/picrust2_pipeline.py b/scripts/picrust2_pipeline.py index 7018f17..2704620 100755 --- a/scripts/picrust2_pipeline.py +++ b/scripts/picrust2_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from os import path diff --git a/scripts/place_seqs.py b/scripts/place_seqs.py index 595b169..9fde5b5 100755 --- a/scripts/place_seqs.py +++ b/scripts/place_seqs.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.place_seqs import place_seqs_pipeline diff --git a/scripts/print_picrust2_config.py b/scripts/print_picrust2_config.py index 4ebe2e7..5f62c07 100755 --- a/scripts/print_picrust2_config.py +++ b/scripts/print_picrust2_config.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" from sys import platform, version as python_version, executable diff --git a/scripts/shuffle_predictions.py b/scripts/shuffle_predictions.py index bdbb599..2d24dde 100755 --- a/scripts/shuffle_predictions.py +++ b/scripts/shuffle_predictions.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import argparse from picrust2.util import check_files_exist, shuffle_predictions diff --git a/setup.py b/setup.py index cfa090f..80e8c57 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" __maintainer__ = "Gavin Douglas" long_description = ("Please visit the google group if you have questions: " diff --git a/tests/test_hsp.py b/tests/test_hsp.py index 4a8a441..9da4d47 100755 --- a/tests/test_hsp.py +++ b/tests/test_hsp.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest from os import path diff --git a/tests/test_metagenome_pipeline.py b/tests/test_metagenome_pipeline.py index 881c966..1798d39 100755 --- a/tests/test_metagenome_pipeline.py +++ b/tests/test_metagenome_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest from os import path diff --git a/tests/test_pathway_pipeline.py b/tests/test_pathway_pipeline.py index 96bad8f..3cdf571 100755 --- a/tests/test_pathway_pipeline.py +++ b/tests/test_pathway_pipeline.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest import pandas as pd diff --git a/tests/test_place_seqs.py b/tests/test_place_seqs.py index e97bd2f..985ec25 100755 --- a/tests/test_place_seqs.py +++ b/tests/test_place_seqs.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest import gzip diff --git a/tests/test_util.py b/tests/test_util.py index a783a9d..26a2f4b 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest from os import path diff --git a/tests/test_workflow.py b/tests/test_workflow.py index b630edc..d5db202 100755 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2018-2022, The PICRUSt Project" __license__ = "GPL" -__version__ = "2.5.0" +__version__ = "2.5.1" import unittest from os import path