I have a list of lists, consisting of only numbers, with two numbers for each nested list which represent start and end offsets: x = [[54, 61], [254, 275], [298, 314], [350, 362], [387, 391], [457, 472]]
and then a list of two numbers e.g. y = [54,67]
. I would like filter x so that it doesn't contain complete or partial matches, depending on y.
For example if y = [54,67]
, then the output would be x = [[254, 275], [298, 314], [350, 362], [387, 391], [457, 472]]
because [54,61] is entailed in [54,67].
Other examples of partial matches for this x would be
y = [54,61]
x = [[298, 314], [350, 362], [387, 391], [457, 472]]
y = [253,275]
x = [[54, 61], [298, 314], [350, 362], [387, 391], [457, 472]]
y = [290, 315]
x = [[54, 61], [254, 275], [350, 362], [387, 391], [457, 472]]
y = [351, 361]
x = [[54, 61], [254, 275], [298, 314], [387, 391], [457, 472]]
What I have been trying is to match either the first of the second elements, but I don't know how to go about the partial ones.
y = [54, 61]
x = [[54, 67], [254, 275], [298, 314], [350, 362], [387, 391], [457, 472]]
out = [i for i in x if (i[0] or i[1]) not in y]