3

我有以下问题

WGCNA - http://labs.genetics.ucla.edu/horvath/htdocs/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/

处理第 1.6 节,将网络导出到外部软件 (Cytoscape)

我目前正在尝试对一组基因执行 WGCNA,但我无法获得每个模块的 top x hub 基因。我正在尝试将网络导出到 Cytoscape,并使用与导出到 VisANT 概述的相同方法来获取 top x hub 基因。

# Select modules (only interested in one for now)
modules = c("greenyellow")

# Select module probes
probes = names(datExpr)
inModule = is.finite(match(bwModuleColors, modules))
modProbes = probes[inModule]
modGenes = annot$gene_symbols[match(modProbes, annot$geneID)]

# Select the corresponding Topological Overlap
modTOM = TOM[inModule, inModule]
dimnames(modTOM) = list(modProbes, modProbes)

# Restrict the network to the top 30 genes
nTop = 30
IMConn = softConnectivity(datExpr[, modProbes]
top = (order(-IMConn) <= nTop)

# Export the network into a fomat that Cytoscape can read
cyt = exportNetworkToCytoscape(modTOM[top, top],
  edgeFile = paste("CytoscapeInput-edges-", paste(modules, collapse="-"), ".txt", sep = ""),
  nodeFile = paste("CytoscapeInput-nodes-", paste(modules, collapse="-"), ".txt", sep = ""),
  weight = TRUE,
  threshold = 0.02,
  nodeNames = modProbes,
  altNodeNames = modGenes,
  nodeAttr = bwModuleColors[inModule])

我写了一个短循环来计算每个基因的连接数,它按预期工作,但第 x 个基因始终有零连接。假设 x 为 30。如果我将截止值增加到 31 个中心基因,则第 30 个基因现在显示与网络中其他基因的连接,但第 31 个基因没有显示任何内容。此外,这种变化增加并减少了与网络中其他基因的一些连接数。这真的让我很困扰,因为应该只添加连接,因为网络变大了一个基因,而变化应该由第 30 个基因来解释,但输出的情况并非如此。

# Split the cytoscape file into two parts: edge and node
node <- cyt$nodeData
edge <- cyt$edgeData


# The limit covers all of the connections in the edge file by determining the length of the column ‘fromNode’
limit <- length(edge$fromNode)

# Create an empty list to store the counts for each gene
counts = list()

# Loop for the genes going from 1 to the number of genes specified for the network, ‘nTop’
for (i in 1:nTop) {

# Reset the count for each new gene and specify the names of the gene of interest and the matching genes
  name = node$nodeName[[i]]

  count = 0

# Nested loop that searches for matches to the gene in question in both the ‘fromNode’ and ‘toNode’columns, and adds one to the count for each match.
  for (j in 1:limit) {
    matchName1 = edge$fromNode[[j]]
    matchName2 = edge$toNode[[j]]
    if (name == matchName1 || name == matchName2)
      {count = count + 1}
    }

# Create a string for the attribute in the correct format
    attribute <- paste(name, "=", count)

# Adds the count to the list
  counts <- c(counts, attribute)
  }
# End of loop

循环似乎按预期工作,所以我认为问题出在网络建设上。我目前正在回顾我对线性代数、矩阵和拓扑的了解,以尝试查看问题是否在于它们的排序方式或类似的方式,但这可能只是 exportNetworkToCytoscape() 函数的方式作品。

4

1 回答 1

-1

模块=“棕色”;

probes = rownames(datExpr_human) ======> 行中的数据基因和列中的样本。

inModule = is.finite(match(modules_human,modules))

modTOM = dissTOM_Human[inModule, inModule];

modProbes = 探针[inModule];

暗名(modTOM)=列表(modProbes,modProbes)

nTop = 30;

datExpr = t(datExpr_human)

IMConn = softConnectivity(datExpr[, modProbes]);

top = (rank(-IMConn) <= nTop)

cyt = exportNetworkToCytoscape(modTOM[top, top], edgeFile = paste("CytoscapeInput-edges-", paste(modules, collapse="-"), ".txt", sep=""), nodeFile = paste("CytoscapeInput -nodes-", paste(modules, collapse="-"), ".txt", sep=""), weighted = TRUE)

于 2016-06-30T12:46:11.923 回答