Secondary structure determines protein topology