Functionalized 2D nanomaterials with switchable binding to investigate graphene-bacteria interactions.