"Take a bus" and "take the bus" are essentially interchangeable; you can use either, regardless of whether you mean a specific bus or bus line. You can even "take a 227". However, while you can take a train or the train, you would take the subway but never a subway, because the subway isn't the vehicle, it's the system. You might take a subway train, but that is a train that is a part of the subway. (I imagine that if one were in a city where there were multiple different subways that competed, you might take a subway, if you were not specifying which subway company you were going to ride with.)
Interestingly, you would take a plane but usually not the plane, if you aren't specifying which plane or plane route.
(The only example I can think of where you would be required to use one or the other are non-idiomatic, such as if you were using the word "take" to mean "steal", and were specifying which vehicle.)