WCGNA to Cytoscape
0
0
Entering edit mode
4.3 years ago

Hello, I'm new in RNA-Seq World, and im trying to export a network from WCGNA to Cytoscape, I'm trying this command (and the output is here too)

library(WGCNA);
library(cluster);
options(stringsAsFactors = FALSE);
load("modulePreservation.RData");
ADJ1=abs(cor(datExprhigado,use="p"))^6;
lnames = load(file = "modulePreservation.RData");
lnames;
[1] "mp"
TOM = TOMsimilarityFromExpr(datExprhigado, power = 18);
TOM calculation: adjacency..
..will use 4 parallel threads.
 Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
annot = read.csv(file = "anotacionEG.csv");
modules = c("turquoise", "brown");
probes = names(datExprhigado);
inModule = is.finite(match(moduleColorsAutomatic, modules));
modProbes = probes[inModule];
modGenes = annot$gene_symbol[match(modProbes, annot$substanceBXH)];
modTOM = TOM[inModule, inModule];
dimnames(modTOM) = list(modProbes, modProbes);> library(WGCNA);
library(cluster);
options(stringsAsFactors = FALSE);
load("modulePreservation.RData");
ADJ1=abs(cor(datExprhigado,use="p"))^6;
lnames = load(file = "modulePreservation.RData");
lnames;
[1] "mp"
TOM = TOMsimilarityFromExpr(datExprhigado, power = 18);
TOM calculation: adjacency..
..will use 4 parallel threads.
 Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
annot = read.csv(file = "anotacionEG.csv");
modules = c("turquoise", "brown");
probes = names(datExprhigado);
inModule = is.finite(match(moduleColorsAutomatic, modules));
modProbes = probes[inModule];
modGenes = annot$gene_symbol[match(modProbes, annot$substanceBXH)];
modTOM = TOM[inModule, inModule];
dimnames(modTOM) = list(modProbes, modProbes);
cyt = exportNetworkToCytoscape(modTOM,
  edgeFile = paste("CytoscapeInput-edges-", paste(modules, collapse="-"), ".txt", sep=""),
  nodeFile = paste("CytoscapeInput-nodes-", paste(modules, collapse="-"), ".txt", sep=""),
  weighted = TRUE,
  threshold = 0.02,
  nodeNames = modProbes,
  altNodeNames = modGenes,
  nodeAttr = moduleColorsAutomatic[inModule])
Error in exportNetworkToCytoscape(modTOM, edgeFile = paste("CytoscapeInput-edges-",  : 
  Cannot determine node names: nodeNames is NULL and adjMat has no dimnames.

It says basically that the objetc nodeNames do not have content..and the adjMat no not have dimnames. How may I solve it? is there anyway to correct this?

Thank you all!

wgcna cytoscape rna-seq • 2.0k views
ADD COMMENT
0
Entering edit mode

What is the output of:

str(modProbes)
str(modTOM)

Also, can you confirm that all steps prior to exportNetworkToCytoscape(...) have completed successfully (really, confirm this)?

ADD REPLY
0
Entering edit mode

Thank you kevin. Here says :

str(modProbes)
 chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" "EGR_10234" ...
> str(modTOM)
 num [1:306, 1:306] 1 0.1531 0.0905 0.0385 0.0181 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" ...
  ..$ : chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" ...

I think the error came from another line...i will write another answer. Thankyou!

ADD REPLY
0
Entering edit mode

hi everyone, i changed my script like this:

module = "black"
probes = names(datExprhigado)
annot = read.csv(file = "anotacion.csv")
TOM = TOMsimilarityFromExpr(datExprhigado, power = 18)
inModule = is.finite(match(moduleColorsHigado, module))
modProbes = probes[inModule]
modGenes = annot$Name[match(modProbes, annot$gene_symbol)]
modTOM = TOM[inModule, inModule]
dimnames(modTOM) = list(modProbes, modProbes)
cyt = exportNetworkToCytoscape(modTOM, edgeFile =
paste("CytoscapeInput-edges-", paste(module, collapse="-"),
".txt", sep=""), nodeFile = paste("CytoscapeInput-nodes-",
paste(module, collapse="-"), ".txt", sep=""), weighted =
TRUE, threshold = 0, nodeNames = modProbes, altNodeNames =
modGenes, nodeAttr = moduleColorsHigado[inModule])

Then it outputs me txt files, in both i see the column AltName says n/a, then i saw this

str(modGenes)
 NULL

so, i think the error is here

modGenes = annot$Name[match(modProbes, annot$gene_symbol)]

I have a doubt about what to write in "Name" and "gene_symbol" fields. I think that is the error.

in my dataExprhigado the head is this

gene_symbol H1.1
EGR_11327   218.445907246019
EGR_11326   234.658689424435
EGR_11324   17.0660865035952

and in the annotation file is:

0   WormBase_imported   gene    6894    7124    .   -   .   ID=gene:EgrG_002011600  Name=EgrG_002011600 biotype=protein_coding

So, to sum up, i think the error is that i do not know what do i have to type in the field Name and gene_symbol from this line:

modGenes = annot$Name[match(modProbes, annot$gene_symbol)]

Thank you again!

ADD REPLY
0
Entering edit mode

Now all resolved, or ... ?

ADD REPLY
0
Entering edit mode

Hi Kevin! Thank You for your help. Still not solved, because modGenes seems to be an empty file... thanks!

ADD REPLY
0
Entering edit mode

Difficult for me to debug from here. What is the output of str(annot)?

ADD REPLY
0
Entering edit mode

hi again Kevin, and thank you for your patiente. I will tell you what i have done now. 1st of all my annotation file, was wrong, so i changed it (in the command line says the same name that before, but it is just a "practical" way, the file now is differente). I update what i do (and tell you too what str annot says

PART I

Script of module preservation and its output: HERE

Head of higadoData

head(higadoData)
  gene_symbol       H1.1       H1.2       H1.4       H3.1       H282       H303
1   EGR_11327  218.44591  368.56225  184.88159  167.85584  221.62129  409.12805
2   EGR_11326  234.65869  371.67686  428.80913  524.41236  486.30644  350.82002
3   EGR_11324   17.06609   19.72587   41.62256   39.49549   23.10743   55.39263
4   EGR_11318 2905.50123 1716.15040 3232.03996 2436.65242 3988.13296 3286.62962
5   EGR_11315  663.87076  483.80283  479.14339  262.20618  754.14260 1433.40588
6   EGR_11313  983.85989 1006.01920 1461.62933 2749.32507 1319.22439 3939.67962

Wcgna to Cytoscape script and output

> module = "black"
> probes = names(datExprhigado)
> annot = read.csv(file = "anotacion.csv")
> TOM = TOMsimilarityFromExpr(datExprhigado, power = 18)
TOM calculation: adjacency..
..will use 4 parallel threads.
 Fraction of slow calculations: 0.000000
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
> inModule = is.finite(match(moduleColorsHigado, module))
> modProbes = probes[inModule]
> modGenes = annot$Name[match(modProbes, annot$GeneID)] #this line changed, i also tried with locus_tag , but same thing.
> modTOM = TOM[inModule, inModule]
> dimnames(modTOM) = list(modProbes, modProbes)
> cyt = exportNetworkToCytoscape(modTOM, edgeFile =
+ paste("CytoscapeInput-edges-", paste(module, collapse="-"),
+ ".txt", sep=""), nodeFile = paste("CytoscapeInput-nodes-",
+ paste(module, collapse="-"), ".txt", sep=""), weighted =
+ TRUE, threshold = 0, nodeNames = modProbes, altNodeNames =
+ modGenes, nodeAttr = moduleColorsHigado[inModule])
ADD REPLY
0
Entering edit mode

PART II

Head of annot (this is the annotation file that i have changed . it is a new file, not a modifed one and the source is here [https://www.ncbi.nlm.nih.gov/genome/browse/#!/proteins/10706/50662%7CEchinococcus%20granulosus/][2] )

head(annot)
  X.Name      Accession  Start   Stop Strand   GeneID Locus locus_tag
1     Un NW_020170438.1 427312 434605      - 36342241    NA EGR_06526
2     Un NW_020170438.1 468388 471018      + 36342243    NA EGR_06528
3     Un NW_020170439.1 356859 361410      + 36342288    NA EGR_06573
4     Un NW_020170439.1 362106 367883      - 36342289    NA EGR_06574
5     Un NW_020170439.1 391807 398323      + 36342292    NA EGR_06577
6     Un NW_020170439.1 412807 417032      - 36342295    NA EGR_06580
  Protein.product Length                       Protein.Name
1  XP_024349839.1    284     hypothetical protein EGR_06526
2  XP_024349841.1    142    G-protein-signaling modulator 2
3  XP_024349782.1    562 Origin recognition complex subunit
4  XP_024349783.1    292      Mitochondrial carrier protein
5  XP_024349786.1    268     hypothetical protein EGR_06577
6  XP_024349789.1     95     hypothetical protein EGR_06580
>

And finally, the str commands you asked me and its output

str(modProbes)
 chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" "EGR_10234" ...

str(modTOM)
 num [1:306, 1:306] 1 0.1531 0.0905 0.0385 0.0181 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" ...
  ..$ : chr [1:306] "EGR_10759" "EGR_10652" "EGR_10430" "EGR_10293" ...

str(annot)
'data.frame':   11319 obs. of  11 variables:
 $ X.Name         : chr  "Un" "Un" "Un" "Un" ...
 $ Accession      : chr  "NW_020170438.1" "NW_020170438.1" "NW_020170439.1" "NW_020170439.1" ...
 $ Start          : int  427312 468388 356859 362106 391807 412807 431647 448990 453081 486099 ...
 $ Stop           : int  434605 471018 361410 367883 398323 417032 432700 449131 460320 487128 ...
 $ Strand         : chr  "-" "+" "+" "-" ...
 $ GeneID         : int  36342241 36342243 36342288 36342289 36342292 36342295 36342297 36342299 36342301 36342305 ...
 $ Locus          : logi  NA NA NA NA NA NA ...
 $ locus_tag      : chr  "EGR_06526" "EGR_06528" "EGR_06573" "EGR_06574" ...
 $ Protein.product: chr  "XP_024349839.1" "XP_024349841.1" "XP_024349782.1" "XP_024349783.1" ...
 $ Length         : int  284 142 562 292 268 95 335 31 498 119 ...
 $ Protein.Name   : chr  "hypothetical protein EGR_06526" "G-protein-signaling modulator 2" "Origin recognition complex subunit" "Mitochondrial carrier protein" ...

After all of this, i may get the .txt input files to cytoscape, BUT the column fromAltName and toAltName still says N/A, as you may see in this image:

![https://ibb.co/rmvyWLb][3]

Im not really sure what is happening, i thought the problema was that when i wrote "gene_symbol" ,as in the other messages i told you, because in the annot object there is no column called like this. But i tried changing to GeneID and to locus_tag and still is the same...

Thank you for you kindly help and patience!

ADD REPLY
0
Entering edit mode

No hay de que. Es aún difícil saber lo que está pasando. Pues / so, the issue is most likely here:

modGenes = annot$Name[match(modProbes, annot$GeneID)]

I think that it should be / debe ser:

modGenes = annot$X.Name[match(modProbes, annot$locus_tag)]

...oppure:

modGenes = annot$Protein.Name[match(modProbes, annot$locus_tag)]
modGenes = annot$Accession[match(modProbes, annot$locus_tag)]
ADD REPLY

Login before adding your answer.

Traffic: 2531 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