physicochemical gradients have long been documented , but only recently has environmental shotgun sequencing allowed the associated functional ( gene - based ) gradients of an ecosystems biota to be addressed . macroscale functional gradients have been inferred from oceanic metagenomic data sets , both horizontally ( venter et al , 2004 ; johnson et al , 2006 ; rusch et al , 2007 ) and vertically ( delong et al , 2006 ) . many structured microbial communities have been shown to produce steep physicochemical gradients on the scale of millimeters ( jorgensen et al , 1979 ; schmitt - wagner and brune , 1999 ; ludemann et al , 2000 ; ley et al , 2006 ) , but associated community - level functional gradients have not been demonstrated to date . here , we investigate a complex , stratified , hypersaline microbial mat from guerrero negro , baja california sur , mexico , as a model for fine - scale functional variation ( ley et al , 2006 ) . the dense , tofu - like texture of this mat allows intact cross - sections to be obtained down to 1 mm thickness . the mat shows pronounced physicochemical variation both in space and time : oxygen is detected routinely in the top 2 mm during the day ( up to 700 m ) , and the mat is completely anoxic during the night . the permanently anoxic lower layers are characterized by micromolar levels of sulfide that increase with depth . the mat , dominated by bacteria , was reported to be one of the world 's richest and most diverse microbial communities , comprising at least 752 observed species from 42 bacterial phyla , including 15 novel candidate phyla ( ley et al , 2006 ) . as the mat grows in hypersaline waters ( 3  the salinity of sea water ) , we were also interested to look for evidence of molecular adaptations to hypersalinity in the mat community . to investigate millimeter - scale genetic and associated functional stratification , we performed a metagenomic analysis of 10 spatially successive layers of the guerrero negro mat . mat core samples were collected during the day ( supplementary table s1 ) and upper layers were sectioned at a finer scale ( 1 mm slices ) than the lower layers ( 415 mm slices ) to capture variation associated with the steep oxygen gradient in the upper millimeters of the mat ( supplementary table s2 ) . dna from each layer was cloned and shotgun - sequenced using capillary sequencing with an average of 13 000 reads per layer . no significant assembly of the reads was possible , even when all data were combined ( largest contig was 8.4 kb from a combined assembly ) . we therefore chose to analyze only the unassembled data ( average trimmed ( chou and holmes , 2001 ) read length 808 bp ) to avoid chimerism that has been reported to be frequent in contigs < 10 kb ( mavromatis et al , 2007 ) . genes were predicted on vector and quality - trimmed reads with fgenesb ( http://www.softberry.com/ ) using a generic bacterial model , resulting in an average of 13 600 genes per layer ( supplementary table s2 ) . these data have been deposited in genbank under accession numbers abpp00000000 through abpy00000000 and are available through the img / m system ( markowitz et al , 2006 ) ( see som for access information ) . using both bulk similarity matches and phylogenetic mapping of conserved marker genes ( von mering et al , 2007a ) , we found strong phylogenetic variation between layers . cyanobacteria and alphaproteobacteria were the most abundant lineages in the top two layers ( supplementary figure s1 ) . below the upper 2 mm , proteobacteria , bacteroidetes , chloroflexi and planctomycetes were the most represented phyla , with a notable peak in bacteroidetes at 3 mm ( supplementary figure s1 ) . numerous traces of other bacterial phyla as well as some archaea and eukaryotes were also identified . a large fraction of predicted proteins in layers below 2 mm did not have significant sequence similarity to any protein in public databases , reflecting the high degree of phylum - level novelty in the mat community ( ley et al , 2006 ) . these metagenome - based findings are in broad agreement with single - marker gene surveys of the mat ( spear et al , 2003 ; ley et al , 2006 ) . a rough measure of functional potential per organism can be made by estimating the average effective genome size ( raes et al , 2007 ) . using this method , we predicted an increased average bacterial genome size at the border of the oxic and anoxic zones ( 12 mm depth ) : 6 mb at the border versus 33.5 mb for the rest of the mat ( supplementary figure s2 ) . this may reflect an increased functional complexity needed for survival in the constantly fluctuating conditions at this depth as was recently observed in the genome of a marine beggiotoa occupying a similar niche ( mussmann et al , 2007 ) . to investigate genetic gradients through the mat , we determined the relative abundances of individual gene families and metabolic pathways between mat layers , and compared the mat data with external data sets for reference . many gene families were highly abundant in the mat despite high overall functional diversity ( supplementary figure s3 ) and very low sequence coverage of individual species . indeed , the mat data set roughly doubled existing inventories for some of the gene families described below ( table i ) . this implies that multiple species and likely higher - level taxa contribute representatives of these families , and suggests that there has been a strong selection for a limited number of common functionalities in the mat . the key aspect of this study was to use the metagenomic data to determine what , if any , millimeter - scale genetic gradients are detectable in this very complex and structured ecosystem . several gene families and pathways either directly ( figure 1a ) or inversely ( figure 1b ) tracked the steep oxygen gradient in the top 2 mm of the mat and sulfide gradient below 2 mm . genes directly involved in photosynthesis ( kegg map 00195 ) were statistically over - represented in the top two layers relative to lower layers . in addition , an uncharacterized protein domain ( pfam05685 ) highly paralogous in phototrophic lineages ( most cyanobacterial and some chloroflexi genomes ) showed a steep declining gradient in the top 6 mm ( figure 1a ) consistent with dominance of phototrophs in the same region . chaperones similarly tracked the oxygen gradient when all gene families with chaperone activity are combined together . the over - representation of chaperones in the top 2 mm relative to the rest of the mat may not be associated with oxygen concentration , but rather with heat stress caused by direct exposure to sunlight . gene families and pathways that tracked inversely with oxygen concentration included ferredoxins , trimethylamine methyltransferase ( mttb ) , sulfatases and sugar degradation pathways ( figure 1b ) . ferredoxins and associated proteins show a four - fold increase from the top layer down to a depth of 4 mm and thereafter are uniformly over - represented . two cog families are chiefly responsible for this trend : cog1148 ( heterodisulfide reductase , subunit a and related polyferredoxins ) and cog2414 ( aldehyde : ferredoxin oxidoreductase ) . the expansion of ferredoxins in the anoxic layers likely reflects the diversification of redox reactions required for anaerobic respiration . mttb ( pfam06253 , cog5598 ) methyltransferase does not become significantly over - represented until at least 7 mm into the mat ( figure 1b ) , well below the anoxic boundary . mttb was initially identified as a protein facilitating the first step of methanogenesis from trimethylamine in methanosarcinaceae ( paul et al , 2000 ) . however , this gene family is also found in methylotrophic bacteria ( e.g. in rhodobacteraceae and rhizobiaceae ) , suggesting a more generalized role in c1 metabolism . one of the most pronounced inverse gradients is observed for sulfatases ( cog3119 ) that are involved in the hydrolysis of sulfated organic compounds ( figure 1b ) . as sulfatases can function in the presence of oxygen , the gradient is presumably a reflection of the availability of sulfated compounds in the mat . although the concentration gradient of sulfated compounds is not known in the mat , they are produced by phototrophs ( kates , 1986 ) and are widespread in marine environments ( glockner et al , 2003 ) . sulfatase genes obtained from the mat exhibited extensive sequence divergence , suggesting that a corresponding wide variety of sulfated organic substrates are present in the mat , with the highest concentrations below 2 mm . the over - representation of this gene family may in part be due to an expansion of sulfatase genes in the genomes of planctomycetes , suggested to be involved particularly in the hydrolysis of sulfated glycopolymers ( glockner et al , 2003 ) . sugar degradation pathways ( glycolysis and pentose and uronic acid degradation ) show a two - fold increase with depth through the top 3 mm and maintain high relative representation in the anoxic lower layers ( figure 1b ) . this suggests that heterotrophic metabolism of sugars , particularly pentoses and uronic acids , is important in the lower layers . organisms living at the boundary between the oxic and anoxic zones could potentially accumulate substrates with high reductive potential in the anoxic zone , and then move to the oxic zone to harvest this potential by oxidation ( mussmann et al , 2007 ) . indeed , we find that chemotaxis signature genes peak sharply at the oxic  anoxic boundary ( figure 1c ) . flagella appear not to be the dominant source of motility in these chemotactic organisms as flagellar genes actually dip in this region ( figure 1c ) . chemotactic gliding bacteria have been observed in fresh mat cores ( garcia - pichel et al , 1994 ; kruschel and castenholz , 1998 ) and our molecular data suggest they are most abundant in the boundary zone , bridging the oxic and anoxic layers . despite the pronounced phylogenetic and functional gradients in the mat , hypersalinity is a selective pressure common to the whole community . a known adaptation to hypersalinity is enrichment of proteins with acidic amino acids , allowing proteins to function in high cytoplasmic salt concentrations ( soppa , 2006 ) . the resulting acid - shifted protein isoelectric points have been documented in the genomes of only two lineages , the archaeal class halobacteria ( kennedy et al , 2001 ; soppa , 2006 ) and the bacterial species salinibacter ruber ( oren and mana , 2002 ; mongodin et al , 2005 ) , so it is unclear how widespread this mechanism is in halophilic communities . the average isoelectric points of the mat layer communities are conspicuously acid - shifted when compared with most bacteria and microbiomes that are non - halophilic ( figure 2a ) . we determined this to be due primarily to an enrichment in the acidic amino acid aspartate ( figure 2b ) . furthermore , the isoelectric profiles of all 10 layers converge on a common acid - shifted profile ( figure 3a ) despite a significant variation in gc content between layers ( figure 3b ) , reflecting differing phylogenetic composition . the latter is consistent with aspartate usage being gc - independent as it can be encoded by both gc - rich and gc - poor codons ( gac and gat , respectively ) . as each metagenomic read pair is likely derived from different species and no single species dominates the mat community , we conclude that a significant fraction of the community has converged on the enrichment of low isoelectric point proteins . in summary , this study demonstrates that millimeter - scale genetic gradients can be readily discerned through a vertical cross - section of a highly structured and complex microbial community using low sequence coverage . furthermore , we could directly and inversely correlate many of the genetic gradients to the physicochemical profile of the mat . microbial biofilms are important in many habitats , including our own bodies ( kroes et al , 1999 ; eckburg et al , 2005 ) , and often display physicochemical gradients at millimeter to centimeter scales . however , few biofilms are as robust as microbial mats and methods may need to be adapted to preserve spatial structure ( webster et al , 2006 ) and allow the relevant fine - scale genetic gradients to be resolved . surprisingly , we found that adaptation to hypersalinity by enriching proteins with acidic amino acids is more widespread than previously appreciated . although this is the first example of species - independent molecular convergence in a microbial community , we predict that similar convergence patterns will be observed in other communities adapted to similar or different environmental conditions , such as temperature ( gianese et al , 2001 ) or pressure ( simonato et al , 2006 ; lauro and bartlett , 2008 ) . mat core samples were collected around 1400 hours from pond 4 near pond 5 at the exportadora de sal saltworks , guerrero negro , baja california sur , mexico . the salinity of the bulk water above the mat was 9% ( 3  the salinity of sea water ) . four replicate cores were collected , sectioned into layers with sterile scalpels and dna extracted , normalized , pooled and sequenced as described in supplementary information . metagenome sequence data are available under the following genbank accession numbers : abpp00000000 , abpq00000000 , abpr00000000 , abps00000000 , abpt00000000 , abpu00000000 , abpv00000000 , abpw00000000 , abpx00000000 , abpy00000000 community composition analysis was performed using the consensus of ( i ) best blastp hits ( altschul et al , 1997 ) to the img / m database ( markowitz et al , 2006 ) and ( ii ) phylogenetic mapping of signature genes on a phylogenetic tree ( von mering et al , 2007a ) . gene - based functional gradients were calculated as follows : genes were assigned to their cog families ( tatusov et al , 1997 ) and pfam domains ( bateman et al , 2002 ) based on rpsblast ( altschul et al , 1997 ) . the gradients were examined for possible over - representation of groups or individual families or domains , and 1000 bootstrap iterations were used to assess the significance of over - representation . the described gradients were independently confirmed using two databases : img / m ( markowitz et al , 2006 ) and the string database ( von mering et al , 2007b ) . further details as well as groupings of families / domains are described in supplementary information . isoelectric point distributions , amino - acid composition and gc content were computed using appropriate perl scripts and modules as described in supplementary information .