Is Shimano RD-5800 rear derailleur compatible with a 7 speed cassette?
Nope. The RD-5800 is the previous generation 105 level derailleur that works with 11 speed shifters and cassette.
You need a derailleur intended specifically for 7 speeds. The only 7 speed models Shimano makes are in the Tourney range.
Apparently, at least for 7-9 speeds, Shimano road derailleurs are compatible with 7-9 speed shifters as the combination of shifter cable pull and derailleur ratio will index the cage correctly. This does not work for 11 speed though.