Circos 教程___001

本文档详细介绍了在CentOS 6.5环境下安装Circos的步骤,包括安装必要的Perl模块、配置环境变量及验证安装是否成功的方法。

安装篇

官方安装指导资料
寂寞先生___Circos教程系列

由于官方文档基于 Ubuntu和windows给出安装指导,而我平时使用的系统CentOS6.5,所以不得不进行如下操作:

perl -v
### This is perl, v5.10.1 (*) 
 which perl
### /usr/bin/perl

sudo yum install gd gd-devel
#查看哪些模块需要被安装
cd software/circos-0.69-5/bin
./list.modules 

#或者查看哪些模块未被安装
circos -modules |grep missing
### missing            Params::Validate

sudo perl -MCPAN -e shell
#安装缺失的模块
cpan> install Params::Validate
cpan> install Module::Build

#同时安装多个缺失模块
cpan> install Carp Config::General Cwd Data::Dumper Digest::MD5 File::Basename File::Spec::Functions File::Temp FindBin Font::TTF::Font GD GD::Image Getopt::Long IO::File List::MoreUtils List::Util Math::Round Math::Trig Math::VecStat Memoize Params::Validate Pod::Usage POSIX Readonly Regexp::Common Statistics::Basic Storable Sys::Hostname Text::Balanced Text::Format Time::HiRes

cpan>
#由于cpan下安装Params::Validate还是安装失败,可能是依赖关系导致的?
#之后就卸载了该模块,重新用yum安装了,很神奇,I MADE IT!!!
sudo yum search perl-Params-Validate
sudo yum install perl-Params-Validate.x86_64

#环境变量的设置
echo 'export PATH="/path/software/circos-0.69-5/bin:$PATH"' >> ~/.bash_profile

#成功之后,运行命令,如果显示如下的信息,则你成功的安装了Circos。
circos -man

这里写图片描述

perl 一些基本命令

#列出每个安装的模块的信息
perldoc perllocal

#列出安装的模块
perldoc -t perllocal |grep "Module"

#查看perl模块使用的默认位置
perl -V

#查看所有模块和库的安装目录
perl -e 'print join "\n",@INC'

#删除已安装的perl模块(1)
##找到所有模块和库的安装目录,到这些目录下找到对应的pm删除掉就可以了
#删除已安装的perl模块(2)
##首先安装模块App::pmuninstall
cpan> install App::pmuninstall
#再利用此模块中的工具卸载模块,但此工具仅支持部分模块的卸载
pm-uninstall Params::Validate

#获得帮助  
cpan> h  

#列出CPAN上所有模块的列表  
cpan> m  

#根据关键字在CPAN上查找某个模块:
cpan> i /scws/

#退出  
cpan> q 

未完待续~

D:\circos_install_windows\circos-0.69-6\fmri_circos_output_AD>perl ..\bin\circos -conf circos_AD.conf debuggroup summary 0.13s welcome to circos v0.69-6 31 July 2017 on Perl 5.028001 debuggroup summary 0.13s current working directory D:/circos_install_windows/circos-0.69-6/fmri_circos_output_AD debuggroup summary 0.13s command ..\bin\circos -conf circos_AD.conf debuggroup summary 0.13s loading configuration from file circos_AD.conf debuggroup summary 0.13s found conf file circos_AD.conf debuggroup summary 0.13s debug will appear for these features: output,summary debuggroup summary 0.14s bitmap output image ./.\fmri_connectome_AD.png debuggroup summary 0.14s parsing karyotype and organizing ideograms debuggroup summary 0.14s karyotype has 90 chromosomes of total size 90,000 debuggroup summary 0.15s applying global and local scaling debuggroup summary 0.16s allocating image, colors and brushes Use of uninitialized value in subroutine entry at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos.pm line 720, <F> line 92. *** CIRCOS ERROR *** cwd: D:/circos_install_windows/circos-0.69-6/fmri_circos_output_AD command: ..\bin\circos -conf circos_AD.conf Cannot guess the location of file [HASH]. Tried to look in the following directories D:\circos_install_windows\circos-0.69-6\fmri_circos_output_AD D:\circos_install_windows\circos-0.69-6\fmri_circos_output_AD\etc D:\circos_install_windows\circos-0.69-6\fmri_circos_output_AD\data D:\circos_install_windows\circos-0.69-6 D:\circos_install_windows\circos-0.69-6\etc D:\circos_install_windows\circos-0.69-6\data D:\circos_install_windows D:\circos_install_windows\etc D:\circos_install_windows\data D:\ D:\etc D:\data . etc data .. ..\etc ..\data ..\.. ..\..\etc ..\..\data ..\..\.. ..\..\..\etc ..\..\..\data D:\circos_install_windows\circos-0.69-6\bin D:\circos_install_windows\circos-0.69-6\bin\etc D:\circos_install_windows\circos-0.69-6\bin\data D:\circos_install_windows\circos-0.69-6 D:\circos_install_windows\circos-0.69-6\etc D:\circos_install_windows\circos-0.69-6\data D:\circos_install_windows D:\circos_install_windows\etc D:\circos_install_windows\data D:\ D:\etc D:\data If you are having trouble debugging this error, first read the best practices tutorial for helpful tips that address many common problems http://www.circos.ca/documentation/tutorials/reference/best_practices The debugging facility is helpful to figure out what's happening under the hood http://www.circos.ca/documentation/tutorials/configuration/debugging If you're still stumped, get support in the Circos Google Group. http://groups.google.com/group/circos-data-visualization Please include this error, all your configuration, data files and the version of Circos you're running (circos -v).Do not email me directly -- please use the group. Stack trace: at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos/Error.pm line 425, <F> line 92. Circos::Error::fatal_error("io", "cannot_find", "HASH", " D:\\circos_install_windows\\circos-0.69-6\\fmri_circos_output_A"...) called at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos/Utils.pm line 662 Circos::Utils::locate_file("file", HASH(0x5befc40), "name", undef) called at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos/Font.pm line 102 Circos::Font::get_font_file_from_key("sans") called at D:/Strawberry/perl/lib/Memoize.pm line 249 Memoize::_memoizer(CODE(0x55131c0), "sans") called at (eval 114) line 1 Memoize::__ANON__("sans") called at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos/Font.pm line 240 Circos::Font::sanity_check() called at D:/circos_install_windows/circos-0.69-6/bin/../lib/Circos.pm line 726 Circos::run("Circos", "configfile", "circos_AD.conf", "_argv", "-conf circos_AD.conf", "_cwd", "D:/circos_install_windows/circos-0.69-6/fmri_circos_output_AD") called at ..\bin\circos line 536这个到底是什么问题,我的字体是可以用的,怎么修改下列的conf文件# Circos配置文件 - fMRI脑区连接可视化 (AD) # 包含必需的housekeeping配置 <<include etc/housekeeping.conf>> # 字体定义 <fonts> <sans> type = truetype <params> fontfile =D:/circos_install_windows/circos-0.69-6/fonts/modern/arial.ttf </params> </sans> default_font = sans </fonts> # 定义karyotype karyotype = karyotype.txt # 基本设置 chromosomes_units = 1000 chromosomes_display_default = yes # 图像设置 <image> dir = . file = fmri_connectome_AD.png png = yes radius = 1500p angle_offset = -90 auto_alpha_colors = yes auto_alpha_steps = 5 background = white </image> # 理想图设置 (ideogram) <ideogram> <spacing> default = 0.005r </spacing> # 理想图位置和大小 radius = 0.90r thickness = 20p fill = yes stroke_color = dgrey stroke_thickness = 2p # 显示标签 show_label = yes label_radius = 1.05r label_size = 8p label_parallel = yes label_case = lower label_format = eval(sprintf("%.10s",var(label))) # 显示刻度 show_ticks = yes show_tick_labels = no <ticks> radius = 1r color = black thickness = 2p multiplier = 1e-6 format = %d <tick> spacing = 200u size = 10p show_label = no label_size = 8p label_offset = 10p format = %d </tick> <tick> spacing = 1000u size = 15p show_label = no label_size = 10p label_offset = 10p format = %d </tick> </ticks> </ideogram> # 连接设置 (links) <links> <link> file = links.txt radius = 0.85r bezier_radius = 0.1r thickness = 2p # This will be overridden by link-specific thickness in links.txt color = red_a3 # This will be overridden by link-specific color in links.txt </link> </links> # 颜色定义 <colors> red = 227,74,60 purple = 155,89,182 orange = 230,126,34 green = 39,174,96 yellow = 243,156,18 blue = 52,152,219 violet = 142,68,173 teal = 26,188,156 grey = 149,165,166 red_a1 = 227,74,60,0.3 red_a2 = 227,74,60,0.5 red_a3 = 227,74,60,0.7 red_a4 = 227,74,60,1.0 blue_a1 = 52,152,219,0.3 blue_a2 = 52,152,219,0.5 blue_a3 = 52,152,219,0.7 blue_a4 = 52,152,219,1.0 </colors> # 模式定义 (patterns - currently empty but good to include) <patterns> </patterns>
07-11
### 问题分析 在 Circos 的配置过程中,出现 `ERROR Cannot guess the location of file [HASH]` 错误提示,通常与字体路径的解析失败有关。Circos 在渲染图像时依赖于 GD 库来处理字体加载,若字体文件路径未正确配置,或字体文件缺失,则会导致该错误。此外,某些版本的 Circos 配置中可能使用了不兼容的字体名称或路径格式,进一步引发此类问题。 ### 解决方法 #### 1. 确认字体文件路径 确保在配置文件中指定的字体名称与实际存在于 Circos 安装目录下的字体文件相匹配。例如,在 `<fonts>` 块中定义的字体应指向有效的 `.ttf` 文件: ```xml <fonts> <sans> type = truetype file = D:/circos_install_windows/circos-0.69-6/fonts/modern/arial.ttf </sans> default_font = sans </fonts> ``` 如果字体文件路径不存在或拼写错误,Circos 将无法找到对应的字体资源[^1]。 #### 2. 使用绝对路径显式定义字体 为了避免字体路径解析失败,可以在配置文件中通过 `<params>` 显式指定字体文件的绝对路径: ```xml <params> fontfile = D:/circos_install_windows/circos-0.69-6/fonts/sans.ttf </params> ``` 这样可以绕过 Circos 内部对字体路径的自动推导机制,确保字体文件被正确加载。 #### 3. 检查字体文件是否存在 在 Windows 或 Linux 环境下运行 Circos 之前,应确认所引用的字体文件确实存在于指定路径中。例如,检查以下路径是否包含所需的 `.ttf` 文件: ``` D:/circos_install_windows/circos-0.69-6/fonts/ ``` 若字体文件缺失,可以从网络下载并手动复制到该目录下。 #### 4. 使用系统支持的字体 如果默认字体不可用,可以尝试替换为操作系统已安装的字体。例如,将配置文件中的字体更改为系统默认字体(如 `dejavu` 或 `verdana`),前提是这些字体已经存在于 Circos 的字体目录中。 #### 5. 调试字体加载过程 为了验证字体是否能够被正确加载,可以使用 Python 脚本测试 GD 库是否能成功打开字体文件: ```python from PIL import Image, ImageDraw, ImageFont # 创建空白图像 img = Image.new('RGB', (200, 100), color=(73, 109, 137)) d = ImageDraw.Draw(img) # 加载字体 try: fnt = ImageFont.truetype("D:/circos_install_windows/circos-0.69-6/fonts/sans.ttf", 40) d.text((10, 10), "Hello World", font=fnt, fill=(255, 255, 0)) img.show() except IOError: print("无法加载字体文件,请检查路径和文件是否存在。") ``` #### 6. 修改 Circos 启动脚本以调试路径问题 可以通过修改 `circos` 可执行脚本,添加 `-debug` 参数来输出详细的日志信息,帮助定位字体路径问题: ```bash ./circos -conf circos.conf -debug ``` 这将显示完整的字体查找过程,有助于判断问题根源。 --- ### 示例代码:配置字体路径 以下是一个完整的 Circos 配置片段,展示如何通过 `<params>` 显式定义字体文件路径: ```xml <image> dir = . file = circos.png png = yes svg = no radius = 1500p background = white stroke_color = black stroke_thickness = 2 font = sans </image> <params> fontfile = D:/circos_install_windows/circos-0.69-6/fonts/sans.ttf </params> ``` --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值