Are people assaulted on the trains?
Very, very rarely. But a few precautions really help.
First, don’t leave your bag open or expose your wallet. Keep your valuables secure.
Second, for women: to avoid a train molester, you can (1) use women-only cars if available; (2) stand near the center, not in a corner, so that you can move to a different spot if needed; (3) don’t be an easy target: refrain from wearing clothes that expose your skin. If you are being harassed, raise your voice; call for help. On a crowded train, attention is the last thing these criminals want.
For men: Take care not to be mistaken for a molester in a crowded situation by holding on to handles and bars with both hands. In any case, you’re more stable this way if the train hits the brake suddenly.
Trains in Japan are extremely clean, punctual, and convenient. It’s best to respect the rules and to make the most of them.