Skip to content

Pathview is not assigning colours for the equation-by-equation timepoints #6

Description

@galenseilis

This minimum example from the documentation works for multiple columns:

library(pathview)

sim.cpd.data=sim.mol.data(mol.type="cpd", nmol=3000)
sim.cpd.data2 = matrix(sample(sim.cpd.data, 18000,
                              replace = T), ncol = 6)
i <- 3

pv.out <- pathview(gene.data = gse16873.d[, 1:6],
                   pathway.id = "00640",
                   species = "hsa",
                   keys.align = "y",
                   kegg.native = T,
                   match.data = F,
                   multi.state = T,
                   same.layer = T
                   )

hsa00640 gse16873 cpd 3-2s multi

This section of code from NewFullRNASeqPipeline.R works for a single condition:

#__________Python Enrichment_________#
percentiles <- c(.99, .95, .90)
test <- keggEnrichmentOnPercentiles(formatedCSVThereshold0, percentiles, metric="score", outputDir=OutputFileDirectory)

pathways <- py_GetAllPathwaysOfSig(test, p_cutoff=1.0)
pathways <- pathways[pathways != 'cme01100' & pathways != 'cme01110'] # Exclude these larger diagrams

keggDataFrame <- py_getKEGGDataframe(formatedCSVThereshold0)

colnames(keggDataFrame)

# kegg_LFC <- keggDataFrame[,c("LFC_LP1hVRM1h", "LFC_LP2hVRM2h", "LFC_LP24hVRM24h", "LFC_LP49hVRM49h")]
scoreFilteredDataFrame = keggDataFrame['Score_LPvRM' >= 33] # 33 comes from LP manuscript; not for general purpose
kegg_LFC <- scoreFilteredDataFrame[,c(paste("LFC_", treated, "v", control, sep="")), drop=FALSE]

#Flip sign so that legend shows green as positive and red negative.
kegg_LFC <- -1*kegg_LFC

#pathview(gene.data = kegg_LFC, pathway.id = "cme03030", species = "cme", gene.idtype = "KEGG",plot.col.key=FALSE)

#kegg_LFC["CYME_CMK133C",]

pv.out.list <- sapply(
  pathways,
  function(pid) pathview(
    gene.data = kegg_LFC,
    pathway.id = pid,
    species = "cme",
    gene.idtype = "KEGG",
    plot.col.key=FALSE
    )
  )

cme00030 pathview

The following approach uses the LPRM data, but the same args as the minimum working example. But it doesn't work. The pathway diagrams are generated, but assigned values are all white.

source("NewFullRNAseqPipeline_metadata.R")

pathways <- scan("../Annotations/Annotations/kegg_pathways.csv", character())
pathways <- pathways[pathways != 'cme01100' & pathways != 'cme01110'] # Exclude these larger diagrams

timepoints <- unique(coldata$timepoint)

t_dfs <- data.frame()
c <- 0
for (t in timepoints) {
  c <- c + 1
  print(t)
  t_col <- coldata[coldata$timepoint == t,]
  t_cts <- cts[grepl(t, colnames(cts))]
  dds <-DESeqDataSetFromMatrix( countData = t_cts,
                                colData = t_col,
                                design = configDesign)
  dds <- DESeq(dds)
  res <- results(dds)
  t_res <- as.data.frame(res)[c("log2FoldChange", "padj")]
  
  t_res$log2FoldChange <- ifelse(t_res$padj < 0.01, t_res$log2FoldChange, 0)
  t_res <- t_res['log2FoldChange']
  names(t_res)[names(t_res) == 'log2FoldChange'] <- paste(t, c, sep='_')
  if (nrow(t_dfs) == 0){
    t_dfs <- t_res
  } else {
    t_dfs = merge(t_dfs, t_res, by="row.names", all=TRUE)
    rownames(t_dfs) <- t_dfs$Row.names
    t_dfs <- subset(t_dfs, select=-c(Row.names))
  }
  }


kegg_LFC <- t_dfs * -1
kegg_LFC <- na.omit(kegg_LFC)
pv.out.list <- sapply(pathways,
                      function(pid) pathview(
                        gene.data = kegg_LFC,
                        pathway.id = pid,
                        species = "cme",
                        gene.idtype = "KEGG",
                        limit = c(min(kegg_LFC), max(kegg_LFC)),
                        keys.align = "y",
                        kegg.native = T,
                        match.data = F,
                        multi.state = T,
                        same.layer = T,
                        plot.col.key=FALSE
                        )
                      )

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions