ConsensusClusterPlus dosesn't make an output file
1
0
Entering edit mode
Diana • 0
@99444b2e
Last seen 12 weeks ago
Russia

Enter the body of text here

I am trying to run ConsensusClusterPlus in a Jupyter notebook with code below. And I can't find the output file anywhere. I tried pdf and png options.

to set environmet, I use:

import os os.environ['R_HOME'] = 'C:\Folder\R' import rpy2.robjects as ro from rpy2.robjects import pandas2ri pandas2ri.activate() %load_ext rpy2.ipython %cd D:\Coding\Workdir

# here is the data preparation
data_for_cluster <- read.csv('data_log2_centered.csv', header = TRUE)
data_for_cluster <- data.frame(data_for_cluster[,-1], row.names = data_for_cluster[,1])

# get  1500 most variable genes, measured by median absolute deviation
mads=apply(data_for_cluster,1,mad)
# write.csv(mads, 'mads.csv', row.names = TRUE)
data_for_cluster <- data_for_cluster[rev(order(mads))[1:1500],]

# convert dataframe to  matrix
data_for_cluster_mat <- data.matrix(data_for_cluster) 
data_for_cluster_mat[0:3, 0:3]

# run CCP

library("ConsensusClusterPlus")
title=tempdir()
results = ConsensusClusterPlus(data_for_cluster, maxK=5,reps=50, pItem=0.8, pFeature=1,
                title=title,clusterAlg="hc", distance="pearson", seed=42, plot='png')
ConsensusClusterPlus RNASeqData • 262 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 11 hours ago
United States

Here's the relevant section of the function:

if(is.null(plot)){
    ##nothing
  }else if(plot=="pngBMP"){
    bitmap(paste(title,"/","consensus%03d.png",sep=""))
  }else if(plot=="png"){
    png(paste(title,"/","consensus%03d.png",sep=""))

By setting title <- tempdir() you are writing the png out in a temporary directory instead of your working directory.

0
Entering edit mode

Thank you!

ADD REPLY

Login before adding your answer.

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