From a84374cc27e31bb23e54ea222d8486b9b65b7eac Mon Sep 17 00:00:00 2001 From: Thomas Yu Date: Sat, 13 Jun 2020 02:31:35 +0000 Subject: [PATCH] Fix merge cna function --- genie/cna.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/genie/cna.py b/genie/cna.py index 75cf680d..31aa77e8 100644 --- a/genie/cna.py +++ b/genie/cna.py @@ -61,8 +61,14 @@ def makeCNARow(row, symbols): def mergeCNAvalues(x): - x.dropna(inplace=True) - uniqueValues = set(x.unique()) + """Merge CNA values, make sure if there are two rows that are the + same gene, the values are merged""" + # Change into its own series, because sometimes doing an apply + # will cause there to be a missing index value which will + # cause dropna() to fail. + values = pd.Series(x.values) + values.dropna(inplace=True) + uniqueValues = set(values.unique()) if len(uniqueValues) == 1: returnVal = x.tolist()[0] elif len(uniqueValues) <= 2: