生信软件8 - bedtools进行窗口划分、窗口GC含量、窗口测序深度和窗口SNP统计

AI摘要

本文介绍了如何利用bedtools软件进行基因组窗口划分,以及在此基础上统计窗口的GC含量、平均测序深度和SNP变异位点数量。详细讲解了软件安装、染色体大小文件准备、窗口划分方法,以及针对fasta序列、排序后的bam文件和VCF文件的常见统计操作。同时推荐了其他生信软件用于比对结果可视化、质量评估等任务。

使用bedtools进行窗口划分、窗口GC含量、窗口测序深度和窗口SNP变异位点数量统计

软件安装

1. conda 安装

conda install bedtools -y

2. 源码安装

wget https://github.com/arq5x/bedtools2/releases/download/v2.28.0/bedtools-2.28.0.tar.gz
tar -zxvf bedtools-2.28.0.tar.gz
cd bedtools2
make

1. 准备染色体大小文件

# 安装python库
pip install pyfaidx

# 使用faidx获取hg19参考基因组序列每条染色体的大小
faidx hg19.fa -i chromsizes > size.genome

# 获取不包含线粒体chrM的大小文件
faidx hg19.fa -i chromsizes |grep -v 'chrM' > size.genome.no.mt

size.genome.no.mt

2. 窗口划分获取BIN文件

bedtools makewindows -g size.genome.no.mt -w 1000000 > windows.bed
  • g sizes.genome是要划分的基因组,格式为两列:染色体、染色体长度
  • w 1000000 为窗口大小为1M
  • windows.bed为输出文件,格式为三列:染色体、区间开始位点、区间结束位点。

windows.bed

3. 常见统计 - 统计fasta序列每个窗口的GC含量

以获取参考基因组hg19.fa序列每1M窗口的GC含量为例

bedtools nuc -fi hg19.fa -bed windows.bed |cut -f 1-3,5 > gc.1M.bed

gc.1M.bed

4. 常见统计 - 统计每个窗口的平均覆盖深度

bedtools coverage -a windows.bed -b Sample.sorted.bam > Sample.depth.txt
  • Sample.sorted.bam 为比对后排序的bam文件
  • windows.bed文件为步骤2获得的窗口划分BIN文件
  • 生成的Sample.depth.txt文件共有7列,分别为序列编号、起始位置、结束位置、reads数、碱基数、区间大小、平均覆盖深度
    Sample.depth.txt

5. 常见统计 - 统计每个窗口的SNP变异位点数量

bedtools coverage -a windows.bed -b Sample.snp.filter.vcf -counts > snp.1M.txt
  • windows.bed文件为步骤2获得的窗口划分BIN文件
  • Sample.snp.filter.vcf为存储过滤后SNP变异位点的VCF文件
  • snp.1M.txt 结果文件中共4列,分别为染色体、窗口起始位置、窗口结束位置和窗口SNP变异位点数量

在这里插入图片描述

生信软件文章推荐

生信软件1 - 测序下机文件比对结果可视化工具 visNano

生信软件2 - 下游比对数据的统计工具 picard

生信软件3 - mapping比对bam文件质量评估工具 qualimap

生信软件4 - 拷贝数变异CNV分析软件 WisecondorX

生信软件5 - RIdeogram包绘制染色体密度图

生信软件6 - bcftools查找指定区域的变异位点信息

生信软件7 - 多线程并行运行Linux效率工具Parallel

更多内容请关注公众号【生信与基因组学】,定期更新生信算法和编程、基因组学、统计学、分子生物学、临床检测和深度学习等内容。

CRISPR脱靶预测工具对比:CRISPOR、Cas-OFFinder与CCTop原理与实战指南 CRISPR脱靶预测不是简单查序列,而是融合基因组比对、表观遗传状态与细胞类型特异性的系统工程。其核心原理在于:不同工具采用迥异的底层模型——CRISPOR依赖快速比对与经验评分,Cas-OFFinder执行确定性字符串匹配,CCTop则引入染色质可及性构建条件概率模型。技术价值体现在平衡预测效率与生物学真实性,支撑临床治疗sgRNA筛选、CRISPR文库设计及非模式生物编辑等关键场景。实践中必须规避‘0脱靶’幻觉,坚持多工具交叉验证与WGS/GUIDE-seq实证闭环。本文聚焦sgRNA脱靶风险评估,深入 阅读详情

相关推荐

安装bedtools详细步骤和详细介绍bedtools用法

以下是典型的bedtools用法示例。在任何bedtools命令后使用“-h”选项将报告所有命令行选项的列表。报告两个BED文件中特征之间的碱基重叠。报告 A 中与 B 中没有条目重叠的条目。如“grep -v”从标准输入读取BED A。这在将命令串联在一起时非常有用。例如,查找与LINEs重叠但不与SINEs重叠的基因。找到每个基因最近的ALU。将重复元素的重叠部分合并为单个条目,并返回合并的条目数。将附近的重复元素合并为单个条目,只要它们相互之间的距离不超过1000 bp。

zhengzaifeidelushang的博客 1352

如何使用 Conda 安装 bedtools(详细教程)

本文介绍了在Windows系统下通过WSL2和Ubuntu安装生物信息学工具bedtools的方法。由于bedtools不支持直接Windows安装,教程采用conda创建Python3.7虚拟环境(bedtools_env),并通过bioconda通道安装bedtools。主要步骤包括:1)创建conda虚拟环境;2)激活环境;3)执行bedtools安装命令。该方法为Windows用户提供了使用bedtools进行基因组数据处理的有效解决方案。

猿小白的博客 702

Perl练习02之计算sam文件中每个染色体比对上的reads数,GC碱基数,GC比例

计算sam文件每个染色体匹配reads数,GC碱基数,GC含量 gccount_reads.pl #!/usr/bin/perl use strict; use warnings; my (%hash,%GC,%ATGC); open IN,"<",$ARGV[0]; while(<IN>){ chomp; next if /^@/;#...

qq_21478261的博客 1631

生信技能49 - 获取CNV染色体开始至结束区带长度和全部区带列表

获取CNV染色体开始至结束区带长度和全部区带列表

LittleComputerRobot的博客 552

从ATE到ATPG:基于Scan Chain的芯片制造缺陷定位实战解析

本文深入解析了从ATE到ATPG的芯片制造缺陷定位实战技术,重点介绍了Scan Chain的工作原理、异步复位触发器处理技巧以及Design Compiler中的DFT实现方法。通过实际案例展示了如何利用ATE测试数据和ATPG工具进行精确的缺陷定位,并分享了提升测试覆盖率和优化测试成本的专业技巧,为芯片测试工程师提供了宝贵的实战经验。

weixin_42527160的博客 385

山东大学FPGA课程实验一 加法器设计

电子设计自动化与FPGA设计,实验一 加法器设计

2503_91283667的博客 877

Nacos 2.3.2与PostgreSQL的Docker化部署实战

本文详细介绍了Nacos 2.3.2与PostgreSQL的Docker化部署实战,包括环境准备、数据库配置、镜像获取与导入、容器部署及常见问题排查。通过Docker容器化技术,结合PostgreSQL的稳定性和扩展性,为微服务架构提供高效的服务发现和配置管理解决方案。

k5l6m的博客 286

绕过Google Play:获取Expo Go安卓APK的实用指南

本文为国内安卓开发者提供了绕过Google Play商店获取Expo Go APK的实用指南。针对无法访问Google Play的痛点,详细介绍了通过官方GitHub Releases、可信第三方网站(如APKMirror)及APK下载器等多种安全获取途径,并重点讲解了APK安装、安全验证(核对签名)及常见连接问题的排查方法,帮助开发者顺利开启React Native开发之旅。

weixin_29006701的博客 591

刃边法计算MTF(ESF、LSF、PSF)

MTF调制传递函数 评价一个成像系统目前主流的办法主要有三种TV line检测,MTF检测,和SFR检测。 MTF是Modulation Transfer Function的英文简称,中文为调制传递函数。 是指调制度随空间频率变化的函数称为调制度传递函数。最开始是为了说明镜头的能力。 在各个摄像头镜头中经常采用MTF描述镜头的MTF曲线,表明镜头的能力。这些曲线是通过理想的测试环境...

weixin_30911451的博客 1万+

【比较器仿真】

比较器tran noise、pnoise仿真、噪声仿真、MC失调仿真

pickweb的博客 1万+

基于simulink的能量管理策略的场景实例:混合动力电动汽车(HEV)的能量回收与分配策略

本文以混合动力电动汽车(HEV)为研究对象,通过Simulink建模详细演示了能量管理策略的设计与实现。内容涵盖HEV系统架构、核心组件工作原理,并分步骤指导搭建车辆动力学模型、动力系统组件模型和基于规则的能量管理策略。重点分析了制动能量回收与功率分配机制,通过仿真验证了逻辑门限策略在提升燃油经济性和维持电池SOC平衡方面的有效性。文章最后展望了更高级控制策略的应用前景,为HEV能量优化提供了完整的仿真研究框架。

xiaoheshang_123的博客 216

ABAP ALV 导出总被锁死为固定格式?把 Always Use Selected Format 一键重置到可选状态

摘要:SAP ALV报表导出时勾选"Always Use Selected Format"会导致导出格式被锁定,无法切换格式。文章分析该问题原因(系统持久化配置),提供用户自助解法(ALV list使用&RESET_EXCEL命令码,ALV grid通过右键菜单恢复弹窗),管理员治理方案(使用SALV_BS_ADMIN_MAINTAIN报表批量处理),并指出SAP_BASIS 7.02版本的特殊处理方式(需参考SAP Note 1716802和1590484)。最后给出排障清单,

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 232

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

上一篇: 生信技能29 - 生产任务自动化流程中邮件发送实现方式
下一篇: 生信软件9 - 多公共数据库数据下载软件Kingfisher
生信与基因组学
博客等级 码龄9年 7214粉丝 257原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

生信与基因组学

每一份鼓励是我坚持下去动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值
⌂ 换网址