Contents

1 Introduction

This vignette is an applied companion to vignette("CorNetto"), which introduces the package, motivates it against related Bioconductor software, and covers installation and the full function reference. Read that one first.

Here the same workflow is run end to end on a small packaged subset of proteomic, transcriptomic, and metabolomic data from moderate and severe COVID-19 patients. The subset exists to demonstrate the workflow during package checks; it is not sized for biological discovery, and its provenance is documented in inst/scripts/covid-example-data.md. The candidate edges used below are entirely synthetic. They exercise network import, filtering, differential correlation, and node scoring, but they do not represent biological evidence.

Constraining the calculations to an explicit candidate network keeps this example fast and avoids dense all-pairs correlations.

2 Import synthetic candidate networks

CorNetto accepts prior-knowledge networks from external resources when their columns can be mapped to the package schema. For this runnable example, the package instead supplies three deterministic synthetic networks. This avoids redistributing third-party interaction data and keeps the example independent of database versions and licenses.

The within-assay and cross-assay files contain invented edges between measured features. The decoy file contains invented edges with one or two unmeasured endpoints, so the filtering step below has observable work to do. Edge weights and directions are illustrative only.

readKnowledgeNetwork() function takes a delimited table, optionally remaps the input column names to a common convention, and standardizes it for downstream CorNetto functions. The minimum columns required are fromFeatureIdentifier, toFeatureIdentifier, fromAssayName, and toAssayName. Other columns are optional but can be useful. The output is a standardized S4Vectors::DataFrame.

combineKnowledgeNetworks() takes these standardized networks and combines their rows while removing duplicate edges (optional).


# Set column mapping
priorColumnMap <- c(
    fromFeatureIdentifier = "from",
    toFeatureIdentifier = "to",
    fromFeatureName = "fromName",
    toFeatureName = "toName",
    fromAssayName = "fromOmic",
    toAssayName = "toOmic",
    edgeType = "edgeType",
    edgeDirection = "edgeDirection",
    evidenceScore = "edgeWeight"
)
# Import the three synthetic edge sets
withinAssayNetwork <- readKnowledgeNetwork(
    filePath = file.path(
        extdataDir, "priorNetworks", "synthetic_within_assay.csv"
    ),
    columnMapping = priorColumnMap,
    knowledgeSource = "CorNetto synthetic within-assay"
)

crossAssayNetwork <- readKnowledgeNetwork(
    filePath = file.path(
        extdataDir, "priorNetworks", "synthetic_cross_assay.csv"
    ),
    columnMapping = priorColumnMap,
    knowledgeSource = "CorNetto synthetic cross-assay"
)

decoyNetwork <- readKnowledgeNetwork(
    filePath = file.path(
        extdataDir, "priorNetworks", "synthetic_decoy_edges.csv"
    ),
    columnMapping = priorColumnMap,
    knowledgeSource = "CorNetto synthetic decoys"
)

# Combine networks
combinedPriorNetwork <- combineKnowledgeNetworks(
    withinAssayNetwork,
    crossAssayNetwork,
    decoyNetwork,
    removeDuplicates = TRUE
)

3 Import experimental abundance data into the environment

Currently CorNetto is able to accept any normalised and fully preprocessed abundance or count matrix relating to proteomics, transcriptomics, or metabolomics.

createAnalysisData() creates a MultiAssayExperiment from these normalized assay objects and sample metadata.

filterSamples() filters the MultiAssayExperiment based on a group column and a range of values.

# Import patient data
patientInformation <- read.csv(file.path(extdataDir,
                                         "covidData",
                                         "patientInformation.csv"))
rownames(patientInformation) <- patientInformation$Visit_ID

# Import omics data
dataList <- list(RNA = read.csv(file.path(extdataDir,
                                          "covidData",
                                          "rnaMatrix.csv"),
                                row.names = 1),
                 Protein  = read.csv(file.path(extdataDir,
                                               "covidData",
                                               "proteinMatrix.csv"),
                                     row.names = 1),
                 Metabolite  = read.csv(file.path(extdataDir,
                                                  "covidData",
                                                  "metaboliteMatrix.csv"),
                                        row.names = 1))

# Create analysis data
analysisData <- createAnalysisData(assayList = dataList,
                                   sampleData = patientInformation)

# Filter data for only COVID-19 patients at visit 1
analysisCovid <- filterSamples(analysisData,
                               groupColumn = "Group",
                               groupLevels = c("COVID Severe",
                                               "COVID Moderate"))
analysisCovid <- filterSamples(analysisCovid,
                               groupColumn = "Visit",
                               groupLevels = "Visit 1")

4 QC checks of all imported objects

Following data importation, objects can be checked for structural conformity and diagnostic summaries.

validateAnalysisData() checks the CorNetto analysis object for structural conformity, specifically:

validateKnowledgeNetwork() checks the CorNetto prior-knowledge edge table for structural conformity, specifically:

These functions also run quietly after most CorNetto functions to ensure conformity of output.

# Check analysis data
analysisCovid <- validateAnalysisData(analysisCovid)
#> Analysis data object is structured correctly for CorNetto.
# Check knowledge networks
combinedPriorNetwork <- validateKnowledgeNetwork(combinedPriorNetwork)
#> Knowledge network is structured correctly for CorNetto.

summarizeAnalysisData() asks “what does this analysis object look like, and are there analysis risks?” rather than only asking whether the object is structurally valid.

summarizeAnalysisData(analysisCovid,
                      groupColumn = "Group")
#> Warning: Assay `RNA` has 6 zero-variance features.
#> $assays
#> DataFrame with 3 rows and 9 columns
#>     assayName featureCount sampleCount missingValueCount missingValueFraction
#>   <character>    <integer>   <integer>         <integer>            <numeric>
#> 1         RNA           51          24                 0                    0
#> 2     Protein           63          24                 0                    0
#> 3  Metabolite            4          24                 0                    0
#>   zeroVarianceFeatureCount allMissingFeatureCount highMissingFeatureCount
#>                  <integer>              <integer>               <integer>
#> 1                        6                      0                       0
#> 2                        0                      0                       0
#> 3                        0                      0                       0
#>   samplesMissingFromColData
#>                   <integer>
#> 1                         0
#> 2                         0
#> 3                         0
#> 
#> $samples
#> $samples$overall
#> DataFrame with 1 row and 2 columns
#>   sampleCount samplesInAnyAssay
#>     <integer>         <integer>
#> 1          24                24
#> 
#> $samples$groups
#> DataFrame with 2 rows and 2 columns
#>       groupLevel sampleCount
#>      <character>   <integer>
#> 1 COVID Moderate          12
#> 2   COVID Severe          12
#> 
#> 
#> $warnings
#> [1] "Assay `RNA` has 6 zero-variance features."

The output reports the number of features per assay, the number of samples per assay, and the number of samples in each selected group. In this small packaged example there are 12 moderate COVID-19 samples and 12 severe COVID-19 samples.

Zero-variance and near-zero-variance features should be removed before correlation analysis. These can be removed with removeZeroVariance = TRUE and minimumVariance in filterFeatures().

analysisCovid <- filterFeatures(
    analysisCovid,
    removeZeroVariance = TRUE,
    minimumVariance = 0.01
)

summarizeAnalysisData(analysisCovid)
#> $assays
#> DataFrame with 3 rows and 9 columns
#>     assayName featureCount sampleCount missingValueCount missingValueFraction
#>   <character>    <integer>   <integer>         <integer>            <numeric>
#> 1         RNA           44          24                 0                    0
#> 2     Protein           63          24                 0                    0
#> 3  Metabolite            4          24                 0                    0
#>   zeroVarianceFeatureCount allMissingFeatureCount highMissingFeatureCount
#>                  <integer>              <integer>               <integer>
#> 1                        0                      0                       0
#> 2                        0                      0                       0
#> 3                        0                      0                       0
#>   samplesMissingFromColData
#>                   <integer>
#> 1                         0
#> 2                         0
#> 3                         0
#> 
#> $samples
#> $samples$overall
#> DataFrame with 1 row and 2 columns
#>   sampleCount samplesInAnyAssay
#>     <integer>         <integer>
#> 1          24                24
#> 
#> $samples$groups
#> NULL
#> 
#> 
#> $warnings
#> character(0)

For the sparse workflow, candidate edges are restricted to edges whose endpoint features remain in the filtered analysis object. The first summary shows that the combined synthetic network includes deliberately unmeasured endpoints. The second summary shows the network after requiring both endpoints to be measured.

measuredNodeKeys <- unlist(
    lapply(
        names(MultiAssayExperiment::experiments(analysisCovid)),
        function(assayName) {
            assayObject <- MultiAssayExperiment::experiments(analysisCovid)[[assayName]]
            paste(
                assayName,
                rownames(SummarizedExperiment::assay(assayObject)),
                sep = "::"
            )
        }
    ),
    use.names = FALSE
)

unfilteredPriorSummary <- summarizeKnowledgeNetwork(
    combinedPriorNetwork,
    analysisCovid,
    quiet = TRUE
)
unfilteredPriorSummary$overall
#> DataFrame with 1 row and 8 columns
#>   totalEdges uniqueNodes duplicateEdges missingFeatureNameEdges
#>    <integer>   <integer>      <integer>               <integer>
#> 1        183         118              0                       0
#>   measuredAssayEdges unmeasuredAssayEdges measuredFeatureEdges
#>            <integer>            <integer>            <integer>
#> 1                181                    2                  175
#>   unmeasuredFeatureEdges
#>                <integer>
#> 1                      8

measuredPriorNetwork <- filterNetworkByNodes(
    combinedPriorNetwork,
    nodes = measuredNodeKeys,
    mode = "both",
    nodeIdType = "key"
)

measuredPriorSummary <- summarizeKnowledgeNetwork(
    measuredPriorNetwork,
    analysisCovid,
    quiet = TRUE
)
measuredPriorSummary$overall
#> DataFrame with 1 row and 8 columns
#>   totalEdges uniqueNodes duplicateEdges missingFeatureNameEdges
#>    <integer>   <integer>      <integer>               <integer>
#> 1        175         111              0                       0
#>   measuredAssayEdges unmeasuredAssayEdges measuredFeatureEdges
#>            <integer>            <integer>            <integer>
#> 1                175                    0                  175
#>   unmeasuredFeatureEdges
#>                <integer>
#> 1                      0

5 Run prior-guided differential correlations

The main function for testing differential correlations between groups is testDifferentialCorrelation. Here it tests every measured edge in the synthetic candidate network supplied through candidateEdgeTable. The result illustrates the software workflow and is not a prior-supported biological analysis.

The differential correlation result is added to analysisCovid, then extracted with differentialCorrelationResults(). Alternatively, testDifferentialCorrelation() can directly return the table with storeResult = FALSE.

analysisCovid <- testDifferentialCorrelation(
    analysisData = analysisCovid,
    groupColumn = "Group",
    groupLevels = c("COVID Moderate", "COVID Severe"),
    candidateEdgeTable = measuredPriorNetwork,
    correlationMethod = "pearson",
    minimumAbsoluteCorrelation = 0.3,
    adjustedPValueThreshold = 0.05,
    pAdjustMethod = "fdr",
    resultName = "differentialSparseCorrelations"
)

differentialSparseCorrelations <-
    differentialCorrelationResults(analysisCovid)[["differentialSparseCorrelations"]]

as.data.frame(differentialSparseCorrelations)
#>   fromFeatureIdentifier toFeatureIdentifier fromFeatureName   toFeatureName
#> 1       ENSG00000132485     ENSG00000132953 ENSG00000132485 ENSG00000132953
#> 2       ENSG00000088179     ENSG00000091009 ENSG00000088179 ENSG00000091009
#> 3                P49720              P60900          P49720          P60900
#> 4                P25788              P40306          P25788          P40306
#> 5                P40306              O14818          P40306          O14818
#> 6                O14818              P28062          O14818          P28062
#> 7                P28062              Q99436          P28062          Q99436
#>   fromAssayName toAssayName                edgeType edgeDirection
#> 1           RNA         RNA differentialCorrelation          <NA>
#> 2           RNA         RNA differentialCorrelation          <NA>
#> 3       Protein     Protein differentialCorrelation          <NA>
#> 4       Protein     Protein differentialCorrelation          <NA>
#> 5       Protein     Protein differentialCorrelation          <NA>
#> 6       Protein     Protein differentialCorrelation          <NA>
#> 7       Protein     Protein differentialCorrelation          <NA>
#>                    sourceType correlationScope correlationMethod
#> 1 differentialCorrelationTest       withinOmic           pearson
#> 2 differentialCorrelationTest       withinOmic           pearson
#> 3 differentialCorrelationTest       withinOmic           pearson
#> 4 differentialCorrelationTest       withinOmic           pearson
#> 5 differentialCorrelationTest       withinOmic           pearson
#> 6 differentialCorrelationTest       withinOmic           pearson
#> 7 differentialCorrelationTest       withinOmic           pearson
#>                   knowledgeSource groupName                 comparisonName
#> 1 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 2 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 3 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 4 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 5 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 6 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 7 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#>   correlationValue group1CorrelationValue group2CorrelationValue     pValue
#> 1               NA            0.902032305              0.5521418 0.06760191
#> 2               NA            0.864196626              0.2718904 0.02876993
#> 3               NA            0.498555926              0.8801615 0.07861328
#> 4               NA            0.526881781              0.8826141 0.08902387
#> 5               NA            0.754467699              0.9130670 0.23284375
#> 6               NA            0.124513627              0.8523859 0.01562476
#> 7               NA            0.004922372              0.8328467 0.01142136
#>   adjustedPValue group1PValue group2PValue group1AdjustedPValue
#> 1      0.5158465 6.017295e-05 6.268702e-02           0.01028957
#> 2      0.3692840 2.883267e-04 3.926101e-01           0.02465193
#> 3      0.5158465 9.898339e-02 1.586563e-04           0.52306645
#> 4      0.5158465 7.839537e-02 1.436856e-04           0.47877174
#> 5      0.7508336 4.573930e-03 3.374331e-05           0.11508572
#> 6      0.3095907 6.998262e-01 4.284883e-04           0.94210602
#> 7      0.3017165 9.878867e-01 7.706156e-04           0.99046955
#>   group2AdjustedPValue zScoreDifference sampleCount group1SampleCount
#> 1          0.272940781        -1.827651          NA                12
#> 2          0.685064612        -2.186625          NA                12
#> 3          0.009043412         1.758789          NA                12
#> 4          0.009043412         1.700569          NA                12
#> 5          0.005770107         1.193065          NA                12
#> 6          0.018317873         2.417565          NA                12
#> 7          0.026355053         2.529536          NA                12
#>   group2SampleCount edgeWeight evidenceScore isDirected
#> 1                12         NA          0.90      FALSE
#> 2                12         NA          0.65      FALSE
#> 3                12         NA          0.65      FALSE
#> 4                12         NA          0.95      FALSE
#> 5                12         NA          0.55      FALSE
#> 6                12         NA          0.60      FALSE
#> 7                12         NA          0.65      FALSE

6 Build differential network.

The next step builds a differential correlation network from the differentialSparseCorrelations table. The function returns the network directly unless storeResult = TRUE, in which case analysisData and resultName are supplied.

Here the resulting network is not filtered further. In a real analysis, minimumAbsoluteCorrelation and differenceAdjustedPValueThreshold can be tightened to remove weakly correlated or non-significant edges.

analysisCovid <- createDifferentialCorrelationNetwork(
    differentialCorrelationTable = differentialSparseCorrelations,
    minimumAbsoluteCorrelation = 0,
    edgeWeightMethod = "signedZScore",
    analysisData = analysisCovid,
    resultName = "differentialSparseNetwork",
    storeResult = TRUE)

differentialSparseNetwork <-
    differentialCorrelationNetworks(analysisCovid)[["differentialSparseNetwork"]]

as.data.frame(differentialSparseNetwork)
#>   fromFeatureIdentifier toFeatureIdentifier fromFeatureName   toFeatureName
#> 1       ENSG00000132485     ENSG00000132953 ENSG00000132485 ENSG00000132953
#> 2       ENSG00000088179     ENSG00000091009 ENSG00000088179 ENSG00000091009
#> 3                P49720              P60900          P49720          P60900
#> 4                P25788              P40306          P25788          P40306
#> 5                P40306              O14818          P40306          O14818
#> 6                O14818              P28062          O14818          P28062
#> 7                P28062              Q99436          P28062          Q99436
#>   fromAssayName toAssayName                edgeType        edgeDirection
#> 1           RNA         RNA differentialCorrelation strengthenedPositive
#> 2           RNA         RNA differentialCorrelation strengthenedPositive
#> 3       Protein     Protein differentialCorrelation     weakenedPositive
#> 4       Protein     Protein differentialCorrelation     weakenedPositive
#> 5       Protein     Protein differentialCorrelation     weakenedPositive
#> 6       Protein     Protein differentialCorrelation     weakenedPositive
#> 7       Protein     Protein differentialCorrelation     weakenedPositive
#>                sourceType correlationScope correlationMethod
#> 1 differentialCorrelation       withinOmic           pearson
#> 2 differentialCorrelation       withinOmic           pearson
#> 3 differentialCorrelation       withinOmic           pearson
#> 4 differentialCorrelation       withinOmic           pearson
#> 5 differentialCorrelation       withinOmic           pearson
#> 6 differentialCorrelation       withinOmic           pearson
#> 7 differentialCorrelation       withinOmic           pearson
#>                   knowledgeSource groupName                 comparisonName
#> 1 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 2 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 3 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 4 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 5 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 6 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#> 7 CorNetto synthetic within-assay      <NA> COVID Moderate_vs_COVID Severe
#>   correlationValue group1CorrelationValue group2CorrelationValue     pValue
#> 1               NA            0.902032305              0.5521418 0.06760191
#> 2               NA            0.864196626              0.2718904 0.02876993
#> 3               NA            0.498555926              0.8801615 0.07861328
#> 4               NA            0.526881781              0.8826141 0.08902387
#> 5               NA            0.754467699              0.9130670 0.23284375
#> 6               NA            0.124513627              0.8523859 0.01562476
#> 7               NA            0.004922372              0.8328467 0.01142136
#>   adjustedPValue group1PValue group2PValue group1AdjustedPValue
#> 1      0.5158465 6.017295e-05 6.268702e-02           0.01028957
#> 2      0.3692840 2.883267e-04 3.926101e-01           0.02465193
#> 3      0.5158465 9.898339e-02 1.586563e-04           0.52306645
#> 4      0.5158465 7.839537e-02 1.436856e-04           0.47877174
#> 5      0.7508336 4.573930e-03 3.374331e-05           0.11508572
#> 6      0.3095907 6.998262e-01 4.284883e-04           0.94210602
#> 7      0.3017165 9.878867e-01 7.706156e-04           0.99046955
#>   group2AdjustedPValue zScoreDifference sampleCount group1SampleCount
#> 1          0.272940781        -1.827651          NA                12
#> 2          0.685064612        -2.186625          NA                12
#> 3          0.009043412         1.758789          NA                12
#> 4          0.009043412         1.700569          NA                12
#> 5          0.005770107         1.193065          NA                12
#> 6          0.018317873         2.417565          NA                12
#> 7          0.026355053         2.529536          NA                12
#>   group2SampleCount edgeWeight evidenceScore isDirected
#> 1                12  -1.827651          0.90      FALSE
#> 2                12  -2.186625          0.65      FALSE
#> 3                12   1.758789          0.65      FALSE
#> 4                12   1.700569          0.95      FALSE
#> 5                12   1.193065          0.55      FALSE
#> 6                12   2.417565          0.60      FALSE
#> 7                12   2.529536          0.65      FALSE

7 Calculate rewiring scores.

Rewiring scores summarize the amount of differential-correlation signal incident on each node in the differential network. Here the rewiring table is stored in analysisCovid and extracted with rewiringResults().

analysisCovid <- calculateRewiringScores(
    differentialCorrelationNetwork = differentialSparseNetwork,
    analysisData = analysisCovid,
    resultName = "differentialSparseRewiring",
    storeResult = TRUE
)

rewiringScores <- rewiringResults(analysisCovid)[["differentialSparseRewiring"]]

rewiringScores <- rewiringScores[
    order(rewiringScores$rootMeanSquareRewiringScore, decreasing = TRUE),
]

head(rewiringScores, 20)
#> DataFrame with 11 rows and 9 columns
#>                 nodeKey  nodeIdentifier        nodeName   assayName
#>             <character>     <character>     <character> <character>
#> 1       Protein::Q99436          Q99436          Q99436     Protein
#> 2       Protein::P28062          P28062          P28062     Protein
#> 3  RNA::ENSG00000088179 ENSG00000088179 ENSG00000088179         RNA
#> 4  RNA::ENSG00000091009 ENSG00000091009 ENSG00000091009         RNA
#> 5       Protein::O14818          O14818          O14818     Protein
#> 6  RNA::ENSG00000132485 ENSG00000132485 ENSG00000132485         RNA
#> 7  RNA::ENSG00000132953 ENSG00000132953 ENSG00000132953         RNA
#> 8       Protein::P49720          P49720          P49720     Protein
#> 9       Protein::P60900          P60900          P60900     Protein
#> 10      Protein::P25788          P25788          P25788     Protein
#> 11      Protein::P40306          P40306          P40306     Protein
#>    totalConnections rawRewiringScore rootMeanSquareRewiringScore   degreeBin
#>           <integer>        <numeric>                   <numeric> <character>
#> 1                 1          2.52954                     2.52954       [0,1]
#> 2                 2          3.49902                     2.47418       (1,2]
#> 3                 1          2.18662                     2.18662       [0,1]
#> 4                 1          2.18662                     2.18662       [0,1]
#> 5                 2          2.69593                     1.90631       (1,2]
#> 6                 1          1.82765                     1.82765       [0,1]
#> 7                 1          1.82765                     1.82765       [0,1]
#> 8                 1          1.75879                     1.75879       [0,1]
#> 9                 1          1.75879                     1.75879       [0,1]
#> 10                1          1.70057                     1.70057       [0,1]
#> 11                2          2.07734                     1.46890       (1,2]
#>    degreeMatchedZScore
#>              <numeric>
#> 1             1.889753
#> 2                   NA
#> 3             0.727403
#> 4             0.727403
#> 5                   NA
#> 6            -0.489392
#> 7            -0.489392
#> 8            -0.722810
#> 9            -0.722810
#> 10           -0.920155
#> 11                  NA

8 Run permutation ranking.

permuteRewiringScores() permutes the supplied group labels, reruns the differential correlation testing, rebuilds the networks, and calculates node-level permutation tail probabilities. This example retains the observed correlation and adjusted-p filters used above, so its output is a conditional ranking, not a randomization p-value. This vignette uses 99 Monte Carlo permutations so that package checks run quickly. Assignments are sampled independently and can repeat; exact enumeration is not implemented.

analysisCovid <- permuteRewiringScores(
    analysisData = analysisCovid,
    groupColumn = "Group",
    groupLevels = c("COVID Moderate", "COVID Severe"),
    candidateEdgeTable = measuredPriorNetwork,
    correlationMethod = "pearson",
    minimumAbsoluteCorrelation = 0.3,
    adjustedPValueThreshold = 0.05,
    pAdjustMethod = "fdr",
    edgeWeightMethod = "signedZScore",
    scoreColumn = "rawRewiringScore",
    nPermutations = 99,
    seed = 1,
    keepPermutationScores = TRUE,
    resultName = "differentialSparseRewiringPermutation",
    storeResult = TRUE)
#> Warning: Observed-data edge filtering is active; permutation tail probabilities
#> are conditional rankings.


rewiringPermutation <-
    validationResults(analysisCovid)[["differentialSparseRewiringPermutation"]]

rewiringPermutation$inferenceStatus
#> [1] "conditional ranking"

rankedRewiring <- rewiringPermutation$rewiringTable
rankedRewiring <- rankedRewiring[
    order(
        rankedRewiring$adjustedPermutationTailProbability,
        -rankedRewiring$rawRewiringScore,
        na.last = TRUE
    ),
]

head(rankedRewiring, 20)
#> DataFrame with 11 rows and 18 columns
#>                 nodeKey  nodeIdentifier        nodeName   assayName
#>             <character>     <character>     <character> <character>
#> 1       Protein::P28062          P28062          P28062     Protein
#> 2       Protein::Q99436          Q99436          Q99436     Protein
#> 3  RNA::ENSG00000088179 ENSG00000088179 ENSG00000088179         RNA
#> 4  RNA::ENSG00000091009 ENSG00000091009 ENSG00000091009         RNA
#> 5       Protein::O14818          O14818          O14818     Protein
#> 6  RNA::ENSG00000132485 ENSG00000132485 ENSG00000132485         RNA
#> 7  RNA::ENSG00000132953 ENSG00000132953 ENSG00000132953         RNA
#> 8       Protein::P49720          P49720          P49720     Protein
#> 9       Protein::P60900          P60900          P60900     Protein
#> 10      Protein::P25788          P25788          P25788     Protein
#> 11      Protein::P40306          P40306          P40306     Protein
#>    totalConnections rawRewiringScore rootMeanSquareRewiringScore   degreeBin
#>           <integer>        <numeric>                   <numeric> <character>
#> 1                 2          3.49902                     2.47418       (1,2]
#> 2                 1          2.52954                     2.52954       [0,1]
#> 3                 1          2.18662                     2.18662       [0,1]
#> 4                 1          2.18662                     2.18662       [0,1]
#> 5                 2          2.69593                     1.90631       (1,2]
#> 6                 1          1.82765                     1.82765       [0,1]
#> 7                 1          1.82765                     1.82765       [0,1]
#> 8                 1          1.75879                     1.75879       [0,1]
#> 9                 1          1.75879                     1.75879       [0,1]
#> 10                1          1.70057                     1.70057       [0,1]
#> 11                2          2.07734                     1.46890       (1,2]
#>    degreeMatchedZScore permutationTailProbability
#>              <numeric>                  <numeric>
#> 1                   NA                       0.06
#> 2             1.889753                       0.06
#> 3             0.727403                       0.04
#> 4             0.727403                       0.04
#> 5                   NA                       0.17
#> 6            -0.489392                       0.19
#> 7            -0.489392                       0.19
#> 8            -0.722810                       0.20
#> 9            -0.722810                       0.20
#> 10           -0.920155                       0.28
#> 11                  NA                       0.33
#>    adjustedPermutationTailProbability nullMeanScore nullSdScore
#>                             <numeric>     <numeric>   <numeric>
#> 1                            0.165000      1.582086    1.035090
#> 2                            0.165000      1.060738    0.841214
#> 3                            0.165000      0.852394    0.641887
#> 4                            0.165000      0.852394    0.641887
#> 5                            0.244444      1.650041    0.947227
#> 6                            0.244444      1.110976    0.706074
#> 7                            0.244444      1.110976    0.706074
#> 8                            0.244444      0.982580    0.766584
#> 9                            0.244444      0.982580    0.766584
#> 10                           0.308000      1.315043    0.960308
#> 11                           0.330000      1.780760    1.165209
#>    contributingPermutations      scoreColumn nPermutations blockColumn
#>                   <integer>      <character>     <integer> <character>
#> 1                        99 rawRewiringScore            99          NA
#> 2                        99 rawRewiringScore            99          NA
#> 3                        99 rawRewiringScore            99          NA
#> 4                        99 rawRewiringScore            99          NA
#> 5                        99 rawRewiringScore            99          NA
#> 6                        99 rawRewiringScore            99          NA
#> 7                        99 rawRewiringScore            99          NA
#> 8                        99 rawRewiringScore            99          NA
#> 9                        99 rawRewiringScore            99          NA
#> 10                       99 rawRewiringScore            99          NA
#> 11                       99 rawRewiringScore            99          NA
#>        inferenceStatus
#>            <character>
#> 1  conditional ranking
#> 2  conditional ranking
#> 3  conditional ranking
#> 4  conditional ranking
#> 5  conditional ranking
#> 6  conditional ranking
#> 7  conditional ranking
#> 8  conditional ranking
#> 9  conditional ranking
#> 10 conditional ranking
#> 11 conditional ranking

9 Result export

Once results are generated, the network and node rewiring scores can be supplied to prepareCytoscapeTables() to create tables that can be imported into Cytoscape for further network analysis.

writeNetworkTables() writes the node and edge tables to a specified directory. The vignette writes to tempdir() so package checks do not write into the user’s working directory.

cytoscapeTables <- prepareCytoscapeTables(networkEdgeTable = differentialSparseNetwork,
                                          rewiringTable = rankedRewiring)

writeNetworkTables(cytoscapeTables,
                   directoryPath = file.path(tempdir(),
                                             "cornettoCovidSeverityNetwork"),
                   prefix = "covidModerateVsSevere",
                   fileFormat = "csv")

10 Session information

sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] CorNetto_0.99.1  BiocStyle_2.41.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] sass_0.4.10                 generics_0.1.4             
#>  [3] SparseArray_1.13.2          lattice_0.23-1             
#>  [5] digest_0.6.39               magrittr_2.0.5             
#>  [7] evaluate_1.0.5              grid_4.6.1                 
#>  [9] bookdown_0.48               fastmap_1.2.0              
#> [11] jsonlite_2.0.0              Matrix_1.7-6               
#> [13] tinytex_0.60                BiocManager_1.30.27        
#> [15] codetools_0.2-20            jquerylib_0.1.4            
#> [17] abind_1.4-8                 cli_3.6.6                  
#> [19] rlang_1.3.0                 XVector_0.53.0             
#> [21] Biobase_2.73.2              withr_3.0.3                
#> [23] cachem_1.1.0                DelayedArray_0.39.6        
#> [25] yaml_2.3.12                 otel_0.2.0                 
#> [27] BiocBaseUtils_1.15.1        S4Arrays_1.13.0            
#> [29] tools_4.6.1                 parallel_4.6.1             
#> [31] BiocParallel_1.47.0         SummarizedExperiment_1.43.0
#> [33] BiocGenerics_0.59.12        MultiAssayExperiment_1.39.1
#> [35] R6_2.6.1                    magick_2.9.1               
#> [37] matrixStats_1.5.0           stats4_4.6.1               
#> [39] lifecycle_1.0.5             Seqinfo_1.3.2              
#> [41] S4Vectors_0.51.9            IRanges_2.47.5             
#> [43] pkgconfig_2.0.3             bslib_0.12.0               
#> [45] Rcpp_1.1.2                  xfun_0.60                  
#> [47] GenomicRanges_1.65.4        MatrixGenerics_1.25.0      
#> [49] knitr_1.52                  htmltools_0.5.9            
#> [51] snow_0.4-4                  igraph_2.3.3               
#> [53] rmarkdown_2.32              compiler_4.6.1