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!
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:
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.
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
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.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.... :)