Study of W Boson Production in Association with Beauty and Charm