Skip to content

Commit

Permalink
fix: Option and checks in bin summary script
Browse files Browse the repository at this point in the history
  • Loading branch information
dialvarezs committed Oct 27, 2024
1 parent 3e49dbf commit b1b6518
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bin/combine_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def parse_args(args=None):
)
parser.add_argument("-b", "--busco_summary", metavar="FILE", help="BUSCO summary file.")
parser.add_argument("-c", "--checkm_summary", metavar="FILE", help="CheckM summary file.")
parser.add_argument("-c", "--checkm2_summary", metavar="FILE", help="CheckM2 summary file.")
parser.add_argument("-C", "--checkm2_summary", metavar="FILE", help="CheckM2 summary file.")
parser.add_argument("-q", "--quast_summary", metavar="FILE", help="QUAST BINS summary file.")
parser.add_argument("-g", "--gtdbtk_summary", metavar="FILE", help="GTDB-Tk summary file.")
parser.add_argument("-a", "--cat_summary", metavar="FILE", help="CAT table file.")
Expand Down Expand Up @@ -86,16 +86,23 @@ def main(args=None):

if (
not args.busco_summary
and not args.checkm_summary
and not args.checkm2_summary
and not args.quast_summary
and not args.gtdbtk_summary
):
sys.exit("No summary specified! Please specify at least BUSCO, CheckM2 or QUAST summary.")
sys.exit(
"No summary specified! "
"Please specify at least BUSCO, CheckM, CheckM2 or QUAST summary."
)

# GTDB-Tk can only be run in combination with BUSCO or CheckM2
if args.gtdbtk_summary and not (args.busco_summary or args.checkm2_summary):
# GTDB-Tk can only be run in combination with BUSCO, CheckM or CheckM2
if args.gtdbtk_summary and not (
args.busco_summary or args.checkm_summary or args.checkm2_summary
):
sys.exit(
"Invalid parameter combination: GTDB-TK summary specified, but no BUSCO or CheckM2 summary!"
"Invalid parameter combination: "
"GTDB-TK summary specified, but no BUSCO, CheckM or CheckM2 summary!"
)

# handle bin depths
Expand Down Expand Up @@ -133,9 +140,7 @@ def main(args=None):
]
checkm_results = pd.read_csv(args.checkm_summary, usecols=use_columns, sep="\t")
checkm_results["Bin Id"] = checkm_results["Bin Id"] + ".fa"
if not bins.equals(
checkm_results["Bin Id"].sort_values().reset_index(drop=True)
):
if not bins.equals(checkm_results["Bin Id"].sort_values().reset_index(drop=True)):
sys.exit("Bins in CheckM summary do not match bins in bin depths summary!")
results = pd.merge(
results, checkm_results, left_on="bin", right_on="Bin Id", how="outer"
Expand Down

0 comments on commit b1b6518

Please sign in to comment.