WASHINGTON — It happens too often: A doctor isn't sure what's causing someone's feverish illness but prescribes antibiotics just in case, drugs that don't work if a virus is the real culprit.

Now Duke University researchers are developing a blood test to more easily tell when a respiratory illness is due to a virus and not a bacterial infection, hoping to cut the dangerous overuse of antibiotics and speed the right diagnosis.

It works by taking a fingerprint of your immune system — how its genes are revving up to fight the bug. That's very different from how infections are diagnosed today. And if the experimental test pans out, it also promises to help doctors track brand-new threats, like the next flu pandemic or that mysterious MERS virus that has erupted in the Middle East.

That viral "signature could be quite powerful, and may be a game-changer," said Dr. Geoffrey Ginsburg, Duke's genomic medicine chief. He leads the team that on Wednesday reported that a study involving 102 people provided early evidence that the test can work.

Today, when symptoms alone aren't enough for diagnosis, a doctor's suspicion guides what tests are performed — tests that work by hunting for evidence of a specific pathogen. Fever and cough? If it's flu season, you might be tested for the flu virus. An awful sore throat? Chances are you'll get checked for strep bacteria. A negative test can leave the doctor wondering what germ to check for next, or whether to make a best guess.

Moreover, rapid in-the-office tests aren't always accurate and can miss infections. So patients may have blood or other samples sent to labs to try to grow any lurking bacteria and tell if it's to blame, additional testing that can take days.

"This is something we struggle with every day," said Dr. Octavio Ramilo, infectious disease chief at Nationwide Children's Hospital in Columbus, Ohio, who wasn't involved in the new study. Particularly with children, a respiratory virus and a bacterial infection "in the beginning look completely alike," he added.

Hence researchers at a number of universities are trying to harness a fairly recent discovery: As your immune system detects an invading bug, different genes are activated to fend off a viral infection than to fight a bacterial or fungal one. Those subtle molecular changes appear to be occurring even before you feel any symptoms. And they form distinct patterns of RNA and proteins, what's called a genomic fingerprint.

The Duke team discovered 30 genes that are switched on in different ways during a viral attack. The test essentially is a freeze-frame to show "what those genes are doing at the moment in time that it's captured," explained Duke lead researcher Dr. Aimee Zaas, an infectious disease specialist.

Small studies spotted that viral signature in people who volunteered to be infected with different influenza strains for science.

For a more real-world simulation, the researchers then analyzed blood samples stored from feverish people who had come to the emergency room — and who were eventually diagnosed, the old-fashioned way, with either some type of virus or a bacterial infection.

The genomic test proved 89 percent accurate in sorting out who had a virus, and did even better at ruling out those who didn't, Zaas reported Wednesday in the journal Science Translational Medicine.

It took 12 hours to get results. The researchers hope to speed that up so that it might work as quickly as some in-office tests.

Still, "it's a promising tool," said Ramilo, an Ohio State University professor who is doing similar research. He called the Duke study an important step toward creating a commercial test, and predicts one might reach the market within five years.

Why would a doctor want to know merely that a virus is present and not which virus? That's enough information to rule out antibiotics, Zaas said. Unnecessary antibiotic use is one factor in the growing problem of drug-resistant germs, which the government blames for more than 23,000 deaths a year.

Plus, if a dangerous new virus begins spreading, like MERS, this approach could help avoid quarantining people unnecessarily by telling right away which ones are virus-free, Ginsburg added.

In Ohio, Ramilo is exploring a more immediate need: When young infants have high fevers, they're often hospitalized while doctors run a battery of tests to find the fraction who have a serious bacterial infection. He is leading a study involving 22 pediatric emergency rooms to see if a genomic fingerprint approach could separate which babies really need all that testing.

But the virus-or-not question is just the beginning, Ramilo said. His research suggests genomic fingerprints also can distinguish a flu strain from other common viruses. And the Duke team is analyzing a huge study of students living in dormitories, to see if the genomic test detected who was incubating the flu before their first sniffle — and thus might be useful in stemming outbreaks.