Can someone help me understand what I wrote?

I’ve been trying to get into music theory recently but so far I’m only learning the basics. I wrote this solo recently (see guitar tab) and think the key is e major? But everytime I think a key fits some notes are off. Is anyone able to interpret what mode/key this is or what chords you might play over it?

I’ve been trying to get into music theory recently but so far I’m only learning the basics. I wrote this solo recently (see guitar tab) and think the key is e major? But everytime I think a key fits some notes are off. Is anyone able to interpret what mode/key this is or what chords you might play over it?