Self-assembly of macromolecules in a long and narrow tube