  Using a statistical-mechanics approach, we study the effects of geometry and
self-avoidance on the ordering of slender filaments inside non-isotropic
containers, considering cortical microtubules in plant cells, and packing of
genetic material inside viral capsids as concrete examples. Within a mean-field
approximation, we show analytically how the shape of the container, together
with self-avoidance, affects the ordering of the stiff rods. We find that the
strength of the self-avoiding interaction plays a significant role in the
preferred packing orientation, leading to a first-order transition for oblate
cells, where the preferred orientation changes from azimuthal, along the
equator, to a polar one, when self-avoidance is strong enough. While for
prolate spheroids the ground state is always a polar-like order, strong
self-avoidance results with a deep meta-stable state along the equator. We
compute the critical surface describing the transition between azimuthal and
polar ordering in the three dimensional parameter space (persistence length,
eccentricity, and self-avoidance) and show that the critical behavior of this
system is in fact related to the butterfly catastrophe model. We calculate the
pressure and shear stress applied by the filament on the surface, and the
injection force needed to be applied on the filament in order to insert it into
the volume. We compare these results to the pure mechanical study where
self-avoidance is ignored, and discuss similarities and differences.
