Mary Shelley crafted the legendary story of Frankenstein as a ghost story at first. However, the main theme of Frankenstein was seeded long before that. She had this strong drive and interest for supernatural and alchemy. Both of her parents were writers, so there's no accident that she was also involved in that.