Medicine

A 28-year-old man presents to the emergency room complaining of coughing up blood and sputum He provides a history of recurrent pneumonias and a chronic cough productive of foul-smelling purulent sputum He has no other past medical history and is a lifetime non-smoker. On physical examination, there are no oral lesions, heart sounds are normal, and wet inspiratory crackles are heard at the lung bases posteriorly. He also has clubbing of his fingers, but there is no hepatosplenomegaly or any palpable lymph nodes. CXR show fibrosis and pulmonary infiltrates in the right lower lung. Which of the following is the most appropriate initial diagnostic test?