From 0e1c22e1873a6cdd5a8632e524adc09cc71ed3f2 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 2 Sep 2025 15:59:40 +0100 Subject: Catenate an empty list of genotypes. We handle this as a special case. --- pyhegp/pyhegp.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyhegp/pyhegp.py b/pyhegp/pyhegp.py index 3ffa314..f204a36 100644 --- a/pyhegp/pyhegp.py +++ b/pyhegp/pyhegp.py @@ -111,7 +111,17 @@ def encrypt_genotype(genotype, key, summary): axis="columns") def cat_genotype(genotypes): - return pd.concat(genotypes) + match genotypes: + # If there are no input data frames, return an empty data + # frame with the chromosome and position columns. + case []: + genotype = pd.DataFrame(data={"chromosome": [], + "position": []}) + genotype.chromosome = genotype.chromosome.astype("str") + genotype.position = genotype.position.astype("int") + return genotype + case _: + return pd.concat(genotypes) @click.group() def main(): -- cgit 1.4.1