Do what you feel safest doing. The law in my area states I should ride to the right as is safe and practical. For the most part I follow it. However there are times when I take the lane. However, I do not try to impede traffic and move over to the right when I feel it is best to do so.
Its a judgment call. I put my safety first and foremost and will deal with the occasional hostility while asserting my rights on the road.