溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

table2itol怎么安裝設置

發(fā)布時間:2022-03-19 13:48:20 來源:億速云 閱讀:725 作者:iii 欄目:開發(fā)技術

本篇內(nèi)容介紹了“table2itol怎么安裝設置”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

table2itol簡介

table2itol是在GitHup上公開的R語言包,其作用是專門為iTOL生成所需的注釋文件,只需準備表格形式的數(shù)據(jù),包含配色方案的注釋文件就會自動生成,極大提高了準備注釋文件的效率。

table2itol下載安裝

對于習慣使用Linux系統(tǒng)的同學,可以這樣安裝:

wget https://github.com/mgoeker/table2itol/archive/master.zip 
unzip master.zip 
## 測試 
cd table2itol-master
Rscript table2itol.R  
chmod +x table2itol.R  
./table2itol.R

習慣使用Windows系統(tǒng)的同學,可以這樣安裝:

GitHup上直接下載table2itol壓縮包,解壓后放在 F:\software 文件夾下。在R或Rstudio中導入table2itol.R。

setwd("F:/software/table2itol-master")
source("table2itol.R")

table2itol依賴包安裝

在R或Rstudio中,安裝方法如下:

### 安裝依賴包 
site="https://mirrors.tuna.tsinghua.edu.cn/CRAN" 
# 依賴包列表:參數(shù)解析、數(shù)據(jù)變換、繪圖和開發(fā)包安裝、安裝依賴、ggplot主題 
package_list = c("grid","ggplot2","gridExtra","vegan","reshape2","readODS") 
# 判斷R包加載是否成功來決定是否安裝后再加載 
for(p in package_list){  
    if(!suppressWarnings(suppressMessages(require(p, character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE)))){   
        install.packages(p, repos=site)   
        suppressWarnings(suppressMessages(library(p, character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE)))   
    } 
}  
#### 安裝缺少的R包 
source("http://bioconductor.org/biocLite.R") 
biocLite(c("optparse", "plotrix", "readODS", "readxl", "yaml"))

輸入文件準備

table2itol的輸入文件格式很多,以最常用的表格為例

選項設置

table2itol.R的選項有很多,不同選項可生成不同的注釋文件,選項列表如下:

Options:
        -a, --abort
                Abort if a requested column cannot be found instead of just skipping the data set [default: FALSE]
        -b NAME, --background=NAME
                Column to define the background colours of the tip labels; empty means no background colours [default: ]
        -c NAME, --conversion=NAME
                Convert integer columns to factors ('factor') or numbers with decimal points ('double') or just not 0/1 to logical vectors ('keep') [default: none]
        -C FILE, --colour-file=FILE
                File in YAML format defining alternative colour vectors for domain output [default: ]
        -d, --double-to-bars
                Create bar charts, not gradients, from numbers with decimal points ('double') [default: FALSE]
        -D DIR, --directory=DIR
                Place output files in this directory ('.' means working directory, empty means input file directory) [default: .]
        -e NAME, --emblems=NAME
                Column to define symbol assignments; ignored if empty [default: ]
        -f NUMBER, --favour=NUMBER
                Numeric factor for favouring colours over symbols (higher => more colours relative to symbols) [default: 1]
        -G FILE, --gradient-file=FILE
                File in YAML format defining alternative colours for gradient and binary output [default: ]
        -h, --help
                Show this help message, then exit [default: FALSE]
        -i NAME, --identifier=NAME
                Mandatory identifier column; after modification as defined by --template this column must yield the tip labels of the tree [default: ID]
        -j NAME, --identifier2=NAME
                Optional 2nd identifier column, causing output of branchsymbols; together with -i this identifies a node [default: ]
        -l NAME, --label=NAME
                Column to define the tip labels displayed in the picture in place of the tip labels found in the tree [default: Label]
        -m INTEGER, --max-size=INTEGER
                Exceeding this threshold causes fewer colours and more symbols to be selected (see also --favour); also determines size of branch symbols [default: 20]
        -n TEXT, --na-strings=TEXT
                Sentinels for missing input values; several can be provided, separated by the value of --separator [default:    (null)  NA]
        -o NUMBER, --opacity=NUMBER
                Numeric factor for the transparency of the colours (0 => transparent, 1 => fully opaque) [default: 1]
        -p INTEGER, --precision=INTEGER
                Number of decimal points used in the gradient legends [default: 1]
        -r TEXT/NUMBER, --restrict=TEXT/NUMBER
                How to select from numeric values that yield branch symbols [default: ]
        -s CHARACTER, --separator=CHARACTER
                Input column separator for CSV-like files [default:     ]
        -t PATTERN, --template=PATTERN
                Template for sprintf function to convert ID column when deviating from tip labels [default: %s]
        -w NUMBER, --width=NUMBER
                Border with used for domains, colour strips etc. [default: 0.5]

也可在解壓安裝目錄下的 table2itol_help.txt 文件或者直接調(diào)用幫助信息查看。大家靈活選擇使用的選項即可。

生成注釋文件

文件準備完成后就需要生成注釋文件了,有兩種方式生成:一種為linux下命令行運行方式,另一種是在R或Rstudio中運行。

linux下命令行運行:

./table2itol.R --na-strings X --identifier Tip --label Name ann1.tsv ann2.tsv

R或Rstudio中運行:

source("table2itol.R") 
create_itol_files(infiles = c("ann1.tsv", "ann2.tsv"),
   identifier = "Tip", label = "Name", na.strings = "X")

“table2itol怎么安裝設置”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識可以關注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI