Blood tests that detect illness-causing bacteria can be essential for determining appropriate treatment, but the days it takes to receive results could make a significant difference in a patient’s condition.

For the first time, researchers at the University of California-San Diego have found a way to detect harmful chemicals in a blood sample in mere hours. Their findings were published Feb. 8 in Nature Scientific Reports.

The researchers were able to isolate bacterial DNA, place the DNA on a digital chip, and slowly heat it in a high-throughput microscope of their own design. Using a special dye, the team was able to identify individual types of bacteria and then analyze unique signatures using a machine-learning algorithm.

This method was able to accurately identify bacterial DNA sequences that cause food-borne illnesses and pneumonia 99 percent of the time — in just four hours. In comparison, traditional methods can have an error rate of up to 22.6 percent, according to the researchers. Researchers say the time savings could lead to quicker and more appropriate treatment.

Going forward, researchers want to further verify their results in patient samples and advance the system to detect fungal, viral pathogens, and genes for antibiotic resistance. Researchers also hope to reduce the size of the system and make it deployable in clinics and physician offices within five years.