The Virus of the Purpose, also known as the Swarm, is the main antagonist of the Doctor Who story "The Invisible Enemy". It would later reappear in the Big Finish audio play "Revenge of the Swarm".
The Virus of the Purpose was a sentient, space-dwelling virus, capable of gaining controlling of anyone it infected. Its first victims were the crew of a shuttle en route to Titan who, upon arriving, killed most of the crew of the Titan base and began turning it into a breeding centre for the Swarm. The Virus also infected the TARDIS and the Fourth Doctor, who became the host for its Nucleus, although Leela was immune. Two of its carriers were killed, but the Virus managed to infect the surviving base crewmember, Supervisor Lowe, who covered for the fact that one of the Virus' hosts, Safran, had survived.
Lowe accompanied the Doctor and Leela to the Bi-Al Foundation, where he spread the Virus to several of the staff. The Virus also infected a shuttle crew and caused them to crash into the foundation as a distraction. The Nucleus was removed from the Doctor and enlarged to macro-size, being taken back to Titan by Lowe. The Doctor managed to cure those infected at the foundation and headed for Titan with antibodies obtained from Leela, but they were destroyed. The Nucleus was preparing to spawn macro-sized Virus molecules but the Doctor set up a booby trap with a laser gun and an oxygen leak, causing the base to be destroyed.
Years later, the Seventh Doctor, Ace and Hex learned the Virus had remained dormant in the TARDIS computer and infected Hex. It seeded its own origin by infecting the Bi-Al computer in the past, then attempted to become corporeal again but was defeated by the Doctor's use of his antibodies.