Skip to content

Commit

Permalink
Merge pull request #328 from Sage-Bionetworks/hotfix
Browse files Browse the repository at this point in the history
Fix merge cna function
  • Loading branch information
thomasyu888 authored Jun 15, 2020
2 parents d394516 + a84374c commit 05fbf44
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions genie/cna.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 05fbf44

Please sign in to comment.