BostonGene / MFP

Mollecular Functional Portraits
Other
33 stars 13 forks source link

R implementation of louvain clustering #6

Open Yaseswini opened 2 years ago

Yaseswini commented 2 years ago

Hi,

Thanks for the great work! I am trying to reproduce the Louvain clustering algorithm results using R. I am following the methods section of your paper and also the python code . But I think I am missing a step or two in working towards achieving the same cluster annotations as in your paper . I am wondering if any of you could help!

  1. Downloaded the pan-cancer signatures file from https://science.bostongene.com/tumor-portrait/downloads ( downloads -> TCGA -> signatures.csv ).

  2. Filtered the normalized ssgsea scores for pancreatic adenocarcinoma(PAAD) samples ( n = 146 ) . Resultant matrix ( M ) is 29 * 146

  3. Performed patient wise correlation on the matrix M using pearson -> Resultant is a 146 146 matrix of correlations between the patients. Code is below . Bagaev_TCGA_signatures is a 29 146 matrix containing the ssgsea scores

    _correlation_matrix = cor( bagaev_TCGAsignatures , method = "pearson" )

  4. Filtered out correlations less than 0.45

    cor_to_dist = cor2dist( correlation_matrix ) cor_to_dist[ which( abs( correlation_matrix ) < 0.45 ) ] = 0 diag(cor_to_dist) = 0

  5. Converted this data frame to weighted graph using the igraph package

    _correlationGraph = graph.adjacency( cor_todist , method = "undirected" , weighted = "TRUE" , diag = TRUE )

  6. Clustering the graph using louvain clustering ( package : igraph )

_clusterlouvain = clusterlouvain(correlationGraph)

The issue is that the above the louvain clustering gives me 6 clusters instead of 4. Is there any parameter or anything trivial i am missing in implementing your workflow?

Any help would be appreciated ! Thanks Yaseswini