Organizing nanometer-scale magnets with bacterial threads