该软件发表在Science的子刊
运行示例已经写的非常清楚了,这里就不做任何的解释了
主要会遇到的问题进行记录
首先第一个问题,pcst_fast的安装:
可能由于兼容性问题,在使用pip install pcst_fast
在python3.8中无法下载有两种解决办法
- 安装3.7版本的python
- 进入Github主页,下载pcst_fast,解压后进入文件夹,使用下面的代码安装
python setup.py install
第二个问题就是在调用JobRun_Parallel.R
中的system("python gen_PCSF.py")
函数的时候,可能会出现找不到python的问题.
这时候得看一下系统Python链接
ls -l /usr/bin/python*
确保如下链接没有问题
这时候就可以按官方指导运行软件
补充1
可能是我自己的数据问题,在运行的过程中会出现NA值,在使用python脚本调用的时候会报错
这时候需修改一下python脚本中的部分代码,修改部分如下:
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 16 12:09:32 2018
@author: Administrator
"""
import numpy
import pcst_fast
Edge = numpy.loadtxt("../../IntegratedNet_edge.txt", dtype = 'int64', delimiter = "\t")
Cost = numpy.loadtxt("IntegratedNet_edgeCost.txt", dtype = 'str')
Prize = numpy.loadtxt("../IntegratedNet_nodePrize.txt",dtype='str')
rootNode = numpy.loadtxt("../../RootNode.txt", dtype = 'int64')
Prize = numpy.char.replace(Prize, 'NA','0').astype(numpy.float64)
Cost = numpy.char.replace(Cost, 'NA','0').astype(numpy.float64)
# vertices, edges = pcst_fast(edges, prizes, costs, root, num_clusters, pruning, verbosity_level)
# root: the root note for rooted PCST. For the unrooted variant, this parameter should be -1.
# verbosity_level: an integer indicating how much debug output the function should produce. Note that the user should include this parameter.
PCSF_node, PCSF_edge =pcst_fast.pcst_fast(Edge, Prize, Cost, rootNode, 1, 'strong', 0)
numpy.savetxt("PCSF_Node.txt", PCSF_node, fmt='%d') #-correct
numpy.savetxt("PCSF_Edge.txt", PCSF_edge, fmt='%d')