From eb5bf9ee184c5333ee7605abb72a564238d787d3 Mon Sep 17 00:00:00 2001 From: Anthony Bretaudeau Date: Fri, 10 Aug 2018 14:52:25 +0200 Subject: [PATCH] fix crash with strange tables --- biomaj2galaxy/commands/rm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/biomaj2galaxy/commands/rm.py b/biomaj2galaxy/commands/rm.py index aea48e6..663c6de 100644 --- a/biomaj2galaxy/commands/rm.py +++ b/biomaj2galaxy/commands/rm.py @@ -70,9 +70,10 @@ def rm(ctx, dbkey, tables, exact): continue for line in tables_entries[table]: - if (exact and line[dbkey_field] == dbkey) or (not exact and line[dbkey_field].startswith(dbkey)): - print("Deleting from '" + table + "' table") - ctx.gi.tool_data.delete_data_table(table, "\t".join(line)) + if len(line) > dbkey_field: # Sometimes Galaxy is lying (featurecounts_anno table) + if (exact and line[dbkey_field] == dbkey) or (not exact and line[dbkey_field].startswith(dbkey)): + print("Deleting from '" + table + "' table") + ctx.gi.tool_data.delete_data_table(table, "\t".join(line)) # Reload all tables just in case time.sleep(1) # Reloading too soon might not work for some strange reason