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 1466 annotations : 719×64 Named Matrix{MIToS.MSA.Residue}
               Seq ╲ Col │  32   35   36   37   38  …  118  119  120  121  122
─────────────────────────┼────────────────────────────────────────────────────
A0A6J0DDZ6_PERMB/2-33    │   -    -    -    -    -  …    K    D    T    R    -
A0A2I2Y8P5_GORGO/9-41    │   -    -    -    -    -       K    D    H    R    N
A0A7F8QPX9_LEPWE/1-66    │   M    E    S    V    A       K    K    K    Q    Q
A0A670IAA5_PODMU/1-34    │   -    -    -    -    -       K    D    R    C    -
A0A7E4RSJ9_CIMLE/1-62    │   M    E    P    L    S       R    -    -    -    -
A0A158NWR3_ATTCE/11-73   │   M    E    P    I    A       R    -    -    -    -
V9KQ82_CALMI/5-38        │   -    -    -    -    -       K    D    K    -    -
A0A1J1J3N7_9DIPT/1-64    │   M    E    L    I    S       A    S    -    -    -
⋮                            ⋮    ⋮    ⋮    ⋮    ⋮  ⋱    ⋮    ⋮    ⋮    ⋮    ⋮
A0A2K6DQQ1_MACNE/2-41    │   -    -    -    -    -       K    D    N    R    -
G3H4L8_CRIGR/2-34        │   -    -    -    -    -       K    E    N    R    -
G3SVU7_LOXAF/8-41        │   -    -    -    -    -       K    D    H    R    -
A0A556V466_BAGYA/1-66    │   -    E    T    I    S       Q    R    K    K    Q
A0A6J1ZK04_ACIJB/104-137 │   -    -    -    -    -       K    D    H    R    N
A0A5J5MRP2_MUNRE/1-30    │   -    -    -    -    -       K    D    H    R    -
A0A6H5GFP8_9HEMI/1-64    │   M    E    P    V    H       K    L    -    -    -
A0A194RSG1_PAPMA/1-63    │   M    Y    F    V    S  …    -    -    -    -    -
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
63×63 Named PairwiseListMatrices.PairwiseListMatrix{Float64, false, Vector{Float64}}
Col1 ╲ Col2 │           35            36  …           121           122
────────────┼──────────────────────────────────────────────────────────
35          │          NaN     0.0152302  …     -0.118233     -0.269328
36          │    0.0152302           NaN       -0.0714544     -0.461383
37          │ -0.000231914    -0.0124914         -0.16393      -0.33895
38          │    0.0698622    -0.0649663        -0.147676     -0.445416
39          │   -0.0490184     0.0335722         0.145648     -0.560598
40          │    0.0107382     0.0142579       -0.0208477     -0.367126
41          │    0.0335858     -0.051551       -0.0324884     -0.222273
42          │     0.107276    -0.0864735        0.0367046     -0.341275
⋮                        ⋮             ⋮  ⋱             ⋮             ⋮
115         │     0.118716     0.0843843       -0.0514596     -0.360589
116         │    0.0230397      0.119255        -0.233083      0.247448
117         │    0.0187948    -0.0146096       -0.0498137      0.119784
118         │    0.0929403     0.0868281        0.0660246      -0.26746
119         │   -0.0944462     0.0670636       -0.0920289     -0.156323
120         │     0.247446      0.264518        -0.126332       0.17542
121         │    -0.118233    -0.0714544              NaN      0.178021
122         │    -0.269328     -0.461383  …      0.178021           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