A nanopore sensor and method for selective detection of analytes in a sample