Example

In this simple demonstration, you will see how to calculate ZBLMIp (Z score of the corrected MIp using BLOSUM62 pseudo frequencies) for a Pfam MSA from the Julia REPL or using a MIToS script in the system command line.

MIToS in the Julia REPL

If you load the Pfam module from MIToS, you will get access to a set of functions that work with Pfam MSAs. In this case, we are going to use it for download a Stockholm MSA from the Pfam website and read it into Julia.

using MIToS.Pfam
pfam_file = downloadpfam("PF10660")
msa = read(pfam_file, Stockholm, generatemapping=true, useidcoordinates=true)
AnnotatedMultipleSequenceAlignment with 2945 annotations : 1460×64 Named Matrix{MIToS.MSA.Residue}
               Seq ╲ Col │  31   34   35   36   37  …  131  132  133  134  135
─────────────────────────┼────────────────────────────────────────────────────
A0A6J2GEY2_9PASS/1-66    │   -    E    T    L    A  …    K    K    K    Q    Q
A0A8C3KFU0_9CHAR/9-41    │   -    -    -    -    -       K    D    K    C    -
A0A7L0V3R6_9PASE/2-65    │   -    E    T    L    A       K    K    K    Q    Q
A0A093IU04_EURHL/1-35    │   -    -    -    -    -       K    D    K    C    -
A0A3Q7NRL0_CALUR/33-66   │   -    -    -    -    -       K    D    H    R    -
A0A6J1N095_BICAN/1-63    │   M    Y    F    V    S       -    -    -    -    -
A0A3M6VAW2_9STRA/158-212 │   M    D    V    I    R       -    -    -    -    -
A0A2Y9E068_TRIMA/4-69    │   -    -    S    V    V       K    E    K    Q    Q
⋮                            ⋮    ⋮    ⋮    ⋮    ⋮  ⋱    ⋮    ⋮    ⋮    ⋮    ⋮
A0A2Y9ERJ5_PHYMC/9-44    │   -    -    -    -    -       K    D    H    R    -
A0A8J7NX18_ATRSP/1-66    │   M    E    S    I    A       K    K    K    K    Q
A0A8J6DWC9_GALPY/42-75   │   -    -    -    -    -       K    D    H    R    -
A0A851VZM3_9PASS/2-65    │   -    E    T    L    A       K    K    K    Q    Q
A0A673Z224_SALTR/1-66    │   -    E    T    I    S       K    K    K    K    Q
A0A2K6NC81_RHIRO/8-41    │   -    -    -    -    -       K    D    H    R    -
A0A1U7SIJ2_ALLSI/9-41    │   -    -    -    -    -       K    D    K    C    -
A0A7K6YXN8_ALCTO/2-65    │   -    E    S    L    A  …    K    K    K    Q    Q
Note

Generation of sequence and column mappings The keyword argument generatemapping of read allows to generate sequence and column mappings for the MSA. Column mapping is the map between of each column on the MSA object and the column number in the file. Sequence mappings will use the start and end coordinates in the sequence ids for enumerate each residue in the sequence if useidcoordinates is true.

You can plot this MSA and other MIToS’ objects using the Plots package. The installation of Plots is described in the Installation section of this site:

using Plots
gr()
plot(msa)

The Information module of MIToS has functions to calculate measures from the Information Theory, such as Entropy and Mutual Information (MI), on a MSA. In this example, we will estimate covariation between columns of the MSA with a corrected MI that use the BLOSUM62 matrix for calculate pseudo frequencies (BLMI).

using MIToS.Information
ZBLMIp, BLMIp = BLMI(msa)
ZBLMIp # shows ZBLMIp scores
34×34 Named PairwiseListMatrices.PairwiseListMatrix{Float64, false, Vector{Float64}}
Col1 ╲ Col2 │           69            71  …           133           134
────────────┼──────────────────────────────────────────────────────────
69          │          NaN     0.0187847  …    -0.0400174     0.0751738
71          │    0.0187847           NaN       -0.0156371     0.0757084
73          │   -0.0703755   -0.00120675        0.0499873      0.240234
87          │    0.0947926    -0.0277512        0.0710854      0.010113
93          │    0.0830297    0.00107993        0.0207184      0.114132
101         │   -0.0857542     0.0261214         0.192828      0.182264
102         │   -0.0097731    -0.0144705        0.0933455    -0.0692782
103         │   -0.0565818    -0.0106526        0.0172781      0.206432
⋮                        ⋮             ⋮  ⋱             ⋮             ⋮
127         │  -0.00154043    -0.0471998        -0.109796      0.047315
128         │   -0.0502531    -0.0185848         0.114124    -0.0532041
129         │   -0.0900014    -0.0340371        0.0926778     -0.134197
130         │   -0.0526828     -0.030231         -0.11243    -0.0981622
131         │  -0.00423369     0.0485606         0.223428     0.0267736
132         │   -0.0326339    -0.0224121        -0.105235     -0.128788
133         │   -0.0400174    -0.0156371              NaN     -0.130413
134         │    0.0751738     0.0757084  …     -0.130413           NaN

Once the Plots package is installed and loaded, you can use its capabilities to visualize this results:

heatmap(ZBLMIp, yflip=true, c=:grays)

MIToS in system command line

Calculate ZBLMIp on the system shell is easy using the MIToS script called BLMI.jl. This script reads a MSA file, and writes a file with the same base name of the input but with the .BLMI.csv extension.

BLMI.jl PF14972.stockholm.gz