The tapeworm was nearly 4 inches long and had traveled from one hemisphere of a man’s brain to the other. By the time doctors finally removed it, after nearly four years of it wriggling through his brain matter, the 50-year-old had suffered memory flashbacks, pain on his right side and complex seizures.

Scientists at the Wellcome Trust Sanger Institute outside Cambridge, England, just reported their analysis of the parasite’s genome, which will be helpful in finding ways to fight it.

But I’m so not done with the worm.

Besides having a stunning number of vowels, Spirometra erinaceieuropaei needs no fewer than three hosts to mature to its adult stage, and it can occupy a variety of tissues, according to the study, published Friday in the journal Genome Biology.

The worm has been found in humans in its secondary larval form, known as a sparganum, which has no mouth or hooklets and can’t proliferate but can move around.

The worm matures as it works its way up the food chain to its preferred hosts — cats or dogs. It hatches from eggs and infects freshwater copepods, sometimes called water fleas, which are eaten by tadpoles, frogs or snakes, at which point the worm reaches its more advanced larval stage.

Humans become infected with that larval stage when they ingest these host animals, or in some cases through use of frog-meat poultices applied to open wounds or the eyes as part of traditional medicine in some areas of China, according to the study.

There have been only seven reported cases of human infection in Europe but more than 1,000 in China, the study said.

The patient whose brain had been infected, who was of Chinese ancestry, had lived in Britain for two decades but made frequent trips to China, the researchers said. He first reported headaches, seizures and episodes of altered smell and flashback memories in 2008. Multiple tests and scans were inconclusive, but a series of MRI images over the course of four years showed that brain lesions had migrated at least two inches. A biopsy caught the culprit.

During a biopsy they actually pulled out a small globular object and the pathology department identified it as a worm.— Hayley Bennett, Wellcome Trust Sanger Institute geneticist

“During a biopsy they actually pulled out a small globular object and the pathology department identified it as a worm,” said the study’s lead author, Hayley Bennett of the Sanger Institute. “It was inside his brain, and the MRI scans showed lesions where the worm was. They actually moved from one hemisphere of the brain to the other, over four years.”

Bennett, who specializes in worm genomics, was understandably intrigued. Tapeworms of other species wreak havoc in the developing world, including another species that can infect the brain and is the most preventable cause of epilepsy in developing countries.

“Tapeworms are a big issue across the world,” she said.

Scientists are eager to learn anything they can about fighting the pest and have already developed some promising drugs. Bennett and her colleagues looked for areas of the newly outlined genome that were similar to those of other species for which drugs have been developed.

“Because this is such a rare infection, it doesn’t really make any economic sense for anyone to develop a drug for it,” Bennett said. “But if drugs that were developed for other, more common infections can be repurposed, that could help patients with this infection in the future.”

Although they identified several promising targets for existing drugs, much more research will be required to find out whether the worm can be stopped, or at least kept from doing as much damage to tissues.

As for the patient, he has recovered, though he continues to suffer symptoms from the infection, according to the study.