Runny nose, cough, fever: patients show up in clinics every day with these classic symptoms of respiratory infection. But is the culprit a bacterium, which can be attacked with antibiotics, or a virus, which is harder to target with medication? Often doctors cannot be certain. But researchers say they are closing in on an accurate test that can make the call quickly, right in a physician’s office.

Faced with an unknown infection, doctors sometimes order laboratory tests for common bacteria such as Streptococcus. Or they might immediately try antibiotics, basing this decision simply on symptom strength—but antibiotic overuse can lead to dangerously resistant bacterial strains. “When the distinction can be made quickly, we can ensure that antibiotics are not inappropriately prescribed,” says Duke University infectious disease specialist Ephraim Tsalik. In 2016 he and his colleagues developed a lab test linking common respiratory symptoms to viral, bacterial or noninfectious origins. It works because each pathogen activates a different set of genes, varying their RNA or protein production, and the test can spot these telltale “gene expression” signatures in a small blood sample.

The team recently collaborated with a company called BioFire to speed up this test to produce results within an hour. The new process, tested on more than 600 emergency room patients for a study in Critical Care Medicine, identified bacterial infections with 80 percent accuracy and viral infections with nearly 87 percent accuracy. A common lab test Tsalik evaluated had about 69 percent accuracy. Others require time-consuming cultures or can only confirm specific pathogens a doctor decides to test for.

Technology to examine genes’ response to pathogens in a rapid and integrated way was just recently developed, says Stanford University computational immunologist Purvesh Khatri, who was not involved in the study. Amplifying RNA through PCR-based methods, a key analytic step, can now be done in 15 to 20 minutes. Khatri co-founded Inflammatix, a company set to soon release its own rapid test “to tell whether there is an infection and which [pathogen] is likely causing it and also give information about severity.”

Tools to help limit antibiotic overuse for respiratory infections “could have a dramatic impact in curbing the rise of antibiotic resistance,” says Washington University in St. Louis pediatric infectious disease specialist Gregory Storch, who was not involved in the study. And whereas people from different populations and with certain preexisting conditions might show varying patterns of gene expression, Storch hopes future work will account for such differences to ensure reliable results for all.