Hey ya'll,

Struggling here.

The dataframe was generated using a new package called InterCom ([https://github.com/saschajung/InterCom][1]), which basically determines ligand receptor pairing and also together with sending and receiving cells using scRNA-seq data. Incredibly useful if you ask me.

Here is a sample of my data:

    "score" "significance" "lig.rec.pop" "ligand.receptor"
    25507.7307692308 0.950689655172414 "undef_acinar" "FSTL1_BMPR1A"
    113286.378762542 0.994068965517241 "mesenchymal_acinar" "FSTL1_BMPR1A"
    56944.7025939177 0.989103448275862 "endothelial_acinar" "FSTL1_BMPR1A"
    24467.0634475014 0.94551724137931 "mesenchymal_acinar" "BMP4_BMPR1A"
    45149.7188075585 0.985034482758621 "mesenchymal_acinar" "BMP4_BMPR2"
    20099.7619047619 0.916 "blood_acinar" "IL1B_IL1R1"
    19786.641 0.913310344827586 "alpha_acinar" "VTN_ITGAV"
    56609.9870823529 0.989034482758621 "mesenchymal_acinar" "FN1_ITGAV"


The maximum score value is 6611701.91, and the score minimum value is 36320.27,

Could someone help me get started with a good way to scale the data (if I even need to?, and generate a ComplexHeatmap? My main struggle is figuring out how to get it into the format to plug it into ComplexHeatmap.

I was able to do it through ggplot2, but I want to do it through ComplexHeatmap as I think it is easier to add bells and whistles. The only reason I was able to do it using ggplot2 was because I specified the what x, y and scores to use:

      ggplot(hm, aes(x = ligand.receptor, y = lig.rec.pop, fill = score)) +
      geom_tile() + theme(axis.text.x = element_text(angle = 90))

Ideally, I would love a heatmap/plot like this: 

![enter image description here][2]

I realize that adding the time points (ie. week 7 and 9) might be a matter of adding meta data. but really if someone could just help me get started - I would be grateful.

Thank you in advance!

    Image Citation: Gonçalves, C.A., Larsen, M., Jung, S. et al. A 3D system to model human pancreas development and its reference single-cell transcriptome atlas identify signaling pathways required for progenitor expansion. Nat Commun 12, 3144 (2021). https://doi.org/10.1038/s41467-021-23295-6


  [1]: https://github.com/saschajung/InterCom
  [2]: /media/images/1a0a4c91-f922-495b-8927-f5671604
Below chunk will convert your data to complexheatmap data format. U can then modify the heatmap.

Assuming your data is in **tdf** data frame.

    lig = unique(tdf$lig.rec.pop)
    rec = unique(tdf$ligand.receptor)
    
    mat = matrix(0,nrow = length(lig), ncol = length(rec))
    rownames(mat) = lig
    colnames(mat) = rec
    
    for(i in 1:nrow(tdf))
    {
      mat[tdf$lig.rec.pop[i], tdf$ligand.receptor[i]] = tdf$score[i]
    }
    
    Heatmap(mat)


