WGCNA exporting for Visant visualization
1
0
Entering edit mode
arom2 • 0
@arom2-8204
Last seen 7.1 years ago
United States

Hi,

I am trying to examine the connections of a particular list of genes between networks. When creating an edge file for Visant using the exportNetworkToVisANT function, is there a way to subselect a particular set of genes by their name rather than their rank in soft connectivity? They are not the HUB genes within the module and so filtering for top-ranked genes doesn't include them.  Maybe it would be easier to do this directly through Visant but this particular module is very large (9000 genes) and causes the program to crash on my computer.

Any advice would be greatly appreciated!

 

 

wgcna visant • 2.3k views
ADD COMMENT
0
Entering edit mode
@peter-langfelder-4469
Last seen 5 weeks ago
United States

If you know the genes you want to be exported, put their Entrez IDs in a vector, subset the adjMat argument to just those genes that are in the vector of desired gene IDs. This can be done instead of the restriction to a particular module.

ADD COMMENT
0
Entering edit mode

Thank you, Peter.

That makes sense but I am having a difficult time building the proper command that preserves the dimensions of the array with logical vectors.

Are you sure about subsetting the adjMat argument or should I subset the list of names prior to that command.

Code that I've tried:

> dimnames(modTOM) = list(c(IGFs),c(IGFs))
Error in dimnames(modTOM) = list(c(IGFs), c(IGFs)) : 
  length of 'dimnames' [1] not equal to array extent

 

ADD REPLY
0
Entering edit mode

You have to subset the modTOM matrix, not just set its dimnames. If IGFs contains the IDs of the genes you want to keep, I would do something like

select = colnames(modTOM %in% IGFs)

selectTOM = modTOM[select, select]

then use selectTOM as input to the export function.

ADD REPLY
0
Entering edit mode

I'm still getting an error with my code when I select for those genes (listed in character 'IGFs'). I've validated that the genes names are present in the grey module, and I can create the Visant output for the entire module. However when I attempt the export after using the select function, I receive the following errors. Is there something I am missing when selecting this list of genes from the original, and large, matrix? I've included the entire chunk of code for exporting below:

> TOM_20p = TOMsimilarityFromExpr(t(datExpr20p), power = 18);

TOM calculation: adjacency..

adjacency: replaceMissing: 0

..will use 27 parallel threads.

 Fraction of slow calculations: 0.000000

..connectivity..

..matrix multiplication..

..normalization..

..done.

> module = "grey";

> # Select module probes

> probes = rownames(datExpr20p)

> inModule = (modules20==module);

> modProbes = probes[inModule];

> modTOM = TOM_20p[inModule, inModule]

> dimnames(modTOM) = list(modProbes, modProbes)

> # Export the network into an edge list file VisANT can read

> vis = exportNetworkToVisANT(modTOM,

+   file = paste("VisANTInput-", module, ".txt", sep=""),

+   weighted = TRUE,

+   threshold = 0,

+   probeToGene = data.frame(annot$Dbxref_GeneID, annot$Name) )

 

> select = colnames(modTOM %in% IGFs)

> selectTOM = modTOM[select, select]

 

> vis = exportNetworkToVisANT(selectTOM,

+   file = paste("VisANTInput-", module, "_IGFs.txt", sep=""),

+   weighted = TRUE,

+   threshold = 0,

+   probeToGene = data.frame(annot$substanceBXH, annot$gene_symbol) )

Error in `[.data.frame`(probeToGene, , 1) : undefined columns selected

In addition: Warning messages:

1: In max(abs(adjMat - t(adjMat)), na.rm = TRUE) :

  no non-missing arguments to max; returning -Inf

2: In min(adjMat, na.rm = TRUE) :

  no non-missing arguments to min; returning Inf

3: In max(adjMat, na.rm = TRUE) :

  no non-missing arguments to max; returning -Inf

 

ADD REPLY
0
Entering edit mode

I made a mistake in my code: instead of

select = colnames(modTOM %in% IGFs)

I should have written

select = colnames(modTOM) %in% IGFs

selectTOM = modTOM[select, select]

Make sure you get something, e.g., type dim(selectTOM) and check that the result makes sense.

The error suggests that your variable annot contains neither a column called substanceBXH, nor a column called gene_symbol.

ADD REPLY
0
Entering edit mode

Great - thank you for spending the time to assist me with these commands! And yes, I accidentally posted the column headers used in the tutorial and not my particular labels. Now everything works perfectly! Maybe now you can help me figure out what all the data means.... :)

ADD REPLY

Login before adding your answer.

Traffic: 863 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6