感谢老俊俊的大力支持。我们会每日跟新,欢迎您关注老俊俊的生信笔记。
神器之 computeMatrix + 绘图
介绍
上期 ” Deeptools 神器之 bamCoverage ” 讲到如何将 bam 文件转化为 bigwig 文件可视化每个基因的 reads 覆盖情况,此外如果想对某些特定类型的区域例如 TSS(transcription start site)、TES(transcription end site)和结合的 peaks 中心等结合的富集程度的可视化,可以使用 deeptools 的 computeMatrix + plotHeatmap
或 computeMatrix + plotProfile
来绘图。
computeMatrix 用来计算 bigwig 文件的信号在特定 bed 文件区域的富集程度,可以输入多个 bigwig 文件和 bed 文件计算,输出一个压缩结果文件,后续可接 plotHeatmap 和 plotProfile 进行可视化,使用者可以绘制在任何区间的信号富集密度图。
computeMatrix 有两种模式可以选择:
-
1、scale-regions -
2、reference-point
scale-regions: 该模式将所有 bed 文件的区域缩放到相等的长度,然后计算在给定区域上游和下游多少 bp 之间的区间的信号富集密度。
reference-point: 该模式将以 bed 文件的区域的中点为参考位置,然后根据使用者提供的上游和下游多少 bp 之间的区间,计算该区间内的信号富集密度。
结果展示:
查看参考文档:
# 直接输入回车 $ computeMatrix reference-point $ computeMatrix scale-regions
这两种模式使用的参数大部分相同,就不重复介绍了。
参数说明之:计算信号
reference-point:
computeMatrix reference-point
usage: An example usage is:
computeMatrix reference-point -S <biwig file(s)> -R <bed file> -a 3000 -b 3000
optional arguments:
-h, --help show this help message and exit
Required arguments:
--regionsFileName File [File ...], -R File [File ...]
File name or names, in BED or GTF format, containing the regions to plot. If multiple bed files are given, each one is considered
a group that can be plotted separately. Also, adding a "#" symbol in the bed file causes all the regions until the previous "#" to
be considered one group. (default: None)
--scoreFileName File [File ...], -S File [File ...]
bigWig file(s) containing the scores to be plotted. Multiple files should be separated by spaced. BigWig files can be obtained by
using the bamCoverage or bamCompare tools. More information about the bigWig file format can be found at
http://genome.ucsc.edu/goldenPath/help/bigWig.html (default: None)
Output options:
--outFileName OUTFILENAME, -out OUTFILENAME, -o OUTFILENAME
File name to save the gzipped matrix file needed by the "plotHeatmap" and "plotProfile" tools. (default: None)
--outFileNameMatrix FILE
If this option is given, then the matrix of values underlying the heatmap will be saved using the indicated name, e.g.
IndividualValues.tab.This matrix can easily be loaded into R or other programs. (default: None)
--outFileSortedRegions BED file
File name in which the regions are saved after skiping zeros or min/max threshold values. The order of the regions in the file
follows the sorting order selected. This is useful, for example, to generate other heatmaps keeping the sorting of the first
heatmap. Example: Heatmap1sortedRegions.bed (default: None)
Optional arguments:
--version show program's version number and exit
--referencePoint {TSS,TES,center}
The reference point for the plotting could be either the region start (TSS), the region end (TES) or the center of the region.
Note that regardless of what you specify, plotHeatmap/plotProfile will default to using "TSS" as the label. (Default: TSS)
--beforeRegionStartLength INT bp, -b INT bp, --upstream INT bp
Distance upstream of the reference-point selected. (Default: 500)
--afterRegionStartLength INT bp, -a INT bp, --downstream INT bp
Distance downstream of the reference-point selected. (Default: 1500)
--nanAfterEnd If set, any values after the region end are discarded. This is useful to visualize the region end when not using the scale-regions
mode and when the reference-point is set to the TSS. (default: False)
--binSize BINSIZE, -bs BINSIZE
Length, in bases, of the non-overlapping bins for averaging the score over the regions length. (Default: 10)
--sortRegions {descend,ascend,no,keep}
Whether the output file should present the regions sorted. The default is to not sort the regions. Note that this is only useful
if you plan to plot the results yourself and not, for example, with plotHeatmap, which will override this. Note also that unsorted
output will be in whatever order the regions happen to be processed in and not match the order in the input files. If you require
the output order to match that of the input regions, then either specify "keep" or use computeMatrixOperations to resort the
results file. (Default: keep)
--sortUsing {mean,median,max,min,sum,region_length}
Indicate which method should be used for sorting. The value is computed for each row.Note that the region_length option will lead
to a dotted line within the heatmap that indicates the end of the regions. (Default: mean)
--sortUsingSamples SORTUSINGSAMPLES [SORTUSINGSAMPLES ...]
List of sample numbers (order as in matrix), that are used for sorting by --sortUsing, no value uses all samples, example:
--sortUsingSamples 1 3 (default: None)
--averageTypeBins {mean,median,min,max,std,sum}
Define the type of statistic that should be used over the bin size range. The options are: "mean", "median", "min", "max", "sum"
and "std". The default is "mean". (Default: mean)
--missingDataAsZero If set, missing data (NAs) will be treated as zeros. The default is to ignore such cases, which will be depicted as black areas in
a heatmap. (see the --missingDataColor argument of the plotHeatmap command for additional options). (default: False)
--skipZeros Whether regions with only scores of zero should be included or not. Default is to include them. (default: False)
--minThreshold MINTHRESHOLD
Numeric value. Any region containing a value that is less than or equal to this will be skipped. This is useful to skip, for
example, genes where the read count is zero for any of the bins. This could be the result of unmappable areas and can bias the
overall results. (Default: None)
--maxThreshold MAXTHRESHOLD
Numeric value. Any region containing a value greater than or equal to this will be skipped. The maxThreshold is useful to skip
those few regions with very high read counts (e.g. micro satellites) that may bias the average values. (Default: None)
--blackListFileName BED file, -bl BED file
A BED file containing regions that should be excluded from all analyses. Currently this works by rejecting genomic chunks that
happen to overlap an entry. Consequently, for BAM files, if a read partially overlaps a blacklisted region or a fragment spans
over it, then the read/fragment might still be considered. (default: None)
--samplesLabel SAMPLESLABEL [SAMPLESLABEL ...]
Labels for the samples. This will then be passed to plotHeatmap and plotProfile. The default is to use the file name of the
sample. The sample labels should be separated by spaces and quoted if a label itselfcontains a space E.g. --samplesLabel label-1
"label 2" (default: None)
--smartLabels Instead of manually specifying labels for the input bigWig and BED/GTF files, this causes deepTools to use the file name after
removing the path and extension. (default: False)
--quiet, -q Set to remove any warning or processing messages. (default: False)
--verbose Being VERY verbose in the status messages. --quiet will disable this. (default: False)
--scale SCALE If set, all values are multiplied by this number. (Default: 1)
--numberOfProcessors INT, -p INT
Number of processors to use. Type "max/2" to use half the maximum number of processors or "max" to use all available processors.
(Default: 1)
GTF/BED12 options:
--metagene When either a BED12 or GTF file are used to provide regions, perform the computation on the merged exons, rather than using the
genomic interval defined by the 5-prime and 3-prime most transcript bound (i.e., columns 2 and 3 of a BED file). If a BED3 or BED6
file is used as input, then columns 2 and 3 are used as an exon. (Default: False)
--transcriptID TRANSCRIPTID
When a GTF file is used to provide regions, only entries with this value as their feature (column 3) will be processed as
transcripts. (Default: transcript)
--exonID EXONID When a GTF file is used to provide regions, only entries with this value as their feature (column 3) will be processed as exons.
CDS would be another common value for this. (Default: exon)
--transcript_id_designator TRANSCRIPT_ID_DESIGNATOR
Each region has an ID (e.g., ACTB) assigned to it, which for BED files is either column 4 (if it exists) or the interval bounds.
For GTF files this is instead stored in the last column as a key:value pair (e.g., as 'transcript_id "ACTB"', for a key of
transcript_id and a value of ACTB). In some cases it can be convenient to use a different identifier. To do so, set this to the
desired key. (Default: transcript_id)
...
A.必须参数:
参数 | 说明 |
---|---|
–regionsFileName, -R | bed 或 gtf 格式,需要绘制的靶标区域 |
–scoreFileName, -S | bigwig 文件 |
B.输出参数:
参数 | 说明 |
---|---|
–outFileName, -out, -o | 输出结果文件名 |
–outFileNameMatrix | 输出热图的矩阵结果,可以导入 R 里,e.g. IndividualValues.tab |
–outFileSortedRegions | 输出排序好的 bed 文件结果 |
C.可选参数:
参数 | 说明 |
---|---|
–version | 打印软件版本信息 |
–referencePoint | 参考中心点,3 个 TSS, TES, center 选项,TSS 为 bed 文件第一个位置,TES 为 bed 文件最后一个位置,center 为 bed 文件中间位置,默认 TSS |
–beforeRegionStartLength, -b, –upstream | 参考位置上游长度,默认 500bp |
–afterRegionStartLength, -a, –downstream | 参考位置下游长度,默认 500bp |
–nanAfterEnd | 如果设置该选项则丢弃 bed 最后位置后面的所有信号值 |
–binSize, -bs | bin 的长度,用于计算平均得分,越小分辨率越高,计算量越大 |
–sortRegions | 输出文件是否需要排序,默认不排序,descend, ascend, no, keep,4 个选项,如果需要自己绘图,可以设置 |
–sortUsing | 排序方法,mean, median, max, min, sum, region_length,6 种,默认按 mean 排序 |
–sortUsingSamples | 用样本编号排序,example: –sortUsingSamples 1 3 |
–averageTypeBins | 对 bin 的统计类型,mean, median, min, max, std, sum,6 种,默认 mean |
–missingDataAsZero | 用 0 代替缺失数据 |
–skipZeros | 去除信号为 0 的区域,默认不去除 |
–minThreshold | 最小阈值设定,小于该阈值的被舍弃 |
–maxThreshold | 最大阈值设定,大于该阈值的被舍弃 |
–blackListFileName, -bl | 黑名单区域,去除不想要的区域 |
–samplesLabel | 样本名标签,用于可视化展示,默认为文件名 |
–smartLabels | 智能标签? |
–quiet, -q | 安静模式,不输出警告或处理过程信息 |
–verbose | 打印处理过程信息 |
–scale | 缩放,默认 1 |
–numberOfProcessors, -p | 线程数 |
D.GTF/BED12 参数:
参数 | 说明 |
---|---|
–metagene | 当提供 bed12 或 gtf 格式的区间文件时,会合并外显子后再进行计算,而不是基于含有内含子区域计算,如果提供 bed3 或 bed6 格式的,则第 2 列和第 3 列作为一个外显子 |
–transcriptID | 当区间为 gtf 格式时,使用 transcripts 作为特征来计算 |
–exonID | 当区间为 gtf 格式时,使用 exons 作为特征来计算 |
–transcript_id_designator | 设置特征的选择,默认 transcript_id |
scale-regions:
$ computeMatrix scale-regions usage: An example usage is:
computeMatrix scale-regions -S <biwig file(s)> -R <bed file> -b 1000
optional arguments:
-h, --help show this help message and exit
Required arguments:
--regionsFileName File [File ...], -R File [File ...]
File name or names, in BED or GTF format, containing the regions to plot. If multiple bed files are given, each one is considered
a group that can be plotted separately. Also, adding a "#" symbol in the bed file causes all the regions until the previous "#" to
be considered one group. (default: None)
--scoreFileName File [File ...], -S File [File ...]
bigWig file(s) containing the scores to be plotted. Multiple files should be separated by spaced. BigWig files can be obtained by
using the bamCoverage or bamCompare tools. More information about the bigWig file format can be found at
http://genome.ucsc.edu/goldenPath/help/bigWig.html (default: None)
Output options:
--outFileName OUTFILENAME, -out OUTFILENAME, -o OUTFILENAME
File name to save the gzipped matrix file needed by the "plotHeatmap" and "plotProfile" tools. (default: None)
--outFileNameMatrix FILE
If this option is given, then the matrix of values underlying the heatmap will be saved using the indicated name, e.g.
IndividualValues.tab.This matrix can easily be loaded into R or other programs. (default: None)
--outFileSortedRegions BED file
File name in which the regions are saved after skiping zeros or min/max threshold values. The order of the regions in the file
follows the sorting order selected. This is useful, for example, to generate other heatmaps keeping the sorting of the first
heatmap. Example: Heatmap1sortedRegions.bed (default: None)
Optional arguments:
--version show program's version number and exit
--regionBodyLength REGIONBODYLENGTH, -m REGIONBODYLENGTH
Distance in bases to which all regions will be fit. (Default: 1000)
--startLabel STARTLABEL
Label shown in the plot for the start of the region. Default is TSS (transcription start site), but could be changed to anything,
e.g. "peak start". Note that this is only useful if you plan to plot the results yourself and not, for example, with plotHeatmap,
which will override this. (Default: TSS)
--endLabel ENDLABEL Label shown in the plot for the region end. Default is TES (transcription end site). See the --startLabel option for more
information. (Default: TES)
--beforeRegionStartLength BEFOREREGIONSTARTLENGTH, -b BEFOREREGIONSTARTLENGTH, --upstream BEFOREREGIONSTARTLENGTH
Distance upstream of the start site of the regions defined in the region file. If the regions are genes, this would be the
distance upstream of the transcription start site. (Default: 0)
--afterRegionStartLength AFTERREGIONSTARTLENGTH, -a AFTERREGIONSTARTLENGTH, --downstream AFTERREGIONSTARTLENGTH
Distance downstream of the end site of the given regions. If the regions are genes, this would be the distance downstream of the
transcription end site. (Default: 0)
--unscaled5prime UNSCALED5PRIME
Number of bases at the 5-prime end of the region to exclude from scaling. By default, each region is scaled to a given length (see
the --regionBodyLength option). In some cases it is useful to look at unscaled signals around region boundaries, so this setting
specifies the number of unscaled bases on the 5-prime end of each boundary. (Default: 0)
--unscaled3prime UNSCALED3PRIME
Like --unscaled5prime, but for the 3-prime end. (Default: 0)
--binSize BINSIZE, -bs BINSIZE
Length, in bases, of the non-overlapping bins for averaging the score over the regions length. (Default: 10)
--sortRegions {descend,ascend,no,keep}
Whether the output file should present the regions sorted. The default is to not sort the regions. Note that this is only useful
if you plan to plot the results yourself and not, for example, with plotHeatmap, which will override this. Note also that unsorted
output will be in whatever order the regions happen to be processed in and not match the order in the input files. If you require
the output order to match that of the input regions, then either specify "keep" or use computeMatrixOperations to resort the
results file. (Default: keep)
--sortUsing {mean,median,max,min,sum,region_length}
Indicate which method should be used for sorting. The value is computed for each row.Note that the region_length option will lead
to a dotted line within the heatmap that indicates the end of the regions. (Default: mean)
--sortUsingSamples SORTUSINGSAMPLES [SORTUSINGSAMPLES ...]
List of sample numbers (order as in matrix), that are used for sorting by --sortUsing, no value uses all samples, example:
--sortUsingSamples 1 3 (default: None)
--averageTypeBins {mean,median,min,max,std,sum}
Define the type of statistic that should be used over the bin size range. The options are: "mean", "median", "min", "max", "sum"
and "std". The default is "mean". (Default: mean)
--missingDataAsZero If set, missing data (NAs) will be treated as zeros. The default is to ignore such cases, which will be depicted as black areas in
a heatmap. (see the --missingDataColor argument of the plotHeatmap command for additional options). (default: False)
--skipZeros Whether regions with only scores of zero should be included or not. Default is to include them. (default: False)
--minThreshold MINTHRESHOLD
Numeric value. Any region containing a value that is less than or equal to this will be skipped. This is useful to skip, for
example, genes where the read count is zero for any of the bins. This could be the result of unmappable areas and can bias the
overall results. (Default: None)
--maxThreshold MAXTHRESHOLD
Numeric value. Any region containing a value greater than or equal to this will be skipped. The maxThreshold is useful to skip
those few regions with very high read counts (e.g. micro satellites) that may bias the average values. (Default: None)
--blackListFileName BED file, -bl BED file
A BED file containing regions that should be excluded from all analyses. Currently this works by rejecting genomic chunks that
happen to overlap an entry. Consequently, for BAM files, if a read partially overlaps a blacklisted region or a fragment spans
over it, then the read/fragment might still be considered. (default: None)
--samplesLabel SAMPLESLABEL [SAMPLESLABEL ...]
Labels for the samples. This will then be passed to plotHeatmap and plotProfile. The default is to use the file name of the
sample. The sample labels should be separated by spaces and quoted if a label itselfcontains a space E.g. --samplesLabel label-1
"label 2" (default: None)
--smartLabels Instead of manually specifying labels for the input bigWig and BED/GTF files, this causes deepTools to use the file name after
removing the path and extension. (default: False)
--quiet, -q Set to remove any warning or processing messages. (default: False)
--verbose Being VERY verbose in the status messages. --quiet will disable this. (default: False)
--scale SCALE If set, all values are multiplied by this number. (Default: 1)
--numberOfProcessors INT, -p INT
Number of processors to use. Type "max/2" to use half the maximum number of processors or "max" to use all available processors.
(Default: 1)
GTF/BED12 options:
--metagene When either a BED12 or GTF file are used to provide regions, perform the computation on the merged exons, rather than using the
genomic interval defined by the 5-prime and 3-prime most transcript bound (i.e., columns 2 and 3 of a BED file). If a BED3 or BED6
file is used as input, then columns 2 and 3 are used as an exon. (Default: False)
--transcriptID TRANSCRIPTID
When a GTF file is used to provide regions, only entries with this value as their feature (column 3) will be processed as
transcripts. (Default: transcript)
--exonID EXONID When a GTF file is used to provide regions, only entries with this value as their feature (column 3) will be processed as exons.
CDS would be another common value for this. (Default: exon)
--transcript_id_designator TRANSCRIPT_ID_DESIGNATOR
Each region has an ID (e.g., ACTB) assigned to it, which for BED files is either column 4 (if it exists) or the interval bounds.
For GTF files this is instead stored in the last column as a key:value pair (e.g., as 'transcript_id "ACTB"', for a key of
transcript_id and a value of ACTB). In some cases it can be convenient to use a different identifier. To do so, set this to the
desired key. (Default: transcript_id)
...
A.必须参数:
参数 | 说明 |
---|---|
–regionsFileName, -R | bed 或 gtf 格式,需要绘制的靶标区域 |
–scoreFileName, -S | bigwig 文件 |
B.输出参数:
参数 | 说明 |
---|---|
–outFileName, -out, -o | 输出结果文件名 |
–outFileNameMatrix | 输出热图的矩阵结果,可以导入 R 里,e.g. IndividualValues.tab |
–outFileSortedRegions | 输出排序好的 bed 文件结果 |
C.可选参数:
参数 | 说明 |
---|---|
–version | 打印软件版本信息 |
–regionBodyLength, -m | 区间长度缩放的长度,默认 1000bp |
–startLabel | 在图上显示的区间起始位置的标签,自定义,默认 TSS |
–endLabel | 在图上显示的区间结束位置的标签,自定义,默认 TES |
–beforeRegionStartLength, -b, –upstream | 计算区间起始位置上游多少 bp 的区间信号,默认 0 |
–afterRegionStartLength, -a, –downstream | 计算区间终止位置下游多少 bp 的区间信号,默认 0 |
–unscaled5prime | 给定 5’端不需要缩放的长度,对比较缩放和不缩放边界的信号分布比较有用,默认 0 |
–unscaled3prime | 给定 3’端不需要缩放的长度,对比较缩放和不缩放边界的信号分布比较有用,默认 0 |
…参考见 reference-point | 后面参数与 reference-point 一样 |
参数说明之:可视化
plotProfile:
查看参考文档:
$ plotProfile -h usage: plotProfile [--matrixFile MATRIXFILE] --outFileName OUTFILENAME [--outFileSortedRegions FILE] [--outFileNameData OUTFILENAMEDATA] [--dpi DPI]
[--kmeans KMEANS] [--hclust HCLUST] [--silhouette] [--help] [--version] [--averageType {mean,median,min,max,std,sum}]
[--plotHeight PLOTHEIGHT] [--plotWidth PLOTWIDTH] [--plotType {lines,fill,se,std,overlapped_lines,heatmap}]
[--colors COLORS [COLORS ...]] [--numPlotsPerRow NUMPLOTSPERROW] [--clusterUsingSamples CLUSTERUSINGSAMPLES [CLUSTERUSINGSAMPLES ...]]
[--startLabel STARTLABEL] [--endLabel ENDLABEL] [--refPointLabel REFPOINTLABEL] [--labelRotation LABEL_ROTATION]
[--regionsLabel REGIONSLABEL [REGIONSLABEL ...]] [--samplesLabel SAMPLESLABEL [SAMPLESLABEL ...]] [--plotTitle PLOTTITLE]
[--yAxisLabel YAXISLABEL] [--yMin YMIN [YMIN ...]] [--yMax YMAX [YMAX ...]]
[--legendLocation {best,upper-right,upper-left,upper-center,lower-left,lower-right,lower-center,center,center-left,center-right,none}]
[--perGroup] [--plotFileFormat] [--verbose]
This tool creates a profile plot for scores over sets of genomic regions. Typically, these regions are genes, but any other regions defined in BED will
work. A matrix generated by computeMatrix is required.
...
A.必须参数:
参数 | 说明 |
---|---|
–matrixFile, -m | computeMatrix 输出的压缩结果文件 |
–outFileName, -out, -o | 保存绘图结果名,“png”, “eps”, “pdf” and “svg”等格式可选,e.g., MyHeatmap.png |
B.输出参数:
参数 | 说明 |
---|---|
–outFileSortedRegions | 输出排序好的 bed 文件,Example: Heatmap1sortedRegions.bed |
–outFileNameData | 保存绘图数据, e.g. myProfile.tab. |
–dpi | 保存绘图图片的分辨率 |
C.聚类参数:
参数 | 说明 |
---|---|
–kmeans | 聚类数量,使用此参数会用 k-means 算法进行聚类,只能在单个样本工作 |
–hclust | 聚类数量,使用此参数会用 hierarchical clustering 算法进行层次聚类,只能在单个样本工作 |
–silhouette | 计算区域轮廓得分,得分是一个衡量一个区域与同一集群中的其他区域之间的相似程度的指标。它将报告在带有区域的 BED 文件的最后一列中。当你有超过 10 万个区域时,轮廓评估可能会非常缓慢 |
D.可选参数:
参数 | 说明 |
---|---|
–version | 打印版本信息 |
–averageType | mean, median, min, max, std, sum,6 种统计信号值的方法, |
–plotHeight | 绘图的高度,cm |
–plotWidth | 绘图的宽度,cm |
–plotType | 绘图类型:lines, fill, se, std, overlapped_lines, heatmap,se 和 std 是给线图添加标准误和标准差 |
–colors | 设置线条的颜色,对于 overlapped_lines 不可用,example, –colors red blue green |
–numPlotsPerRow | 每行图的个数 |
–clusterUsingSamples | 对样本编号聚类 |
–startLabel | 区间起始位置绘图的标签,只对 scale-regions 有用 |
–endLabel | 区间终止位置绘图的标签,只对 scale-regions 有用 |
–refPointLabel | 参考位置的绘图标签,只对 reference-point 有用 |
–labelRotation | x 轴标签的旋转角度,默认 0 |
–regionsLabel, -z | 热图里 bed 区间的绘图标签,如果有多个,以空格分割,如果本身有空格,则需要引号,–regionsLabel label_1, “label 2” |
–samplesLabel | 样本标签,默认使用样本名,如果本身有空格,则需要引号和空格分开,–samplesLabel label-1 “label 2” |
–plotTitle, -T | 绘图标题,默认无 |
–yAxisLabel, -y | Y 轴标签 |
–yMin | 指定 Y 轴最小值 |
–yMax | 指定 Y 轴最大值 |
–legendLocation | 图例位置,best, upper-right, upper-left, upper-center, lower-left, lower-right, lower-center, center, center-left, center-right, none |
–perGroup | 是否将所有样本绘制在一张图里,默认分别画图 |
–plotFileFormat | 输出图片格式,png, pdf, svg, eps, plotly |
–verbose | 打印处理过程信息 |
结果展示:
1、线条图
# run compute matrix to collect the data needed for plotting $ computeMatrix scale-regions -S H3K27Me3-input.bigWig H3K4Me1-Input.bigWig
H3K4Me3-Input.bigWig
-R genes19.bed genesX.bed
--beforeRegionStartLength 3000
--regionBodyLength 5000
--afterRegionStartLength 3000
--skipZeros -o matrix.mat.gz $ plotProfile -m matrix.mat.gz -out ExampleProfile1.png
--numPlotsPerRow 2
--plotTitle "Test data profile"
2、填充图+自定义颜色
$ plotProfile -m matrix.mat.gz -out ExampleProfile2.png
--plotType=fill # add color between the x axis and the lines
--perGroup # make one image per BED file instead of per bigWig file
--colors red yellow blue
--plotTitle "Test data profile"
3、聚类
$ plotProfile -m matrix.mat.gz --perGroup
--kmeans 2
-out ExampleProfile3.png
4、热图形式展示
$ plotProfile -m matrix.mat.gz --perGroup
--kmeans 2
-plotType heatmap
-out ExampleProfile3.png
plotHeatmap:
查看参考文档:
$ plotHeatmap -h usage: plotHeatmap [--matrixFile MATRIXFILE] --outFileName OUTFILENAME [--outFileSortedRegions FILE] [--outFileNameMatrix FILE]
[--interpolationMethod STR] [--dpi DPI] [--kmeans KMEANS] [--hclust HCLUST] [--silhouette] [--help] [--version]
[--plotType {lines,fill,se,std}] [--sortRegions {descend,ascend,no,keep}] [--sortUsing {mean,median,max,min,sum,region_length}]
[--sortUsingSamples SORTUSINGSAMPLES [SORTUSINGSAMPLES ...]] [--linesAtTickMarks]
[--clusterUsingSamples CLUSTERUSINGSAMPLES [CLUSTERUSINGSAMPLES ...]] [--averageTypeSummaryPlot {mean,median,min,max,std,sum}]
[--missingDataColor MISSINGDATACOLOR] [--colorMap COLORMAP [COLORMAP ...]] [--alpha ALPHA] [--colorList COLORLIST [COLORLIST ...]]
[--colorNumber COLORNUMBER] [--zMin ZMIN [ZMIN ...]] [--zMax ZMAX [ZMAX ...]] [--heatmapHeight HEATMAPHEIGHT]
[--heatmapWidth HEATMAPWIDTH] [--whatToShow {plot, heatmap and colorbar,plot and heatmap,heatmap only,heatmap and colorbar}]
[--boxAroundHeatmaps BOXAROUNDHEATMAPS] [--xAxisLabel XAXISLABEL] [--startLabel STARTLABEL] [--endLabel ENDLABEL]
[--refPointLabel REFPOINTLABEL] [--labelRotation LABEL_ROTATION] [--regionsLabel REGIONSLABEL [REGIONSLABEL ...]]
[--samplesLabel SAMPLESLABEL [SAMPLESLABEL ...]] [--plotTitle PLOTTITLE] [--yAxisLabel YAXISLABEL] [--yMin YMIN [YMIN ...]]
[--yMax YMAX [YMAX ...]]
[--legendLocation {best,upper-right,upper-left,upper-center,lower-left,lower-right,lower-center,center,center-left,center-right,none}]
[--perGroup] [--plotFileFormat] [--verbose]
This tool creates a heatmap for scores associated with genomic regions. The program requires a matrix file generated by the tool ``computeMatrix``.
...
A.必须参数:
参数 | 说明 |
---|---|
–matrixFile, -m | computeMatrix 输出的压缩结果文件 |
–outFileName, -out, -o | 保存绘图结果名,“png”, “eps”, “pdf” and “svg”等格式可选,e.g., MyHeatmap.png |
B.输出参数:
参数 | 说明 |
---|---|
–outFileSortedRegions | 输出排序好的 bed 文件,Example: Heatmap1sortedRegions.bed |
–outFileNameMatrix | 保存绘制热图数据,e.g. MyMatrix.gz |
–interpolationMethod | auto, nearest, bilinear, bicubic, gaussian 五个选项,如果 HeatMap 图像包含大量列通常更好地使用插值方法产生更好的结果,默认使用 nearest |
–dpi | 保存绘图图片的分辨率 |
C.聚类参数同上:
D.可选参数:
参数 | 说明 |
---|---|
–plotType | lines, fill, se, std 三种类型 |
–sortRegions | 是否需要对区间排序,默认降序,descend, ascend, no, keep 四个选项 |
–sortUsing | ,6 种排序方法,mean, median, max, min, sum, region_length,6 种 |
–linesAtTickMarks | 用虚线标记在热图上的刻度位置 |
–missingDataColor | 缺失数据的颜色,默认黑色 |
–colorMap | 热图颜色, ‘Accent’, ‘Blues’, ‘BrBG’, ‘BuGn’, ‘BuPu’, ‘CMRmap’, ‘Dark2’, ‘GnBu’, ‘Greens’, ‘Greys’, ‘OrRd’, ‘Oranges’, ‘PRGn’, ‘Paired’, ‘Pastel1’, ‘Pastel2’, ‘PiYG’, ‘PuBu’, ‘PuBuGn’, ‘PuOr’, ‘PuRd’, ‘Purples’, ‘RdBu’, ‘RdGy’, ‘RdPu’, ‘RdYlBu’, ‘RdYlGn’, ‘Reds’, ‘Set1’, ‘Set2’, ‘Set3’, ‘Spectral’, ‘Wistia’, ‘YlGn’, ‘YlGnBu’, ‘YlOrBr’, ‘YlOrRd’, ‘afmhot’, ‘autumn’, ‘binary’, ‘bone’, ‘brg’, ‘bwr’, ‘cividis’, ‘cool’, ‘coolwarm’, ‘copper’, ‘cubehelix’, ‘flag’, ‘gist_earth’, ‘gist_gray’, ‘gist_heat’, ‘gist_ncar’, ‘gist_rainbow’, ‘gist_stern’, ‘gist_yarg’, ‘gnuplot’, ‘gnuplot2’, ‘gray’, ‘hot’, ‘hsv’, ‘icefire’, ‘inferno’, ‘jet’, ‘magma’, ‘mako’, ‘nipy_spectral’, ‘ocean’, ‘pink’, ‘plasma’, ‘prism’, ‘rainbow’, ‘rocket’, ‘seismic’, ‘spring’, ‘summer’, ‘tab10’, ‘tab20’, ‘tab20b’, ‘tab20c’, ‘terrain’, ‘twilight’, ‘twilight_shifted’, ‘viridis’, ‘vlag’, ‘winter’可选 |
–alpha | 热图透明度,默认 1 |
–colorList | 自定义颜色,–colorList black,yellow,blue |
–colorNumber | 控制颜色转变的数量 |
–zMin, -min | 热图密度的最小值 |
–zMax, -max | 热图密度的最大值 |
–heatmapHeight | 热图高度,cm,默认 28,最小 3,最大 100 |
–heatmapWidth | 热图宽度,cm,默认 4,最小 1,最大 100 |
–whatToShow | 展示图像类型, plot, heatmap and colorbar, plot and heatmap, heatmap only, heatmap and colorbar,5 种选择,默认:密度图+热图+热图颜色柱 |
–boxAroundHeatmaps | 热图边框,–boxAroundHeatmaps no 则不绘制边框 |
–xAxisLabel, -x | X 轴文本标签 |
… | 其它参数参考 plotProfile |
结果展示:
1、默认热图
# run compute matrix to collect the data needed for plotting $ computeMatrix scale-regions -S H3K27Me3-input.bigWig H3K4Me1-Input.bigWig
H3K4Me3-Input.bigWig
-R genes19.bed genesX.bed
--beforeRegionStartLength 3000
--regionBodyLength 5000
--afterRegionStartLength 3000
--skipZeros -o matrix.mat.gz $ plotHeatmap -m matrix.mat.gz -out ExampleHeatmap1.png
2、聚类,不显示密度图,改变热图颜色,控制热图最小值和最大值
$ plotHeatmap -m matrix_two_groups.gz -out ExampleHeatmap2.png
--colorMap RdBu
--whatToShow 'heatmap and colorbar'
--zMin -3 --zMax 3
--kmeans 4
3、自定义多个图颜色、控制多个图的最小值最大值,设置分辨率
$ plotHeatmap -m matrix_two_groups.gz -out ExampleHeatmap3.png
--colorList 'black, yellow' 'white,blue' '#ffffff,orange,#000000'
--whatToShow 'heatmap and colorbar'
--zMin -2 -2 0 --zMax 2 2 3
--kmeans 4
--dpi 100
4、取消热图边框
$ plotHeatmap -m matrix_two_groups.gz -out ExampleHeatmap4.png
--colorMap Oranges_r Blues_r Greens
--whatToShow 'heatmap and colorbar'
--zMin -4 -4 0 --zMax 0 0 5
--kmeans 4
--dpi 100
--boxAroundHeatmaps no
下期讲解如何使用自己数据绘制 profile 和 heatmap。
欢迎小伙伴留言评论!
转自:老俊俊的生信笔记- 本文固定链接: https://maimengkong.com/zu/1310.html
- 转载请注明: : 萌小白 2022年12月16日 于 卖萌控的博客 发表
- 百度已收录