Molecular diagnostics based on clustering dynamics of magnetic nanobeads