If you learn the traffic pattern of your route, you can reduce your concern primarily to red light runners.
If there is no bike lane. Take the whole lane.
in a collision between a cyclist and a pedestrian there is an almost equal potential for harm for both the cyclist and the pedestrian. the rates of rapid deceleration are just as forceful as the rate of acceleration.
the pedestrian could potentially be struck with a metal part of the bike. an almost equal potential exists for the cyclist to be injured by a metal part of the bicycle hitting the ground or a parked car before the cyclist does.
So while i'm sure that your close encounter with a scofflaw cyclist was scary, it was just as dangerous for you as it was for them.
edit: I misunderstood. Yes, if the bike lane is contraflow of course use it that way. Everyone expects bikes from the "wrong way" in that situation. It's all about minimizing surprises to anyone in or near the street.
See also: http://gothamist.com/2016/02/04/sixth_ave_bike_lane.php
And in any case, here's what it tends to look like in a lot of places: https://goo.gl/6nGUfz
* Open car door with a guy probably unaware of any bicyclists coming up behind him. I would 100% have to go into traffic to avoid him, to make sure he doesn't step back and elbow me.
* A truck half in the bike lane. I'd probably risk just riding up against it, since I can see them unloading - unless they're standing right next to the bike lane.
* Lady getting into a taxi cab. I have to either stop and wait, or cross an entire lane of traffic to go around them.
* Black SUV up ahead is also parked - in the intersection - doing god knows what with a passenger: http://goo.gl/3jYdOb
* http://goo.gl/gCkKVT Fresh Directly In The Bike Lane
* http://goo.gl/1cXmLX Goodbye, bike lane, and good riddance.
Now, you can say I cherry-picked the bad examples, and you'd be correct. But I cherry picked them by going down 6th Ave in Google Streetview. These are all examples I would run into on my daily bike commute. These aren't once-a-week or once-a-day examples; if I rode down today and counted, I'd probably see more examples of things that directly impact my safety.
Luckily, you can usually take the Hudson River Greenway by cutting all the way west. It's a more pleasant ride, but does take you out of your way, and once you get above 59th street, has limited access eastward and not a lot of signage to that effect.
If I don't mind pedaling through traffic, I'll take Sixth. If I'm angry and want to stay that way, I'll take 8th. If I've got time to kill, I'll take the greenway.