I don't see where you have a wye? looks like a tee to me.
Anyhow you have to cut the bell off the pipe to the left, then cut the pipe to the right leaving a couple of inches of bare pipe to make your new tie-in ( don't cut it too short), you need a short piece of 4in. ABS; unless you can bum this from someone it is expensive. I would go to 3in for the toilet rough-in, I would use a 4x3in wye, a 3in.45, a 3in. 1/4bend and a 3in toilet flange. You also need 2-4in. Fernco couplings.
If you decide to do this, make sure you have it straight in your mind, and all the parts that you will need; real PITA if you have to run for parts just when you start
Make sure you secure your pipes when you're done, luck.