Correlation network

Back to the index

BinderScriptNotebook

Correlation network

Summary: This tutorial demonstrates an example workflow using different FsLab libraries. The aim is to create a correlation network, finding a threshold for which to filter and visualizing the result.

Introduction

Networks provide a mathematical representation of connections found everywhere, e.g. computers connected through the internet, friends connected by friendships or animals connected in the food web. This mathematical representation allows for many different, but universal approaches for creating, manipulating and interrogating these networks for new information. E.g. the most important nodes (or vertices) can be identified for different metrics or the most efficient connection between two nodes can be found.

One widely used kind of network in biology is the gene co-expression network. Here the nodes are genes and the edges (or links) between them are how similar their expression patterns are. One measure for this similarity is the correlation between the expression patterns. This kind of network is often used for finding interesting candidates, by identifying genes which are highly connected with known genes of interest.

In this tutorial, a simple workflow will be presented for how to create and visualize a correlation network from experimental gene expression data. For this, 4 FsLab libraries will be used:

  1. FSharp.Data for retreiving the data file
  2. Deedle for reading a frame containing the data
  3. & 3. FSharp.Stats to calculate correlations and finding a critical threshold
  4. CyJS.NET to visualize the results

Referencing packages

#r "nuget: FSharp.Data"
#r "nuget: Deedle"
#r "nuget: FSharp.Stats"
#r "nuget: Cyjs.NET"
#r "nuget: Plotly.NET, 2.0.0-preview.16"

do fsi.AddPrinter(fun (printer:Deedle.Internal.IFsiFormattable) -> "\n" + (printer.Format()))

// The edge filtering method presented in this tutorial requires an Eigenvalue decomposition. 
// FSharp.Stats uses the one implemented in the LAPACK library. 
// To enable it just reference the lapack folder in the FSharp.Stats nuget package:
FSharp.Stats.ServiceLocator.setEnvironmentPathVariable @"C:\Users\USERNAME\.nuget\packages\fsharp.stats\0.4.2\netlib_LAPACK" // 
FSharp.Stats.Algebra.LinearAlgebra.Service()

Loading Data

In this tutorial, an multi experiment ecoli gene expression dataset is used.

FSharp.Data and Deedle are used to load the data into the fsi.

open FSharp.Data
open Deedle

// Load the data 
let rawData = Http.RequestString @"https://raw.githubusercontent.com/HLWeil/datasets/main/data/ecoliGeneExpression.tsv"

// Create a deedle frame and index the rows with the values of the "Key" column.
let rawFrame : Frame<string,string> = 
    Frame.ReadCsvString(rawData, separators = "\t")
    |> Frame.take 500
    |> Frame.indexRows "Key"
Experiment 1 Experiment 2 Experiment 3 Experiment 4 Experiment 5 Experiment 6 Experiment 7 Experiment 8 Experiment 9 Experiment 10 Experiment 11 Experiment 12 Experiment 13 Experiment 14 Experiment 15 Experiment 16 Experiment 17 Experiment 18 Experiment 19 Experiment 20 Experiment 21 Experiment 22 Experiment 23 Experiment 24 Experiment 25 Experiment 26 Experiment 27 Experiment 28 Experiment 29 Experiment 30 Experiment 31 Experiment 32 Experiment 33 Experiment 34 Experiment 35 Experiment 36 Experiment 37 Experiment 38 Experiment 39 Experiment 40 Experiment 41 Experiment 42 Experiment 43 Experiment 44 Experiment 45 Experiment 46 Experiment 47 Experiment 48 Experiment 49 Experiment 50 Experiment 51 Experiment 52 Experiment 53 Experiment 54 Experiment 55 Experiment 56 Experiment 57 Experiment 58 Experiment 59 Experiment 60 Experiment 61 Experiment 62 Experiment 63 Experiment 64 Experiment 65 Experiment 66 Experiment 67 Experiment 68 Experiment 69 Experiment 70 Experiment 71 Experiment 72 Experiment 73 Experiment 74 Experiment 75 Experiment 76 Experiment 77 Experiment 78 Experiment 79 Experiment 80 Experiment 81 Experiment 82 Experiment 83 Experiment 84 Experiment 85 Experiment 86 Experiment 87 Experiment 88 Experiment 89 Experiment 90 Experiment 91 Experiment 92 Experiment 93 Experiment 94 Experiment 95 Experiment 96 Experiment 97 Experiment 98 Experiment 99 Experiment 100 
aaaD -> 8.7403       8.8469       8.3556       9.0198       8.2195       8.5214       8.8665       8.9684       10.28        10.207        9.6653        9.4018        9.9822        9.5593        10.025        10.314        8.8058        9.216         8.8786        9.374         8.7961        8.6027        9.1494        9.6799        9.4734        9.8054        9.3825        9.572         9.5872        9.4818        9.7351        9.9104        9.8825        9.8388        10.074        9.8766        10.111        9.9237        9.6769        10.178        8.4325        8.8137        8.6792        9.0459        8.5924        8.5217        8.5352        8.7164        8.8901        9.1343        8.9131        8.6791        8.7762        8.7845        10.141        8.5288        8.7076        8.9782        8.9743        8.6927        8.4909        8.8959        8.5862        8.9517        8.7227        8.7613        8.9802        9.0819        8.5687        8.8032        8.9306        8.3246        8.1602        8.4776        8.7221        8.5315        9.0223        8.6632        8.5102        8.5842        8.9837        8.8833        8.8939        8.7003        10.067        9.8134        9.9516        9.3918        9.4991        9.3207        9.6911        9.8489        9.4097        9.4598        9.2216        9.6793        9.4675        9.8867        10.045        11.012         
aaeA -> 7.0589       7.1711       7.2008       7.1589       7.5049       7.4675       7.2379       7.2005       7.2297       7.1829        7.449         7.4464        7.3047        7.5369        7.4119        7.6157        6.9814        7.0507        7.156         7.0658        7.2135        7.1949        7.1441        7.1959        7.2561        7.4855        7.4671        7.5295        7.0548        7.1618        7.0146        7.2357        7.324         7.1425        7.3485        7.2607        7.4429        7.7246        7.5778        7.7529        7.1725        7.3588        7.3275        7.3767        7.2866        7.2824        7.1522        7.0884        7.2585        7.4357        7.241         7.2263        7.3194        7.2165        7.251         7.1954        7.3168        7.3683        7.2474        7.2744        7.2762        7.5282        7.3534        7.2551        7.2004        7.3192        7.2837        7.2785        7.1157        7.1603        7.2468        7.1813        7.4621        7.0632        7.4068        7.3475        7.1324        7.2157        7.3373        7.3213        7.2119        7.206         7.1513        7.185         7.2555        7.4717        7.1444        7.2543        7.2099        7.3204        7.0904        7.3994        7.2171        7.0814        7.244         7.2609        7.2706        7.3108        7.375         6.7935         
aaeB -> 7.4173       7.3986       7.1736       7.3191       7.5813       7.3047       7.6113       7.3595       7.9475       7.9144        7.5489        7.7997        7.6134        7.8531        7.7954        7.7181        7.1719        7.2559        7.1492        7.3923        7.3251        7.3897        7.4374        7.4898        7.4522        7.5799        7.4951        7.5262        7.5952        7.7033        7.5834        7.5042        7.6921        7.4809        7.7783        7.6414        7.6672        8.0217        7.7517        7.9059        7.15          7.3739        7.4816        7.3046        7.1392        7.1406        7.1002        7.1349        7.3122        7.425         7.1462        7.2458        7.2367        7.2551        7.3723        7.0885        7.1448        7.1407        7.3713        7.1898        7.1649        7.1725        7.256         7.1785        7.0441        7.3492        7.3023        7.3515        7.2234        7.2689        7.2914        7.1566        7.1891        7.1499        7.3749        7.3148        7.2227        7.3412        7.2701        7.2454        7.2395        7.3228        7.2942        7.9062        7.3415        7.5577        7.4225        7.5802        7.3571        7.4911        7.4655        7.4057        7.4278        7.4367        7.5142        7.2103        7.732         7.4449        7.4341        7.5374         
aaeR -> 8.0576       8.1918       8.0364       8.0045       8.5048       8.277        8.465        8.3984       7.8496       7.6872        7.9313        7.7064        8.022         8.0522        7.9305        8.0049        7.7522        7.9729        7.7523        7.8046        7.6915        7.8825        7.9494        8.0126        7.9686        7.4444        7.4286        7.5915        7.3934        7.5271        7.5063        7.3838        7.6277        7.3663        7.5509        7.4389        7.5199        7.7755        7.6294        7.6546        8.3483        8.2671        8.362         8.3602        8.3773        8.4397        8.2529        8.07          8.1709        8.2565        8.1877        8.249         8.0928        8.1849        8.025         8.5457        8.5253        8.3447        8.3656        8.4928        8.377         8.5643        8.5476        8.4467        8.418         8.2483        8.29          8.3991        8.1789        8.0434        8.1042        8.1977        8.3536        8.0629        8.3399        8.2949        8.3725        8.2472        8.3456        8.5171        8.122         8.168         8.1922        7.601         7.6623        7.5667        7.5846        7.6948        7.7186        7.8512        7.7622        7.7229        7.7898        7.6285        7.4006        7.3119        7.6809        7.3307        7.3603        7.5066         
aaeX -> 7.3382       7.3449       7.1555       7.1024       7.3574       7.4066       7.2973       7.1253       6.9725       7.1539        6.8478        6.5223        6.8957        6.9896        7.2709        7.5293        7.0975        6.9918        6.9908        7.0035        6.7935        7.0792        7.2312        7.2493        7.2383        7.3982        7.3175        7.3355        7.1725        7.1637        7.148         7.1256        7.3427        6.9016        7.4027        7.3037        7.644         7.8393        7.695         7.9768        7.0432        7.0702        6.9207        6.8466        6.8945        6.9435        6.8408        6.9159        6.9034        7.0282        7.151         6.9611        6.7511        6.842         6.7549        6.9112        7.1283        6.9449        7.1624        7.1074        6.9478        7.0549        6.9339        7.0693        7.1608        6.9535        6.9273        7.0708        6.9345        6.8339        6.8987        6.9556        6.9443        6.9248        6.947         6.8583        6.9557        6.89          6.9389        7.0289        6.9525        6.9988        6.9434        7.4167        7.1833        7.3744        7.5707        7.4668        7.2673        7.2288        7.2635        7.2405        7.2865        7.3745        7.6165        7.1936        6.991         7.4946        7.0109        6.9528         
aas  -> 8.9674       8.82         8.8394       8.8963       9.0384       9.0632       9.577        9.4733       9.1953       9.1999        9.1657        9.3002        9.0099        9.1196        8.8182        9.1212        9.2366        9.0129        9.2762        9.4587        9.6053        9.5009        9.1225        9.1303        9.0564        8.7746        8.7053        8.8717        8.7745        8.9207        8.7791        8.6986        8.8274        8.6982        8.8145        8.4743        8.8816        8.6748        8.7917        8.8013        9.0734        9.075         9.285         9.0119        9.1232        9.144         8.8574        8.9111        9.0989        9.1304        9.0707        9.0413        9.3217        9.3092        9.3026        9.0192        9.0773        9.2096        9.1267        8.9519        8.8755        9.0659        9.0536        9.0565        8.9101        9.2376        9.1636        9.2379        9.0871        9.0145        9.0319        9.0934        9.2124        9.039         9.304         9.2438        9.2051        9.1783        9.3148        9.3312        9.0278        9.0552        9.0986        8.9671        8.9103        8.9556        9.2688        8.9818        9.0045        8.8513        8.937         8.9412        9.0232        9.0064        8.9551        8.8555        9.1497        8.8771        8.9965        9.0505         
aat  -> 8.7275       8.9228       8.4823       8.7624       8.4134       8.3183       8.4104       8.4186       8.7375       8.4563        8.8195        8.7878        8.5476        8.6308        8.2966        8.595         8.7467        8.6181        8.8394        8.5376        8.5331        8.2687        9.1016        8.8591        8.6591        8.9036        8.7139        9.0981        8.5944        8.6597        8.6324        8.5315        8.4197        8.4476        8.6701        8.565         8.4885        8.2984        8.5637        8.6731        9.2723        9.3034        9.3479        9.4267        9.3986        9.3682        9.0776        9.0245        9.0174        9.4404        9.5582        9.5311        9.1444        9.2192        9.2748        9.4005        9.3768        9.3393        9.3899        9.3707        9.3159        9.3482        9.1003        9.4111        9.0962        8.9913        9.1571        9.2963        9.0393        9.0649        9.0557        9.0768        9.0075        9.0036        9.3106        9.1676        9.1862        9.3189        9.2003        9.3441        9.0771        9.1537        9.1702        8.3672        8.6785        8.7746        8.7676        8.5847        8.5679        8.7755        8.6776        8.5905        8.5212        8.597         8.3214        8.1751        8.678         8.1974        8.4102        8.9682         
abgA -> 6.2591       6.7156       6.4176       6.6005       6.5508       6.4399       7.4999       7.4124       8.7198       8.712         8.1386        7.7545        8.3342        8.544         8.3834        8.6857        8.1756        8.1066        8.2162        8.1514        8.0582        8.1415        8.4585        8.4037        8.1801        8.5637        8.5484        8.9803        8.5915        8.8472        8.7377        8.6551        8.5756        8.6541        8.9167        8.7386        8.5252        8.684         8.6332        8.6426        8.2649        8.5016        8.5253        8.4148        8.1032        8.2561        8.1331        8.0907        8.3129        8.4624        8.175         8.2792        8.2648        8.3155        8.5705        8.0332        8.1069        8.2531        8.3608        8.0677        8.2679        8.3621        8.2406        8.2922        8.0075        8.4744        8.4255        8.3124        8.2142        8.241         8.2168        8.1706        8.1569        8.09          8.3281        8.1949        8.2115        8.565         8.4575        8.3113        8.2486        8.3888        8.2844        8.4448        8.5198        8.8204        8.444         8.5221        8.6901        8.6173        8.5404        8.4756        8.5889        8.9259        8.3039        8.3724        8.7183        8.0978        8.4088        8.9106         
abgB -> 5.3568       5.948        5.594        5.7902       5.9431       5.5494       6.3974       6.4422       7.9315       7.8462        7.3717        6.9463        7.5198        7.631         7.6545        7.9165        7.4722        7.4083        7.645         7.632         7.4166        7.5987        7.7252        7.6608        7.3773        7.8937        7.7006        8.0024        7.7666        7.985         7.8408        7.6776        7.7999        7.7783        7.8657        7.9326        7.7081        7.6733        7.9304        7.8926        7.8057        7.9433        8.0172        7.677         7.4825        7.6811        7.5692        7.627         7.7184        7.9741        7.6148        7.7202        7.5573        7.6331        7.8052        7.4154        7.5291        7.6454        7.8592        7.6181        7.7262        7.7999        7.7998        7.6281        7.5711        7.9033        7.8066        7.8268        7.6237        7.6771        7.7938        7.7324        7.6803        7.549         7.685         7.615         7.587         7.9755        7.8987        7.7505        7.7259        7.8859        7.6662        7.954         8.0556        8.3435        7.852         7.8014        8.1138        8.0037        8.2615        7.8193        8.1248        8.3476        7.5826        7.7023        8.028         7.4692        8.0481        8.1532         
abgR -> 5.4472       5.7164       5.426        5.6067       5.6252       5.3856       6.2326       6.2815       7.5872       7.5729        7.2276        6.9218        7.3393        7.5506        7.3356        7.5121        7.1647        7.1717        7.323         7.2549        7.1623        7.3406        7.5006        7.4558        7.2637        7.4612        7.6444        7.5183        7.23          7.7225        7.3337        7.5251        7.1433        7.2842        7.4355        7.5459        7.5124        7.4424        7.3916        7.2941        7.738         7.8287        7.9477        7.5669        7.4845        7.624         7.633         7.495         7.6231        7.6751        7.6318        7.5651        7.5641        7.6095        7.6841        7.4686        7.5247        7.6641        7.7072        7.5029        7.6261        7.6903        7.8196        7.6729        7.4904        7.8087        7.6309        7.6099        7.6068        7.5926        7.6056        7.5257        7.488         7.3782        7.5879        7.5857        7.4951        7.9527        7.7873        7.7204        7.6048        7.6274        7.5627        7.6133        7.8139        7.9484        7.8767        7.6203        7.9971        7.9379        8.0777        7.7026        8.3853        8.3757        7.4826        7.6132        7.7626        7.4586        8.1314        7.9875         
abgT -> 5.3345       5.6817       5.3583       5.555        5.5544       5.3158       6.168        6.1354       6.976        6.9288        6.6245        6.2864        6.7658        6.9014        6.7013        6.872         6.8526        6.6821        6.8298        6.9274        6.6536        6.9168        6.9317        6.8059        6.6692        7.2578        6.8104        7.0717        6.8583        7.2805        7.2241        6.9531        6.8049        6.881         7.0246        6.9833        6.8566        6.8978        6.8111        6.8851        7.1118        7.2042        7.2476        6.9545        6.9776        7.1036        6.9138        6.9392        7.0181        7.1296        6.8801        6.8921        6.8987        7.0764        7.0852        6.7936        6.8231        6.9624        7.0709        6.8531        6.9046        7.0781        6.8337        6.9983        6.9515        7.1673        6.9884        7.0342        6.5981        6.9594        7.0184        6.8415        6.8342        6.7323        6.9834        6.9323        6.9222        7.0732        7.0721        7.0666        7.0504        7.0788        6.9133        7.9496        7.585         7.7154        7.4041        7.869         7.4785        7.4725        7.5628        7.3482        7.6986        7.6998        7.9348        8.1634        7.8764        7.9597        8.4801        7.7649         
abrB -> 8.0422       8.0509       7.554        8.1425       7.7775       7.9803       7.635        7.5918       8.4968       8.449         8.0495        8.1489        8.4314        8.3005        8.3836        8.4243        7.905         8.0318        8.058         8.0688        7.7956        7.8486        8.2226        8.2677        8.2101        8.513         8.3874        8.4748        8.1979        8.1317        8.1885        8.1758        8.024         8.3078        8.3986        8.5099        8.2908        8.2588        8.0499        8.4373        7.9958        8.1594        8.1452        8.4109        8.3544        8.4286        8.1746        8.151         8.0538        8.1479        8.0247        7.9559        7.8192        7.8612        8.0155        8.2457        8.2577        8.4745        8.2733        8.2049        8.1238        8.3853        8.4123        8.6003        8.2767        7.9883        7.9232        8.07          7.9986        7.9985        8.0544        7.9482        7.8487        7.8397        7.9655        7.9561        8.0258        7.9169        7.7976        7.7637        7.8862        7.8742        8.1188        8.4747        8.4193        8.3887        8.2176        8.2413        8.3945        8.172         8.1929        8.4042        8.4395        8.3435        8.2485        8.3057        8.1748        8.2677        8.2985        8.8892         
accA -> 9.1185       9.3889       8.9416       9.244        8.6996       8.6716       9.5994       9.5893       9.6008       9.146         9.8922        9.3598        10.151        9.5864        9.8378        9.7268        10.259        10.079        10.343        10.112        9.9142        9.717         10.207        10.375        10.104        9.656         9.4886        9.6385        9.7032        9.716         9.5688        9.6771        9.3954        9.537         9.6355        9.5704        9.6132        9.0598        9.5484        9.5079        10.323        10.118        10.251        10.181        10.152        10.273        10.07         9.9348        9.8131        10.022        10.234        10.109        9.7624        9.7752        9.9534        10.184        9.9858        10.098        10.204        10.086        10.088        9.9271        9.7924        10.449        9.9891        9.8674        10.058        9.9628        10.212        10.104        10.009        10.001        9.7371        10.084        9.9463        9.9224        9.9284        9.9276        9.7378        9.6881        10.039        10.164        10.186        10.13         9.8781        10.028        10.484        10.169        9.7833        10.282        9.6447        9.602         10.045        9.7773        9.9188        9.8081        9.5524        9.2791        9.4347        9.1921         
accB -> 10.376       10.188       10.644       10.88        10.954       10.641       11.115       11.165       10.218       10.286        11.117        11.086        11.074        10.932        10.819        10.662        12.084        12.254        11.757        11.659        11.685        11.796        12.335        12.316        12.289        11.961        12.152        12.046        12.204        12.255        12.155        12.046        12.257        12.149        11.721        11.702        11.713        11.614        11.476        11.546        11.347        11.537        11.038        11.707        11.66         11.53         11.317        11.282        11.16         11.235        11.436        11.431        11.162        10.817        11.102        11.551        11.619        11.486        11.34         11.478        11.435        11.629        11.643        11.513        11.521        11.426        11.464        10.986        11.371        11.649        11.322        11.391        11.647        11.276        11.465        11.56         11.478        11.259        11.196        11.24         11.446        11.409        11.63         11.817        11.458        11.291        11.334        11.293        11.244        11.103        10.83         11.053        11.066        11.056        10.796        11.2          10.654        9.1654        9.3768        9.4153         
accC -> 8.982        8.8691       9.0523       9.4          9.3146       9.1512       9.7175       9.8997       9.2565       9.2726        9.6847        9.6086        9.775         9.5028        9.5858        9.4892        10.809        10.703        10.335        10.437        10.297        10.711        11.293        11.445        11.346        10.772        10.876        10.501        10.97         10.99         10.748        10.722        10.904        10.834        10.355        10.43         10.584        10.242        10.089        10.093        10.523        10.276        9.9449        10.514        10.561        10.468        10.259        10.108        10.041        9.9875        10.308        10.317        9.9513        9.5006        9.8601        10.442        10.397        10.389        10.313        10.436        10.358        10.197        10.436        10.422        10.401        10.427        10.469        9.9567        10.414        10.629        10.256        10.377        10.376        10.476        10.473        10.53         10.566        10.24         10.218        10.36         10.496        10.229        10.648        10.792        10.53         10.356        10.585        10.37         9.8603        10.145        9.5158        9.5704        9.7467        9.5214        10.538        10.823        10.354        10.164        10.131        8.7451         
:       ...          ...          ...          ...          ...          ...          ...          ...          ...          ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...           ...            
dedD -> 9.5024       9.5755       9.4624       9.8732       9.8316       9.4295       9.8188       9.7116       9.6909       10.083        9.803         10.1          10.302        10.251        9.8592        9.8891        10.171        10.133        10.214        10.198        10.181        10.201        10.278        10.442        10.367        10.138        10.302        10.283        9.7745        9.8404        9.8933        9.8794        9.9015        9.9643        9.8931        9.6429        9.9445        9.963         9.8991        9.9736        9.8126        9.8358        9.5767        10.122        10.157        10.048        9.9203        9.8639        9.9461        9.8871        9.8839        9.8639        9.7193        9.7908        9.9309        10.075        9.9623        10.032        10.089        10.01         9.962         9.8459        9.9005        10.052        10.229        9.9053        9.8933        9.9586        9.9664        9.9376        9.867         9.7376        9.7117        9.5769        9.9172        9.8797        9.988         9.8302        9.8523        9.8408        9.9198        9.8587        9.9371        9.996         9.9597        10.045        9.8391        10.007        9.887         9.8975        9.9676        10.105        9.8552        9.8402        9.9161        9.7981        9.9774        10.028        10.193        10.349         
def  -> 11.213       11.619       11.531       11.573       11.977       11.568       12.03        12.035       10.761       10.679        11.553        11.447        11.33         11.475        11.757        11.879        10.933        10.859        11.063        10.848        10.876        10.775        11.283        11.185        11.22         10.058        10.332        9.8946        10.71         10.725        10.702        10.761        10.923        10.765        10.793        10.773        10.767        10.693        10.777        10.666        10.946        10.805        10.7          10.611        10.778        10.767        10.669        10.617        10.494        11.014        10.771        10.735        10.916        11.054        10.87         10.726        10.678        10.801        10.62         10.745        10.54         10.642        10.875        10.668        10.608        10.836        10.656        10.613        10.859        10.607        10.784        10.875        11.063        10.762        10.971        10.906        10.732        10.732        10.839        10.94         10.781        10.769        10.712        10.458        10.538        10.361        10.222        10.101        10.384        10.32         10.359        10.373        10.575        10.48         9.9333        10.097        10.593        10.418        10.562        10.308         
degP -> 8.2937       8.6722       8.2912       8.4648       8.8169       8.3292       8.7461       8.8093       9.4557       9.3148        9.3993        9.4411        9.4107        9.5607        9.6446        9.3786        9.4442        9.5941        9.2835        9.0203        8.9406        9.316         9.0587        9.0398        9.0818        9.2637        9.2447        9.0475        8.5269        8.9057        8.7295        8.8338        8.9468        8.9104        9.0332        8.9229        9.0405        9.1296        8.8991        9.0675        9.129         9.1485        9.3126        9.2571        9.1344        9.2361        8.9411        9.5411        9.1063        9.1515        9.198         9.1502        8.797         9.1198        9.1415        9.094         9.0417        9.1749        9.1493        8.7703        9.438         8.9813        9.1261        9.5267        9.2085        9.3058        9.1488        9.3527        8.8207        8.9938        8.7164        8.9147        9.0263        8.9304        9.2257        9.2015        9.4268        9.3255        9.2007        9.1927        8.9999        9.054         9.0067        9.3635        9.2882        9.3047        9.1952        9.0521        9.0648        9.2364        9.2745        8.9974        9.2563        9.2401        9.0211        8.9885        8.9366        8.905         9.3245        9.2995         
degQ -> 8.2983       8.4881       8.5007       8.7082       8.905        8.4069       9.0671       8.9586       9.1891       9.2792        9.273         9.4383        9.3196        9.532         9.3392        9.3341        9.1365        9.256         9.2528        9.3825        9.3067        9.4064        9.0629        9.046         9.1044        9.0851        8.9167        8.9273        9.001         9.0225        9.1212        9.0596        9.0961        8.9836        8.941         8.9629        8.8474        9.1123        9.0574        9.1436        9.3692        9.418         9.5419        9.3932        9.3242        9.2876        9.2668        9.3498        9.3915        9.3971        9.3249        9.3302        9.4944        9.5766        9.4944        9.3645        9.3591        9.3285        9.3373        9.3004        9.3929        9.3016        9.3632        9.306         9.2617        9.4202        9.3729        9.692         9.3144        9.2797        9.377         9.3983        9.4679        9.3868        9.5349        9.4581        9.3379        9.46          9.5048        9.5502        9.2648        9.3368        9.3953        8.9677        8.9669        9.0017        9.0416        9.1568        9.1159        9.1953        9.0502        8.9491        9.3877        9.0134        8.7025        8.6314        8.8985        8.9563        8.7639        9.2588         
degS -> 9.0413       9.2217       8.7957       9.0279       9.1286       8.9816       8.9573       8.9421       8.9553       8.7229        8.7541        9.0612        8.6478        8.9071        9.0228        9.0511        8.8493        8.8518        8.9802        8.7454        8.7859        8.8437        8.8806        8.7184        8.7259        8.1958        8.1782        8.0176        8.1113        8.1858        8.1497        7.9164        8.4561        8.2819        8.0278        8.1627        7.9818        8.3361        8.0142        8.0484        8.8202        8.9362        8.8967        9.2439        9.2883        9.2407        8.914         8.7815        8.7782        8.9103        9.0057        8.9495        8.8815        8.8845        8.9231        9.1595        9.1255        9.1386        8.9658        9.0516        9.0473        9.1143        8.8944        9.1129        9.0911        8.9322        8.8505        8.8321        8.8787        8.7998        8.8861        8.7375        8.9842        8.6975        8.9352        8.997         8.8282        8.8068        8.7841        8.8218        8.8265        8.7047        8.8952        8.8552        9.041         9.1288        8.9529        9.2218        8.954         8.8292        8.8533        8.6017        8.9124        8.877         9.1367        9.0936        9.2403        8.5336        8.6187        9.0856         
deoA -> 9.7066       9.7965       10.073       10.672       10.667       9.4078       11.109       11.045       10.149       10.143        9.303         9.6348        9.9223        10.038        9.9901        9.8813        9.3742        9.6204        9.4858        9.5424        9.6242        9.648         9.5426        9.4164        9.881         10.739        10.804        10.437        10.95         10.709        10.665        11.028        10.91         10.666        10.558        10.746        10.597        10.363        10.345        10.194        9.3713        9.325         9.3795        8.9889        8.9562        8.9542        9.6639        9.7006        9.9118        10.349        9.9181        9.7569        10.59         10.377        10.768        9.3692        9.4895        9.0317        9.111         9.2333        9.2116        9.6397        9.709         9.0657        9.1138        9.4612        9.4947        10.144        9.222         9.3509        9.2828        9.4136        9.6814        9.6203        9.4346        9.4154        9.255         9.5903        9.729         9.6542        9.4484        9.418         9.5634        8.3886        8.1636        8.4468        8.3485        8.3903        8.4928        8.312         9.1951        9.0643        8.9683        8.9427        8.1017        8.159         8.0514        8.5019        8.4803        9.4515         
deoB -> 9.7092       10.279       10.504       10.619       11.004       9.8914       11.739       11.431       10.899       11.155        10.056        10.159        10.569        10.585        10.83         10.519        10.378        10.45         10.512        10.363        10.52         10.464        11.498        11.483        11.528        12.023        12.07         11.923        11.787        11.708        11.619        11.724        11.689        11.37         11.205        11.492        11.256        11.189        11.147        11.167        10.131        10.032        10.115        10.02         9.8415        9.7292        10.292        10.266        10.59         10.992        10.513        10.62         11.282        11.082        11.421        10.129        10.167        9.8588        9.8972        9.9872        9.9506        10.321        10.491        9.8297        9.8161        10.149        10.228        10.832        10.015        9.9768        9.9935        10.032        10.248        10.063        10.221        10.212        10.086        10.286        10.434        10.364        10.099        9.9502        10.265        9.535         8.9902        8.6247        8.9836        9.2425        9.3097        9.3425        9.7856        9.5233        9.5468        9.4798        9.1981        9.1434        8.6526        8.9846        9.1509        8.9103         
deoC -> 10.054       10.216       10.437       10.462       10.82        9.8591       11.669       11.31        10.426       10.246        9.8698        10.267        10.195        10.023        10.237        10.108        9.5444        9.632         9.5135        8.6331        8.616         8.7676        10.761        10.795        10.926        10.494        10.524        10.354        11.042        11.113        11.021        11.155        11.242        10.924        10.97         10.975        10.774        10.839        10.82         10.759        9.3322        9.3396        9.4089        9.1825        9.0678        9.1912        9.1279        9.13          9.2522        9.5402        9.3578        9.3988        9.6774        9.7835        9.6182        9.2129        9.3379        9.2295        9.1387        9.2693        9.1505        9.5077        9.5598        9.0679        9.012         9.4322        9.3327        9.7511        9.0738        9.2162        9.0764        9.2973        9.4391        9.3559        9.3588        9.3789        9.204         9.3784        9.5494        9.462         9.1847        9.2406        9.3896        8.5791        8.453         8.5597        8.4662        8.501         8.2407        8.3778        8.3805        8.462         8.5575        8.4635        8.1676        8.2947        7.8615        8.3135        8.3939        8.6089         
deoD -> 11.674       11.725       11.725       11.82        11.91        11.497       12.447       12.382       12.116       12.156        11.361        11.728        11.515        11.636        11.902        11.485        11.254        11.404        11.281        11.236        11.27         11.507        12.102        12.197        12.148        12.563        12.473        12.288        12.137        12.081        11.975        11.952        12.113        11.782        11.778        11.905        11.927        11.722        11.82         11.547        10.91         10.681        10.888        10.69         10.679        10.446        10.731        10.651        10.92         11.179        10.878        10.807        11.511        11.451        11.579        10.713        10.669        10.621        10.704        10.676        10.732        10.326        10.598        10.543        10.591        11.014        10.932        11.366        10.848        10.956        10.743        10.801        11.061        11.018        11.099        10.978        11            10.992        11.234        11.209        10.964        10.806        11.02         10.148        9.7241        9.3153        9.9288        9.9604        9.9602        10.243        10.103        9.725         10.161        10.084        9.7363        9.7953        9.4167        9.4223        9.3464        9.3729         
deoR -> 8.0402       8.3487       7.8917       8.3284       7.4369       7.7858       7.8444       7.9689       7.9024       7.8145        7.965         7.8452        7.7252        7.6752        7.7578        7.7771        8.2954        8.0909        8.3722        8.043         8.0093        7.9017        8.5716        8.4204        8.3489        8.5522        8.4737        8.6448        8.8644        8.8129        8.7822        8.7084        8.7415        8.7377        8.814         8.6406        8.7515        8.7626        8.8264        8.7938        8.6468        8.6348        8.5439        8.8714        8.6136        8.8907        8.4985        8.4383        8.3934        8.5449        8.6736        8.5528        8.437         8.5077        8.4558        8.8284        8.8005        8.687         8.6658        8.6868        8.5909        8.6959        8.81          8.8941        8.7089        8.3293        8.4381        8.5347        8.4444        8.385         8.4382        8.3781        8.2674        8.3148        8.5012        8.3637        8.5683        8.5148        8.2972        8.4706        8.3522        8.3244        8.4245        8.5736        8.2219        8.3463        8.4094        8.4903        8.4309        8.5025        8.1821        8.2654        8.4702        8.2492        8.1189        7.9555        8.2036        7.9193        7.7584        8.3244         
der  -> 7.4137       7.6116       7.5166       8.1299       7.8227       7.3976       8.0241       8.272        8.3111       8.1164        8.4403        8.1058        8.6487        8.7943        8.6567        8.4449        8.6333        8.6737        8.5994        8.6412        8.6518        8.6694        9.1453        9.5336        9.2305        8.4128        8.4521        8.4712        8.238         8.1733        8.4342        8.304         8.0867        8.2462        8.3096        8.2492        8.2233        8.2274        8.1316        8.1531        8.9292        8.8481        8.4712        8.7174        8.7612        8.7759        8.7951        8.7601        8.7402        8.9026        8.8298        8.7383        8.9255        8.9208        8.8954        8.7733        8.7907        8.8396        8.7087        8.8182        8.9044        8.7316        8.8705        8.724         8.816         8.6108        8.8237        8.956         8.6583        8.8417        8.7032        8.7981        8.8903        8.7927        8.817         8.813         8.6405        8.8751        8.826         8.9517        8.738         8.6949        8.9712        9.0306        8.9384        8.5064        8.5803        8.5252        8.9009        8.5278        9.0314        8.6637        8.7866        8.988         8.4644        8.4419        8.6255        8.9117        8.882         8.6596         
dfp  -> 9.3691       9.4533       9.9728       10.069       9.5778       9.6715       10.082       10.553       10.296       10.246        9.6227        9.9242        11.261        10.661        11.139        10.458        10.606        10.777        10.256        10.1          10.123        10.062        10.732        10.739        10.739        11.552        11.558        11.435        11.73         11.872        11.842        11.483        11.719        11.545        11.069        10.959        11.187        10.919        10.863        10.893        9.9038        9.8567        9.7316        10.271        10.275        10.439        9.9805        9.8256        9.6284        9.383         10.048        9.9495        10.096        10.009        9.6406        10.117        9.9953        10.32         9.8336        10.185        10.015        9.8881        9.884         10.152        10.184        10.061        9.9186        9.909         10.141        10.167        10.22         9.9694        10.406        10.017        10.073        10.374        10.034        9.9409        9.8807        10.045        10.155        9.9756        10.167        10.421        10.067        10.053        10.257        10.292        10.209        10.083        9.7655        9.9158        9.7938        9.883         9.9004        10.227        9.7847        9.5157        9.4999        9.2807         
dgkA -> 9.7213       9.6086       9.686        9.8818       9.9385       9.8997       10.027       10.091       8.2823       8.2223        9.3693        9.3463        8.8505        9.0855        8.9847        8.7071        9.6267        9.6392        9.509         9.3996        9.778         9.6332        9.264         9.1717        9.2401        8.1482        8.0152        7.9983        8.3907        8.1864        8.3515        8.2461        8.3246        8.3056        8.0203        8.1695        7.9574        8.3473        8.1645        8.1065        9.4896        9.5287        9.6507        9.7487        9.9187        9.6623        9.4924        9.2953        9.2714        9.2674        9.34          9.3658        9.2275        9.2764        9.1137        9.7198        9.6973        9.5743        9.5167        9.5935        9.6533        9.6484        9.3742        9.5675        9.621         9.5661        9.3545        9.271         9.3706        9.4279        9.3583        9.5514        9.887         9.4198        9.6185        9.6938        9.5015        9.3194        9.4402        9.5776        9.3903        9.3642        9.4808        9.567         9.5803        9.3648        9.3244        9.3731        9.6238        9.575         9.3854        9.3153        9.3571        9.2013        9.0922        9.1556        9.5701        8.5272        8.4407        8.825          
dgoD -> 8.7274       8.3196       8.4094       8.3811       8.7361       8.8187       8.3837       8.3252       7.7321       7.7538        7.6857        8.3542        7.7972        8.1773        7.6537        7.7313        7.4847        7.5697        7.5223        7.3486        7.4155        7.5519        7.402         7.3231        7.3044        7.3369        7.2625        7.5281        7.2944        7.4483        7.2109        7.3826        7.4056        7.3685        7.5421        7.3679        7.5587        7.6841        7.5189        7.506         7.5385        7.6958        7.5538        7.659         7.6714        7.5491        7.5695        7.6121        7.7104        7.5883        7.6052        7.5757        7.5851        7.7397        7.6292        7.5424        7.6486        7.5891        7.7401        7.6298        7.7245        7.8047        7.599         7.5328        7.678         7.5947        7.6349        7.68          7.5626        7.6263        7.5573        7.5227        7.6575        7.4562        7.6775        7.6947        7.5676        7.6531        7.7072        7.6113        7.5629        7.7276        7.5645        7.4865        7.4479        7.3216        7.3904        7.7502        7.7739        7.6943        7.8221        7.7436        7.8281        7.8292        7.3433        6.9378        7.5634        7.4299        6.9493        7.7215         
dgoK -> 7.5825       7.398        7.5545       7.5429       7.7704       7.7012       7.7493       7.4104       7.3799       7.5446        7.6661        7.8931        7.5499        7.9167        7.4269        7.444         7.3707        7.486         7.3531        7.3869        7.2601        7.4992        7.336         7.3095        7.3848        7.4558        7.2392        7.3246        7.3058        7.315         7.2868        7.2448        7.2069        7.0424        7.3078        7.2941        7.367         7.4529        7.4447        7.4301        7.1687        7.2831        7.4033        7.3918        7.2323        7.1558        7.0716        7.1861        7.2937        7.2783        7.125         7.1168        7.1308        7.2021        7.2601        7.0344        7.3227        7.1628        7.4027        7.1781        7.3478        7.3375        7.2839        7.1926        7.3031        7.3941        7.3724        7.409         7.1647        7.1221        7.2695        7.2282        7.2154        7.1985        7.2493        7.2819        7.1666        7.3401        7.3349        7.2108        7.5219        7.3925        7.4789        7.5128        7.4049        7.7576        7.3961        7.714         7.5137        7.3741        7.5892        7.4137        7.5091        7.5612        7.7304        7.4786        7.5107        7.7355        7.6742        7.649

Create a correlation network

Networks can be represented in many different ways. One representation which is computationally efficient in many approaches is the adjacency matrix. Here every node is represented by an index and the strength of the connection between nodes is the value in the matrix at the position of their indices.

In our case, the nodes of our network are genes in Escherichia coli (a well studied bacterium). In a correlation network, the strength of this connection is the correlation. The correlation between these genes is calculated over the expression of these genes over different experiments. For this we use the pearson correlation.

open FSharp.Stats
open Plotly.NET

// Get the rows as a matrix
let rows = 
    rawFrame 
    |> Frame.toJaggedArray 
    |> Matrix.ofJaggedArray

// Create a correlation network by computing the pearson correlation between every tow rows
let correlationNetwork = 
    Correlation.Matrix.rowWisePearson rows

// Histogram over the correlations for visualizing the distribution
let correlationHistogram = 
    correlationNetwork
    |> Matrix.toJaggedArray
    |> Array.mapi (fun i a -> a |> Array.indexed |> Array.choose (fun (j,v) -> if i = j then None else Some v))
    |> Array.concat
    |> Chart.Histogram
// Send the histogram to the browser
correlationHistogram
|> Chart.show