Conservation of LexA DNA-binding siteΒΆ

The web page on sequence logos on Wikipedia shows the sequence logo of the LexA-binding motif of Gram-positive bacteria. In this example we look at the other side: What is the amino acid sequence logo of the DNA-binding site of the LexA repressor?

We start by searching the NCBI Entrez database for lexA gene entries in the UniProtKB database and downloading them afterwards as GenPept file. In order to ensure that the file contains the desired entries, we check the entires for their definition (title) and source (species).

# Code source: Patrick Kunzmann
# License: BSD 3 clause

import numpy as np
import matplotlib.pyplot as plt
import biotite
import biotite.sequence as seq
import biotite.sequence.io.fasta as fasta
import biotite.sequence.io.genbank as gb
import biotite.sequence.graphics as graphics
import biotite.application.clustalo as clustalo
import biotite.database.entrez as entrez
# Search for protein products of LexA gene in UniProtKB/Swiss-Prot database
query =   entrez.SimpleQuery("lexA", "Gene Name") \
        & entrez.SimpleQuery("srcdb_swiss-prot", "Properties")
# Search for the first 200 hits
# More than 200 UIDs are not recommended for the EFetch service
# for a single fetch
uids = entrez.search(query, db_name="protein", number=200)
file_name = entrez.fetch_single_file(uids, biotite.temp_file("gp"),
                              db_name="protein", ret_type="gp")
# The file contains multiple concatenated GenPept files
# -> Usage of MultiFile
multi_file = gb.MultiFile("gp")
multi_file.read(file_name)
# Separate MultiFile into single GenPeptFile instances
files = [f for f in multi_file]
print("Definitions:")
for file in files[:20]:
    print(file.get_definition())
print()
print("Sources:")
for file in files[:20]:
    print(file.get_source())

Out:

Definitions:
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.
RecName: Full=LexA repressor.

Sources:
Mycobacterium tuberculosis H37Rv
Ralstonia pickettii 12J
Proteus mirabilis HI4320
Herpetosiphon aurantiacus DSM 785
Exiguobacterium sibiricum 255-15
Alteromonas mediterranea DE
Thermosipho africanus TCF52B
Rhizobium leguminosarum bv. trifolii WSM2304
Escherichia coli SE11
Salmonella enterica subsp. arizonae serovar 62:z4,z23:-
Petrotoga mobilis SJ95
Rhizobium etli CFN 42
Arthrobacter sp. FB24
Paenarthrobacter aurescens TC1
Mycolicibacterium smegmatis MC2 155
Enterobacter sp. 638
Thermosipho melanesiensis BI429
Shewanella loihica PV-4
Paracoccus denitrificans PD1222
Aeromonas hydrophila subsp. hydrophila ATCC 7966

The names of the sources are too long to be properly displayed later on. Therefore, we write a function that creates a proper abbreviation for a species name.

def abbreviate(species):
    # Remove possible brackets
    species = species.replace("[","").replace("]","")
    splitted_species= species.split()
    return "{:}. {:}".format(splitted_species[0][0], splitted_species[1])

print("Sources:")
all_sources = [abbreviate(file.get_source()) for file in files]
for source in all_sources[:20]:
    print(source)

Out:

Sources:
M. tuberculosis
R. pickettii
P. mirabilis
H. aurantiacus
E. sibiricum
A. mediterranea
T. africanus
R. leguminosarum
E. coli
S. enterica
P. mobilis
R. etli
A. sp.
P. aurescens
M. smegmatis
E. sp.
T. melanesiensis
S. loihica
P. denitrificans
A. hydrophila

Much better. For the alignment (required for sequence logo) we need to extract the slice of the sequence, that belongs to the DNA-binding site. Hence, we simply index the each sequence with the feature for the binding site and remove those sequences, that do not have a record specifying the required feature.

But we have still an issue: Some species seem to be overrepresented, as they show up multiple times. The reason for this is that some species, like M. tuberculosis, are represented by multiple strains with (almost) equal LexA sequences. To reduce this bias, we only want each species to occur only a single time. So we use a set to store the source name of sequences we already listed and ignore all further occurences of that source species.

# List of sequences
binding_sites = []
# List of source species
sources = []
# Set for ignoring already listed sources
listed_sources = set()
for file, source in zip(files, all_sources):
    if source in listed_sources:
        # Ignore already listed species
        continue
    bind_feature = None
    annot_seq = file.get_annotated_sequence(include_only=["Site"])
    # Find the feature for DNA-binding site
    for feature in annot_seq.annotation:
        # DNA binding site is a helix-turn-helix motif
        if "site_type" in feature.qual \
            and feature.qual["site_type"] == "DNA binding" \
            and "H-T-H motif" in feature.qual["note"]:
                bind_feature = feature
    if bind_feature is not None:
        # If the feature is found,
        # get the sequence slice that is defined by the feature...
        binding_sites.append(annot_seq[bind_feature])
        # ...and save the respective source species
        sources.append(source)
        listed_sources.add(source)
print("Binding sites:")
for site in binding_sites[:20]:
    print(site)

Out:

Binding sites:
IREIGDAVGLTSTSSVAHQLR
RAEIAAEFGFSSPNAAEEHLR
RAEIASQLGFRSPNAAEEHLK
IRDIQRELSISSTSVVAYNLR
VREIGEAVGLASSSTVHGHLD
RAEIARQLGFRSANAAEEHLK
IRDIAKHFKLTPRGAHIHVL
FDEMKDALDLASKSGIHRLIT
RAEIAQRLGFRSPNAAEEHLK
RAEIAQRLGFRSPNAAEEHLK
IRDIMKHFNFKSPRAAHKHLI
FDEMKDALDLASKSGIHRLIT
MREIGDTVGLASLSSVTHQLS
MREIGDTVGLASLSSVTHQLS
IREIGDAVGLTSTSSVAHQLR
RAEIAQRLGFRSPNAAEEHLK
IRDIAKHFKLTPRGAHIHVI
RAEIARRLGFKSANAAEEHLK
FDEMKLALDLRSKSGIHRLVT
RAEIAQKLGFKSANAAEEHLK

Now we can perform a multiple sequence alignment of the binding site sequences. Here we use Clustal Omega to perform this task. Since we have up to 200 sequences we visualize only a small portion of the alignment.

alignment = clustalo.ClustalOmegaApp.align(binding_sites)
fig = plt.figure(figsize=(4.5, 4.0))
ax = fig.add_subplot(111)
graphics.plot_alignment_similarity_based(
    ax, alignment[:,:20], labels=sources[:20], symbols_per_line=len(alignment)
)
# Source names in italic
ax.set_yticklabels(ax.get_yticklabels(), fontdict={"fontstyle":"italic"})
fig.tight_layout()
../../../_images/sphx_glr_lexa_conservation_001.png

Finally we can generate our sequence logo.

fig = plt.figure(figsize=(8.0, 3.0))
ax = fig.add_subplot(111)
graphics.plot_sequence_logo(ax, alignment)
ax.set_xticks([5,10,15,20])
ax.set_xlabel("Residue position")
ax.set_ylabel("Bits")
# Only show left and bottom spine
ax.spines["right"].set_visible(False)
ax.spines["top"].set_visible(False)
fig.tight_layout()

plt.show()
../../../_images/sphx_glr_lexa_conservation_002.png

Gallery generated by Sphinx-Gallery