The only way to do it is to replace the structure with an engineered reinforcement.
First, is it necessary to use 4" pipe? There is a big difference if the run from the toilet to the main drain can be 3" pipe.
You need access to the joist from above or below.
If you have to notch the bottom of the joist, then a full 2x8 on BOTH sides of the remaining section will give you the equivalent strength. It should run at least five feet either side of the notch and be supported at the end if that puts the end over the bearing wall. Use at least ten 3" nails, uniformly distributed in the 2x8, on each side of the cut. That's 40 nails per 2x12 that you cut. The notch should be rounded, not a square corner cut. Do the best you can with a saber saw.
If the hole is in the middle of the 2x12, then you need 2x6s. Put one on each side above and below the notch. Put rounded notches in the 2x6s to accommodate the pipe. Notch the bottom of the 2x12, put the top 2x6s in place, install the pipe, and put the bottom 2x6s in place. This is a different loading (tension in the 2x6s instead of bending in the 2x8s above), so you actually need more nails (put 20 in each end of each 2x6, staggered, spaced) to develop the full tensile strength of the 2x6.
Rent a framing nailer for all this nailing.
Apply a liberal layer of yellow carpenters glue to each interface for both joints (2x6s or 2x8s).
When you are done, the structure will be at least as strong as the original.
Be sure to support the 2x12s while they are cut so your floor doesn't sag.