Opened 9 years ago

Closed 7 years ago

#465 closed enhancement (fixed)

atomic Collection.subtract() does not preserve element order

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: major Milestone:
Component: Core Version:
Keywords: Cc: pett@…
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Subtracting collections of chains, residues, atoms does not preserve order of elements because the numpy setdiff1d() method does not preserve order (it sorts). Probably order should be preserved. Eric needed this for multiple chains in matchmaker. Write a C++ routine to do the subtract preserving order by making a set out of the second array and iterating in order over the first array.

Change History (2)

comment:1 by Tom Goddard, 9 years ago

Eric added numpy code (a sort call) to preserve order. This is much slower than doing it in C++ but it now has the correct behavior.

May still want to optimize by making a C++ routine.

comment:2 by Tom Goddard, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.