Skip to content

Commit

Permalink
Fixed crash when no cells exist in clonotype
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Stubbington committed May 2, 2017
1 parent 88d4754 commit 455f4d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions tracerlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def __init__(self, d):
self.expected_string = self._get_expected_string()

def check_for_match(self, cell, locus):
#pdb.set_trace()
found_identifiers = set()
found_locus = False

Expand Down
16 changes: 11 additions & 5 deletions tracerlib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ def run(self):
cell_name=cell_name,
receptor=self.receptor_name,
loci=self.loci))

#pdb.set_trace()
recombinant_data = pd.DataFrame(recombinant_data)

# make clonotype networks
Expand Down Expand Up @@ -969,12 +969,18 @@ def run(self):
"group_size": group_len})

group_membership = pd.DataFrame(group_membership)

cell_data = pd.merge(recombinant_data, group_membership, how='outer',
on='cell_name')

if not group_membership.empty:
cell_data = pd.merge(recombinant_data, group_membership, how='outer',
on='cell_name')
else:
cell_data = recombinant_data.copy()
cell_data['clonal_group'] = ''
cell_data['group_size'] = ''

cell_data.set_index("cell_name", inplace=True)
cell_data.to_csv(os.path.join(outdir, "cell_data.csv"))

#pdb.set_trace()
# plot clonotype sizes
plt.figure()
clonotype_sizes = tracer_func.get_component_groups_sizes(cells,
Expand Down

0 comments on commit 455f4d3

Please sign in to comment.