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 775 annotations : 374×64 Named Array{MIToS.MSA.Residue,2}
               Seq ╲ Col │  32   35   36   37   38  …  103  104  105  106  107
─────────────────────────┼────────────────────────────────────────────────────
A0A1L8HM45_XENLA/102-167 │   M    E    S    L    A  …    K    K    K    Q    Q
A0A1U7SL63_ALLSI/2-36    │   -    -    -    -    -       K    D    K    C    -
A0A2I2Y8P5_GORGO/9-41    │   -    -    -    -    -       K    D    H    R    N
W5UKX1_ICTPU/1-66        │   -    E    T    I    S       K    R    K    K    -
A0A182JXL2_9DIPT/1-64    │   M    Q    L    L    S       E    A    R    -    -
F6TSD5_XENTR/1-66        │   M    E    S    I    A       K    K    K    Q    Q
A0A158NWR3_ATTCE/11-73   │   M    E    P    I    A       R    -    -    -    -
A0A1J1J3N7_9DIPT/1-64    │   M    E    L    I    S       A    S    -    -    -
A0A2I3LDM8_PAPAN/42-76   │   -    -    -    -    -       K    K    K    Q    Q
⋮                            ⋮    ⋮    ⋮    ⋮    ⋮  ⋱    ⋮    ⋮    ⋮    ⋮    ⋮
G1MRN1_MELGA/16-53       │   -    -    -    -    -       K    D    K    C    -
K7FIY0_PELSI/2-67        │   M    E    S    L    A       K    K    K    Q    Q
G3H4L8_CRIGR/2-34        │   -    -    -    -    -       K    E    N    R    -
G3SVU7_LOXAF/8-41        │   -    -    -    -    -       K    D    H    R    -
A0A1S3IS31_LINUN/1-64    │   M    E    T    V    S       S    K    K    K    -
A0A194RSG1_PAPMA/1-63    │   M    Y    F    V    S       -    -    -    -    -
A0A218UPM6_9PASE/1-66    │   -    E    T    L    A       K    K    K    Q    Q
H0VMN3_CAVPO/8-41        │   -    -    -    -    -       K    D    H    R    N
A0A1A6GRS4_NEOLE/34-94   │   -    -    -    -    -  …    K    D    N    R    -
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)
/juliateam/.julia/packages/GR/yMV3y/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

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
62×62 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}}
Col1 ╲ Col2 │           35            36  …           105           106
────────────┼──────────────────────────────────────────────────────────
35          │          NaN      0.033982  …       0.17656    -0.0625586
36          │     0.033982           NaN        0.0610301    -0.0844072
37          │   -0.0148921     0.0260339        0.0677671     -0.202049
38          │    0.0469206   -0.00465322        -0.074898     -0.139066
39          │    -0.105104     0.0621128       -0.0407143     -0.101803
40          │    0.0500429     0.0403362        -0.136159     -0.113605
41          │   -0.0131055    -0.0586416       -0.0855867     0.0546386
42          │     0.106349     -0.120882         0.176136     0.0390367
43          │   -0.0928302    -0.0236048        -0.251418     -0.185704
⋮                        ⋮             ⋮  ⋱             ⋮             ⋮
98          │     0.156346      0.204803         0.106572     -0.115258
99          │    0.0395525     0.0542566        0.0175123      0.239329
100         │     0.145884     0.0717013     -0.000523584     -0.114771
101         │   -0.0756336      0.151434        0.0622087    -0.0228497
102         │   -0.0134567     -0.125872         0.156037      0.208451
103         │    0.0928886     0.0376379         0.148312   -0.00905081
104         │   -0.0692767   -0.00746978        -0.117661     -0.074702
105         │      0.17656     0.0610301              NaN     -0.087107
106         │   -0.0625586    -0.0844072  …     -0.087107           NaN

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

heatmap(ZBLMIp, yflip=true, c=:grays)
/juliateam/.julia/packages/GR/yMV3y/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

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