Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions mibidata/mibi_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,28 @@ def channel_inds(self, channels):
f'with targets only (no masses were given), available ' \
f'targets are {self._channels}'
else:
error_msg = f'Subset of channels, targets or massses not ' \
f'found matching {channels}, available targets are ' \
f'{self._channels}'
missing_channels = []
matches = []
keys = [channel[1] for channel in self._channels]

# check for missing channels
# match on case-insensitive substring
for channel in channels:
if channel in keys:
continue
missing_channels.append(channel)
if len(channel) < 3:
continue
matches += [match for match in keys if channel.lower() in \
match.lower()]

error_msg = f'Channels, targets or masses not found ' \
f'matching {missing_channels}. '

if matches:
error_msg += f'Did you mean {matches}? '

error_msg += f'Available targets are {keys}.'
raise KeyError(error_msg)

def slice_data(self, channels):
Expand Down