Dipterans are endopterygotes, insects that undergo radical metamorphosis. They belong to the Mecopterida, alongside the Mecoptera, Siphonaptera, Lepidoptera and Trichoptera. The possession of a single pair of wings distinguishes most true flies from other insects with "fly" in their names. However, some true flies such as Hippoboscidae (louse flies) have become secondarily wingless.
All the insects groups included are from the infraclass Neoptera, which can flex their wings over the abdomen, so it does not include members of the Palaeoptera which cannot flex their wings in this way and includes dragonflies, damselflies and mayflies. This cladogram represents the current consensus view.
The first true dipterans known are from the Middle Triassic (around 240 million years ago), and they became widespread during the Middle and Late Triassic. Modern flowering plants did not appear until the Cretaceous (around 140 million years ago), so the original dipterans must have had a different source of nutrition other than nectar. Based on the attraction of many modern fly groups to shiny droplets, it has been suggested that they may have fed on honeydew produced by sap-sucking bugs which were abundant at the time, and dipteran mouthparts are well-adapted to softening and lapping up the crusted residues. The basal clades in the Diptera include the Deuterophlebiidae and the enigmatic Nymphomyiidae. Three episodes of evolutionary radiation are thought to have occurred based on the fossil record. Many new species of lower Diptera developed in the Triassic, about 220 million years ago. Many lower Brachycera appeared in the Jurassic, some 180 million years ago. A third radiation took place among the Schizophora at the start of the Paleogene, 66 million years ago.
The phylogenetic position of Diptera has been controversial. The monophyly of holometabolous insects has long been accepted, with the main orders being established as Lepidoptera, Coleoptera, Hymenoptera and Diptera, and it is the relationships between these groups which has caused difficulties. Diptera is widely thought to be a member of Mecopterida, along with Lepidoptera (butterflies and moths), Trichoptera (caddisflies), Siphonaptera (fleas), Mecoptera (scorpionflies) and possibly Strepsiptera (twisted-wing flies). Diptera has been grouped with Siphonaptera and Mecoptera in the Antliophora, but this has not been confirmed by molecular studies.
Diptera were traditionally broken down into two suborders, Nematocera and Brachycera, distinguished by the differences in antennae. The Nematocera are recognized by their elongated bodies and many-segmented, often feathery antennae as represented by mosquitoes and crane flies. The Brachycera have rounder bodies and much shorter antennae. Subsequent studies have identified the Nematocera as being non-monophyletic with modern phylogenies placing the Brachycera within grades of groups formerly placed in the Nematocera. The construction of a phylogenetic tree has been the subject of ongoing research. The following cladogram is based on the FLYTREE project.
Abbreviations used in the cladogram:
Flies are often abundant and are found in almost all terrestrial habitats in the world apart from Antarctica. They include many familiar insects such as house flies, blow flies, mosquitoes, gnats, black flies, midges and fruit flies. More than 150,000 have been formally described and the actual species diversity is much greater, with the flies from many parts of the world yet to be studied intensively. The suborder Nematocera include generally small, slender insects with long antennae such as mosquitoes, gnats, midges and crane-flies, while the Brachycera includes broader, more robust flies with short antennae. Many nematoceran larvae are aquatic. There are estimated to be a total of about 19,000 species of Diptera in Europe, 22,000 in the Nearctic region, 20,000 in the Afrotropical region, 23,000 in the Oriental region and 19,000 in the Australasian region. While most species have restricted distributions, a few like the housefly (Musca domestica) are cosmopolitan. Gauromydas heros (Asiloidea), with a length of up to 7 cm (2.8 in), is generally considered to be the largest fly in the world, while the smallest is Euryplatea nanaknihali, which at 0.4 mm (0.016 in) is smaller than a grain of salt.
Brachycera are ecologically very diverse, with many being predatory at the larval stage and some being parasitic. Animals parasitised include molluscs, woodlice, millipedes, insects, mammals, and amphibians. Flies are the second largest group of pollinators after the Hymenoptera (bees, wasps and relatives). In wet and colder environments flies are significantly more important as pollinators. Compared to bees, they need less food as they do not need to provision their young. Many flowers that bear low nectar and those that have evolved trap pollination depend on flies. It is thought that some of the earliest pollinators of plants may have been flies.
The greatest diversity of gall forming insects are found among the flies, principally in the family Cecidomyiidae (gall midges). Many flies (most importantly in the family Agromyzidae) lay their eggs in the mesophyll tissue of leaves with larvae feeding between the surfaces forming blisters and mines. Some families are mycophagous or fungus feeding. These include the cave dwelling Mycetophilidae (fungus gnats) whose larvae are the only diptera with bioluminescence. The Sciaridae are also fungus feeders. Some plants are pollinated by fungus feeding flies that visit fungus infected male flowers.
The larvae of Megaselia scalaris (Phoridae) are almost omnivorous and consume such substances as paint and shoe polish. The larvae of the shore flies (Ephydridae) and some Chironomidae survive in extreme environments including glaciers (Diamesa sp., Chironomidae), hot springs, geysers, saline pools, sulphur pools, septic tanks and even crude oil (Helaeomyia petrolei). Adult hoverflies (Syrphidae) are well known for their mimicry and the larvae adopt diverse lifestyles including being inquiline scavengers inside the nests of social insects. Some brachycerans are agricultural pests, some bite animals and humans and suck their blood, and some transmit diseases.
Flies are adapted for aerial movement and typically have short and streamlined bodies. The first tagma of the fly, the head, bears the eyes, the antennae, and the mouthparts (the labrum, labium, mandible, and maxilla make up the mouthparts). The second tagma, the thorax, bears the wings and contains the flight muscles on the second segment, which is greatly enlarged; the first and third segments have been reduced to collar-like structures, and the third segment bears the halteres, which help to balance the insect during flight. The third tagma is the abdomen consisting of 11 segments, some of which may be fused, and with the 3 hindermost segments modified for reproduction.
Flies have a mobile head with a pair of large compound eyes on the sides of the head, and in most species, three small ocelli on the top. The compound eyes may be close together or widely separated, and in some instances are divided into a dorsal region and a ventral region, perhaps to assist in swarming behaviour. The antennae are well-developed but variable, being thread-like, feathery or comb-like in the different families. The mouthparts are adapted for piercing and sucking, as in the black flies, mosquitoes and robber flies, and for lapping and sucking as in many other groups. Female horse-flies use knife-like mandibles and maxillae to make a cross-shaped incision in the host'S skin and then lap up the blood that flows. The gut includes large diverticulae, allowing the insect to store small quantities of liquid after a meal.
For visual course control, flies' optic flow field is analyzed by a set of motion-sensitive neurons. A subset of these neurons is thought to be involved in using the optic flow to estimate the parameters of self-motion, such as yaw, roll, and sideward translation. Other neurons are thought to be involved in analyzing the content of the visual scene itself, such as separating figures from the ground using motion parallax. The H1 neuron is responsible for detecting horizontal motion across the entire visual field of the fly, allowing the fly to generate and guide stabilizing motor corrections midflight with respect to yaw. The ocelli are concerned in the detection of changes in light intensity, enabling the fly to react swiftly to the approach of an object.
Like other insects, flies have chemoreceptors that detect smell and taste, and mechanoreceptors that respond to touch. The third segments of the antennae and the maxillary palps bear the main olfactory receptors, while the gustatory receptors are in the labium, pharynx, feet, wing margins and female genitalia, enabling flies to taste their food by walking on it. The taste receptors in females at the tip of the abdomen receive information on the suitability of a site for ovipositing. Flies that feed on blood have special sensory structures that can detect infrared emissions, and use them to home in on their hosts, and many blood-sucking flies can detect the raised concentration of carbon dioxide that occurs near large animals. Some tachinid flies (Ormiinae) which are parasitoids of bush crickets, have sound receptors to help them locate their singing hosts.
Diptera have one pair of fore wings on the mesothorax and a pair of halteres, or reduced hind wings, on the metathorax. A further adaptation for flight is the reduction in number of the neural ganglia, and concentration of nerve tissue in the thorax, a feature that is most extreme in the highly derived Muscomorpha infraorder. Some species of flies are exceptional in that they are secondarily flightless. The only other order of insects bearing a single pair of true, functional wings, in addition to any form of halteres, are the Strepsiptera. In contrast to the flies, the Strepsiptera bear their halteres on the mesothorax and their flight wings on the metathorax. Each of the fly's six legs has a typical insect structure of coxa, trochanter, femur, tibia and tarsus, with the tarsus in most instances being subdivided into five tarsomeres. At the tip of the limb is a pair of claws, and between these are cushion-like structures known as pulvilli which provide adhesion.
The abdomen shows considerable variability among members of the order. It consists of eleven segments in primitive groups and ten segments in more derived groups, the tenth and eleventh segments having fused. The last two or three segments are adapted for reproduction. Each segment is made up of a dorsal and a ventral sclerite, connected by an elastic membrane. In some females, the sclerites are rolled into a flexible, telescopic ovipositor.
Flies are capable of great manoeuvrability during flight due to the presence of the halteres. These act as gyroscopic organs and are rapidly oscillated in time with the wings; they act as a balance and guidance system by providing rapid feedback to the wing-steering muscles, and flies deprived of their halteres are unable to fly. The wings and halteres move in synchrony but the amplitude of each wing beat is independent, allowing the fly to turn sideways. The wings of the fly are attached to two kinds of muscles, those used to power it and another set used for fine control.
Flies tend to fly in a straight line then make a rapid change in direction before continuing on a different straight path. The directional changes are called saccades and typically involve an angle of 90°, being achieved in 50 milliseconds. They are initiated by visual stimuli as the fly observes an object, nerves then activate steering muscles in the thorax that cause a small change in wing stroke which generate sufficient torque to turn. Detecting this within four or five wingbeats, the halteres trigger a counter-turn and the fly heads off in a new direction.
Flies have rapid reflexes that aid their escape from predators but their sustained flight speeds are low. Dolichopodid flies in the genus Condylostylus respond in less than 5 milliseconds to camera flashes by taking flight. In the past, the deer bot fly, Cephenemyia, was claimed to be one of the fastest insects on the basis of an estimate made visually by Charles Townsend in 1927. This claim, of speeds of 600 to 800 miles per hour, was regularly repeated until it was shown to be physically impossible as well as incorrect by Irving Langmuir. Langmuir suggested an estimated speed of 25 miles per hour.
Although most flies live and fly close to the ground, a few are known to fly at heights and a few like Oscinella (Chloropidae) are known to be dispersed by winds at altitudes of up to 2000 ft and over long distances. Some hover flies like Metasyrphus corollae have been known to undertake long flights in response to aphid population spurts.
Males of fly species such as Cuterebra, many hover flies, bee flies (Bombyliidae) and fruit flies (Tephritidae) maintain territories within which they engage in aerial pursuit to drive away intruding males and other species. While these territories may be held by individual males, some species form leks with many males aggregating in displays. Some flies maintain an airspace and still others form dense swarms that maintain a stationary location with respect to landmarks. Many flies mate in flight while swarming.
Diptera go through a complete metamorphosis with four distinct life stages – egg, larva, pupa and adult. In many flies, the larval stage is long and adults may have a short life. Most dipteran larvae develop in protected environments; many are aquatic and others are found in moist places such as carrion, fruit, vegetable matter, fungi and, in the case of parasitic species, inside their hosts. They tend to have thin cuticles and become desiccated if exposed to the air. Apart from the Brachycera, most dipteran larvae have sclerotinised head capsules, which may be reduced to remnant mouth hooks; the Brachycera, however, have soft, gelatinized head capsules from which the sclerites are reduced or missing. Many of these larvae retract their heads into their thorax.
Some other anatomical distinction exists between the larvae of the Nematocera and the Brachycera. Especially in the Brachycera, little demarcation is seen between the thorax and abdomen, though the demarcation may be visible in many Nematocera, such as mosquitoes; in the Brachycera, the head of the larva is not clearly distinguishable from the rest of the body, and few, if any, sclerites are present. Informally, such brachyceran larvae are called Maggots, but the term is not technical and often applied indifferently to fly larvae or insect larvae in general. The eyes and antennae of brachyceran larvae are reduced or absent, and the abdomen also lacks appendages such as cerci. This lack of features is an adaptation to food such as carrion, decaying detritus, or host tissues surrounding endoparasites. Nematoceran larvae generally have well-developed eyes and antennae, while those of Brachyceran larvae are reduced or modified.
Dipteran larvae have no jointed, "true legs", but some dipteran larvae, such as species of Simuliidae, Tabanidae and Vermileonidae, have prolegs adapted to hold onto a substrate in flowing water, host tissues or prey. The majority of dipterans are oviparous and lay batches of eggs, but some species are ovoviviparous, where the larvae starting development inside the eggs before they hatch or viviparous, the larvae hatching and maturing in the body of the mother before being externally deposited. These are found especially in groups that have larvae dependent on food sources that are short-lived or are accessible for brief periods. This is widespread in some families such as the Sarcophagidae. In Hylemya strigosa (Anthomyiidae) the larva moults to the second instar before hatching, and in Termitoxenia (Phoridae) females have incubation pouches, and a full developed third instar larva is deposited by the adult and it almost immediately pupates with no freely feeding larval stage. The tsetse fly (as well as other Glossinidae, Hippoboscidae, Nycteribidae and Streblidae) exhibits adenotrophic viviparity; a single fertilised egg is retained in the oviduct and the developing larva feeds on glandular secretions. When fully grown, the female finds a spot with soft soil and the larva works its way out of the oviduct, buries itself and pupates. Some flies like Lundstroemia parthenogenetica (Chironomidae) reproduce by thelytokous parthenogenesis while some gall midges have larvae that can produce eggs (paedogenesis).
The pupae take various forms. In some groups, particularly the Nematocera, the pupa is intermediate between the larval and adult form; these pupae are described as "obtect", having the future appendages visible as structures that adhere to the pupal body. The outer surface of the pupa may be leathery and bear spines, respiratory features or locomotory paddles. In other groups, described as "coarctate", the appendages are not visible. In these, the outer surface is a puparium, formed from the last larval skin, and the actual pupa is concealed within. When the adult insect is ready to emerge from this tough, desiccation-resistant capsule, it inflates a balloon-like structure on its head, and forces its way out.
The adult stage is usually short, its function only to mate and lay eggs. The genitalia of female flies are rotated to a varying degree from the position found in other insects. In some flies, this is a temporary rotation during mating, but in others, it is a permanent torsion of the organs that occurs during the pupal stage. This torsion may lead to the anus being below the genitals, or, in the case of 360° torsion, to the sperm duct being wrapped around the gut and the external organs being in their usual position. When flies mate, the male initially flies on top of the female, facing in the same direction, but then turns around to face in the opposite direction. This forces the male to lie on his back for his genitalia to remain engaged with those of the female, or the torsion of the male genitals allows the male to mate while remaining upright. This leads to flies having more reproduction abilities than most insects, and at a much quicker rate. Flies occur in large populations due to their ability to mate effectively and in a short period of time during the mating season.
As ubiquitous insects, dipterans play an important role at various trophic levels both as consumers and as prey. In some groups the larvae complete their development without feeding, and in others the adults do not feed. The larvae can be herbivores, scavengers, decomposers, predators or parasites, with the consumption of decaying organic matter being one of the most prevalent feeding behaviours. The fruit or detritus is consumed along with the associated micro-organisms, a sieve-like filter in the pharynx being used to concentrate the particles, while flesh-eating larvae have mouth-hooks to help shred their food. The larvae of some groups feed on or in the living tissues of plants and fungi, and some of these are serious pests of agricultural crops. Some aquatic larvae consume the films of algae that form underwater on rocks and plants. Many of the parasitoid larvae grow inside and eventually kill other arthropods, while parasitic larvae may attack vertebrate hosts.
Whereas many dipteran larvae are aquatic or live in enclosed terrestrial locations, the majority of adults live above ground and are capable of flight. Predominantly they feed on nectar or plant or animal exudates, such as honeydew, for which their lapping mouthparts are adapted. The flies that feed on vertebrate blood have sharp stylets that pierce the skin, the insects inserting anticoagulant saliva and absorbing the blood that flows; in this process, certain diseases can be transmitted. The bot flies (Oestridae) have evolved to parasitize mammals. Many species complete their life cycle inside the bodies of their hosts. In many dipteran groups, swarming is a feature of adult life, with clouds of insects gathering in certain locations; these insects are mostly males, and the swarm may serve the purpose of making their location more visible to females.
Flies are eaten by other animals at all stages of their development. The eggs and larvae are parasitised by other insects and are eaten by many creatures, some of which specialise in feeding on flies but most of which consume them as part of a mixed diet. birds, bats, frogs, lizards, dragonflies and spiders are among the predators of flies. Many flies have evolved mimetic resemblances that aid their protection. Batesian mimicry is widespread with many hoverflies resembling bees and wasps, ants and some species of tephritid fruit fly resembling spiders. Some species of hoverfly are myrmecophilous, their young live and grow within the nests of ants. They are protected from the ants by imitating chemical odours given by ant colony members. Bombyliid bee flies such as Bombylius major are short-bodied, round, furry, and distinctly bee-like as they visit flowers for nectar, and are likely also Batesian mimics of bees.
Flies play a variety of symbolic roles in different cultures. These include both positive and negative roles in religion. In the traditional Navajo religion, Big Fly is an important spirit being. In Christian demonology, Beelzebub is a demonic fly, the "Lord of the Flies", and a god of the Philistines.
Flies have appeared in literature since at least the time of Ancient Greece. The Ancient Greek playwright Aeschylus has a gadfly pursue and torment Io, a maiden associated with the moon, watched constantly by the eyes of the herdsman Argus, associated with all the stars: "Io: Ah! Hah! Again the prick, the stab of gadfly-sting! O earth, earth, hide, the hollow shape—Argus—that evil thing—the hundred-eyed." William Shakespeare, inspired by Aeschylus, has Tom o'Bedlam in King Lear, "Whom the foul fiend hath led through fire and through flame, through ford and whirlpool, o'er bog and quagmire", driven mad by the constant pursuit. In Antony and Cleopatra, Shakespeare similarly likens Cleopatra's hasty departure from the Actium battlefield to that of a cow chased by a gadfly. More recently, in 1962 the biologist Vincent Dethier wrote To Know a Fly, introducing the general reader to the behaviour and physiology of the fly.
Flies appear in popular culture in concepts such as fly-on-the-wall documentary-making in film and television production. The metaphoric name suggests that events are seen candidly, as a fly might see them. Flies have inspired the design of miniature flying robots. Steven Spielberg's 1993 film Jurassic Park relied on the idea that DNA could be preserved in the stomach contents of a blood-sucking fly fossilised in amber, though the mechanism has been discounted by scientists.
Dipterans are an important group of insects and have a considerable impact on the environment. Some leaf-miner flies (Agromyzidae), fruit flies (Tephritidae and Drosophilidae) and gall midges (Cecidomyiidae) are pests of agricultural crops; others such as tsetse flies, screwworm and botflies (Oestridae) attack livestock, causing wounds, spreading disease, and creating significant economic harm. A few can even cause myiasis in humans. Still others such as mosquitoes (Culicidae), blackflies (Simuliidae) and drain flies (Psychodidae) impact human health, acting as vectors of major tropical diseases. Among these, Anopheles mosquitoes transmit malaria, filariasis, and arboviruses; Aedes aegypti mosquitoes carry dengue fever and the Zika virus; blackflies carry river blindness; sand flies carry leishmaniasis. Other dipterans are a nuisance to humans, especially when present in large numbers; these include houseflies, which contaminate food and spread food-borne illnesses; the biting midges and sandflies (Ceratopogonidae) and the houseflies and stable flies (Muscidae). In tropical regions, eye flies (Chloropidae) which visit the eye in search of fluids can be a nuisance in some seasons.
Many dipterans serve roles that are useful to humans. Houseflies, Blowflies and fungus gnats (Mycetophilidae) are scavengers and aid in decomposition. Robber flies (Asilidae), tachinids (Tachinidae) and dagger flies and balloon flies (Empididae) are predators and parasitoids of other insects, helping to control a variety of pests. Many dipterans such as bee flies (Bombyliidae) and hoverflies (Syrphidae) are pollinators of crop plants.
Drosophila melanogaster, a fruit fly, has long been used as a model organism in research because of the ease with which it can be bred and reared in the laboratory, its small genome, and the fact that many of its genes have counterparts in higher eukaryotes. A large number of genetic studies have been undertaken based on this species; these have had a profound impact on the study of gene expression, gene regulatory mechanisms and mutation. Other studies have investigated physiology, microbial pathogenesis and development among other research topics. The studies on dipteran relationships by Willi Hennig helped in the development of cladistics, techniques that he applied to morphological characters but now adapted for use with molecular sequences in phylogenetics.
Maggots found on corpses are useful to forensic entomologists. Maggot species can be identified by their anatomical features and by matching their DNA. Maggots of different species of flies visit corpses and carcases at fairly well-defined times after the death of the victim, and so do their predators, such as beetles in the family Histeridae. Thus, the presence or absence of particular species provides evidence for the time since death, and sometimes other details such as the place of death, when species are confined to particular habitats such as woodland.
Some species of maggots such as blowfly larvae (gentles) and bluebottle larvae (casters) are bred commercially; they are sold as bait in angling, and as food for carnivorous animals (kept as pets, in zoos, or for research) such as some mammals, fishes, reptiles, and birds It has been suggested that fly larvae could be used at a large scale as food for farmed chickens, pigs, and fish. However, consumers are opposed to the inclusion of insects in their food, and the use of insects in animal feed remains illegal in areas such as the European Union.
Fly larvae can be used as a biomedical tool for wound care and treatment. Maggot debridement therapy (MDT) is the use of blow fly larvae to remove the dead tissue from wounds, most commonly being amputations. Historically, this has been used for centuries, both intentional and unintentional, on battlefields and in early hospital settings. Removing the dead tissue promotes cell growth and healthy wound healing. The larvae also have biochemical properties such as antibacterial activity found in their secretions as they feed. These medicinal maggots are a safe and effective treatment for chronic wounds.
The Sardinian cheese Casu marzu is exposed to flies known as cheese skippers such as Piophila casei, members of the family Piophilidae. The digestive activities of the fly larvae soften the cheese and modify the aroma as part of the process of maturation. At one time European Union authorities banned sale of the cheese and it was becoming hard to find, but the ban has been lifted on the grounds that the cheese is a traditional local product made by traditional methods.