bwa、bowtie2、tophat、hisat2 比对软件学习中的笔记整理

2023-12-29 22:58

本文主要是介绍bwa、bowtie2、tophat、hisat2 比对软件学习中的笔记整理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 对常用的比对软件学习进行用法整理记录。记录的内容相对简单,详细说明及用法还得参考软件使用说明书

bwa、bowtie2、tophat、hisatbwabwa(Burrows-Wheeler Aligner)
bwa文档说明
http://bio-bwa.sourceforge.net/bwa.shtmlBWA用于将低差异的序列映射到一个大的参考基因组,如人类基因组。由BWA-backtrack、BWA-SW和BWA-MEM三种算法组成。第一个算法设计用于Illumina序列读取100bp,其余两个用于更长序列,读取范围从70bp到1Mbp。BWA-MEM和BWA-SW具有类似的特性,比如长读支持和分割对齐,但是最新的BWA-MEM通常被推荐用于高质量查询,因为它更快、更准确。对于70-100bp的Illumina读长数据,BWA-MEM也比BWA-backtrack具有更好的性能。bwa有多种算法,不管是哪种算法,都需要先构建参考基因组的index索引。不同比对算法调用不同的子命令:
BWA-backtrack:aln/samse/sampe;
BWA-SW:bwasw;
BWA-MEM:mem# 软件下载
git clone https://github.com/lh3/bwa.git
cd bwa; 
make
用法:
# bwa构建索引
用法:
bwa index [options] <in.fasta>
options-a STR    BWT construction algorithm: bwtsw, is or rb2 [auto]-p STR    prefix of the index [same as fasta name] # 构建的参考基因组index带有和fasta文件同名的前缀-b INT    block size for the bwtsw algorithm (effective with -a bwtsw) [10000000]-6        index files named as <in.fasta>.64.* instead of <in.fasta>.*
# 示例
bwa index rRNA.homo_sapiens.fa# bwa-mem  reads 测序读长大于70bp或者组装后的contigs碱基比对到相近的参考基因组
用法:bwa mem [options] <idxbase> <in1.fq> [in2.fq]bwa mem [-aCHMpP] [-t nThreads] [-k minSeedLen] [-w bandWidth] [-d zDropoff] [-r seedSplitRatio] [-c maxOcc] [-A matchScore] [-B mmPenalty] [-O gapOpenPen] [-E gapExtPen] [-L clipPen] [-U unpairPen] [-R RGline] [-v verboseLevel] db.prefix reads.fq [mates.fq]
options
Algorithm options:-t INT        number of threads [1]  # 指定线程数-k INT        minimum seed length [19]  # 最小比对长度-w INT        band width for banded alignment [100]  #-d INT        off-diagonal X-dropoff [100]-r FLOAT      look for internal seeds inside a seed longer than {-k} * FLOAT [1.5]-y INT        seed occurrence for the 3rd round seeding [20]-c INT        skip seeds with more than INT occurrences [500]-D FLOAT      drop chains shorter than FLOAT fraction of the longest overlapping chain [0.50]-W INT        discard a chain if seeded bases shorter than INT [0]-m INT        perform at most INT rounds of mate rescues for each read [50]-S            skip mate rescue-P            skip pairing; mate rescue performed unless -S also in use
Scoring options:-A INT        score for a sequence match, which scales options -TdBOELU unless overridden [1]-B INT        penalty for a mismatch [4]-O INT[,INT]  gap open penalties for deletions and insertions [6,6]-E INT[,INT]  gap extension penalty; a gap of size k cost '{-O} + {-E}*k' [1,1]-L INT[,INT]  penalty for 5'- and 3'-end clipping [5,5]-U INT        penalty for an unpaired read pair [17]-x STR        read type. Setting -x changes multiple parameters unless overridden [null]pacbio: -k17 -W40 -r10 -A1 -B1 -O1 -E1 -L0  (PacBio reads to ref)ont2d: -k14 -W20 -r10 -A1 -B1 -O1 -E1 -L0  (Oxford Nanopore 2D-reads to ref)intractg: -B9 -O16 -L5  (intra-species contigs to ref)
Input/output options:-p            smart pairing (ignoring in2.fq)-R STR        read group header line such as '@RG\tID:foo\tSM:bar' [null]-H STR/FILE   insert STR to header if it starts with @; or insert lines in FILE [null]-o FILE       sam file to output results to [stdout]-j            treat ALT contigs as part of the primary assembly (i.e. ignore <idxbase>.alt file)-5            for split alignment, take the alignment with the smallest coordinate as primary-q            don't modify mapQ of supplementary alignments-K INT        process INT input bases in each batch regardless of nThreads (for reproducibility) []-v INT        verbosity level: 1=error, 2=warning, 3=message, 4+=debugging [3]-T INT        minimum score to output [30]-h INT[,INT]  if there are <INT hits with score >80% of the max score, output all in XA [5,200]-a            output all alignments for SE or unpaired PE-C            append FASTA/FASTQ comment to SAM output-V            output the reference FASTA header in the XR tag-Y            use soft clipping for supplementary alignments-M            mark shorter split hits as secondary(可用于兼容picard)-I FLOAT[,FLOAT[,INT[,INT]]]specify the mean, standard deviation (10% of the mean if absent), max(4 sigma from the mean if absent) and min of the insert size distribution.FR orientation only. [inferred]# 二代测序平台
bwa mem ref.fa reads.fq > aln-se.sam  
bwa mem ref.fa read1.fq read2.fq > aln-pe.sam
# 示例
bwa mem -t 10 -M ref.fa read1.fq read2.fq 1> aln.sam 2>>bwa.log# pacbio/ont
bwa mem -x pacbio ref.fa reads.fq > aln.sam
bwa mem -x ont2d ref.fa reads.fq > aln.sam# bwa-backtrack  适用于测序读长70bp左右
# 单端测序序列比对
bwa aln ref.fa short_read.fq > aln_sa.sai
bwa samse ref.fa aln_sa.sai short_read.fq > aln-se.sam   
# 双端测序序列比对
bwa aln ref.fa read1.fq > aln_sa1.sai
bwa aln ref.fa read2.fq > aln_sa2.sai
bwa sampe ref.fa aln_sa1.sai aln_sa2.sai read1.fq read2.fq > aln-pe.sam   用法:
bwa aln [-n maxDiff] [-o maxGapO] [-e maxGapE] [-d nDelTail] [-i nIndelEnd] [-k maxSeedDiff] [-l seedLen] [-t nThrds] [-cRN] [-M misMsc] [-O gapOsc] [-E gapEsc] [-q trimQual] <in.db.fasta> <in.query.fq> > <out.sai>bwa samse [-n maxOcc] <in.db.fasta> <in.sai> <in.fq> > <out.sam>
bwa sampe [-a maxInsSize] [-o maxOcc] [-n maxHitPaired] [-N maxHitDis] [-P] <in.db.fasta> <in1.sai> <in2.sai> <in1.fq> <in2.fq> > <out.sam>
# bwa-sw
bwa bwasw ref.fa long_read.fq > aln.sam
bwa bwasw [-a matchScore] [-b mmPen] [-q gapOpenPen] [-r gapExtPen] [-t nThreads] [-w bandWidth] [-T thres] [-s hspIntv] [-z zBest] [-N nHspRev] [-c thresCoef] <in.db.fasta> <in.fq> [mate.fq] > aln.sam
比对序列是fq文件。当双端fq文件存在时,进行双端比对。双端模式只适用于Illumina短序列文库。在双端模式下,BWA-SW仍会输出拆分比对但所有的都被标记没有正确的配对;若有多个比对位置,配对位置将不会被写入bowtie2# bowtie2安装
1.conda直接安装
conda install bowtie2
2.git 安装
git clone https://github.com/BenLangmead/bowtie2.git# bowtie2文档说明
http://bowtie-bio.sourceforge.net/bowtie2/manual.shtml#bowtie2-options-solexa-qualsbowtie2参考基因组索引构建
bowtie2-build ref.fa ref
bowtie2-build可以构建各种大小参考基因组的index.基因组大小4G,bowtie2构建一个"small"的索引。当基因组比较长,bowtie2构建一个“large”的索引。小索引被保存在扩展名.bt2的文件中,大索引保存在bt2l的扩展名的文件中。用法:
bowtie2 [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r> | --interleaved <i> | --sra-acc <acc> | b <bam>} -S [<sam>]options
-f  Reads (specified with <m1>, <m2>, <s>) are FASTA files. FASTA files usually have extension .fa, .fasta, .mfa, .fna or similar. FASTA files do not have a way of specifying quality values, so when -f is set, the result is as if --ignore-quals is also set.
--end-to-end   要求从一端到另一端的全部读对齐,而不需要从两端对字符进行任何修整--maxins 有效双端对齐的最大片段长度FLAG值
1    The read is one of a pair
2    The alignment is one end of a proper paired-end alignment
4    The read has no reported alignments
8    The read is one of a pair and has no reported alignments
16    The alignment is to the reverse reference strand
32    The other mate in the paired-end alignment is aligned to the reverse reference strand
64    The read is mate 1 in a pair
128    The read is mate 2 in a pair
Thus, an unpaired read that aligns to the reverse reference strand will have flag 16. A paired-end read that aligns and is the first mate in the pair will have flag 83 (= 64 + 16 + 2 + 1).bowtie2-inspect # index文件名查找
用法 
bowtie2-inspect [options]* <bt2_base>
Options:--large-index      force inspection of the 'large' index, even if a'small' one is present.-a/--across <int>  Number of characters across in FASTA output (default: 60)-n/--names         Print reference sequence names only-s/--summary       Print summary incl. ref names, lengths, index properties-e/--bt2-ref      Reconstruct reference from .bt2 (slow, preserves colors)
# 示例
/opt/biotools/bowtie2-2.2.9/bowtie2-inspect -a 80 rRNA.homo_sapiens.fa >> rRNA.homo_sapiens.fatophat# 软件下载
# boost 下载
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz
tar -zxvf boost_1_71_0.tar.gz
./bootstrap.sh
/bjam --prefix=<YOUR_BOOST_INSTALL_DIRECTORY> link=static runtime-link=static stage install # 自定义安装路径 默认安装路径时/usr/local
./bz  # 安装# tophat2 下载安装
# source code
wget -c http://ccb.jhu.edu/software/tophat/downloads/tophat-2.1.1.tar.gz
# binary
wget -c http://ccb.jhu.edu/software/tophat/downloads/tophat-2.1.1.Linux_x86_64.tar.gz
tar zxvf tophat-2.1.1.Linux_x86_64.tar.gz
cd tophat-2.1.1/
./configure --prefix=<install_prefix> --with-boost=<boost_install_prefix> --with-bam=<samtools_install_prefix>
make
make installhisat2HISAT2是一个快速和敏感的比对程序,用于将下一代测序读序列(包括DNA和RNA)映射到人类基因组群(以及单个参考基因组)。
# hisat2 下载
# wget ftp://ftp.ccb.jhu.edu/pub/infphilo/hisat2/downloads/hisat2-2.1.0-Linux_x86_64.zip
wget -c http://ccb.jhu.edu/software/hisat2/downloads/hisat2-2.0.0-beta-source.zip
unzip hisat2-2.0.0-beta-source.zip
cd hisat2-2.0.0
make
# 添加到环境中
cp /install/path/hisat2* ~/bin/用法:
hisat2 [options]* -x <hisat2-idx> {-1 <m1> -2 <m2> | -U <r> | --sra-acc <SRA accession number>} [-S <hit>]

 

这篇关于bwa、bowtie2、tophat、hisat2 比对软件学习中的笔记整理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/550966

相关文章

Python按照24个实用大方向精选的上千种工具库汇总整理

《Python按照24个实用大方向精选的上千种工具库汇总整理》本文整理了Python生态中近千个库,涵盖数据处理、图像处理、网络开发、Web框架、人工智能、科学计算、GUI工具、测试框架、环境管理等多... 目录1、数据处理文本处理特殊文本处理html/XML 解析文件处理配置文件处理文档相关日志管理日期和

Python38个游戏开发库整理汇总

《Python38个游戏开发库整理汇总》文章介绍了多种Python游戏开发库,涵盖2D/3D游戏开发、多人游戏框架及视觉小说引擎,适合不同需求的开发者入门,强调跨平台支持与易用性,并鼓励读者交流反馈以... 目录PyGameCocos2dPySoyPyOgrepygletPanda3DBlenderFife

Python自动化批量重命名与整理文件系统

《Python自动化批量重命名与整理文件系统》这篇文章主要为大家详细介绍了如何使用Python实现一个强大的文件批量重命名与整理工具,帮助开发者自动化这一繁琐过程,有需要的小伙伴可以了解下... 目录简介环境准备项目功能概述代码详细解析1. 导入必要的库2. 配置参数设置3. 创建日志系统4. 安全文件名处

MySQL 迁移至 Doris 最佳实践方案(最新整理)

《MySQL迁移至Doris最佳实践方案(最新整理)》本文将深入剖析三种经过实践验证的MySQL迁移至Doris的最佳方案,涵盖全量迁移、增量同步、混合迁移以及基于CDC(ChangeData... 目录一、China编程JDBC Catalog 联邦查询方案(适合跨库实时查询)1. 方案概述2. 环境要求3.

SpringSecurity整合redission序列化问题小结(最新整理)

《SpringSecurity整合redission序列化问题小结(最新整理)》文章详解SpringSecurity整合Redisson时的序列化问题,指出需排除官方Jackson依赖,通过自定义反序... 目录1. 前言2. Redission配置2.1 RedissonProperties2.2 Red

MySQL 多列 IN 查询之语法、性能与实战技巧(最新整理)

《MySQL多列IN查询之语法、性能与实战技巧(最新整理)》本文详解MySQL多列IN查询,对比传统OR写法,强调其简洁高效,适合批量匹配复合键,通过联合索引、分批次优化提升性能,兼容多种数据库... 目录一、基础语法:多列 IN 的两种写法1. 直接值列表2. 子查询二、对比传统 OR 的写法三、性能分析

Javaee多线程之进程和线程之间的区别和联系(最新整理)

《Javaee多线程之进程和线程之间的区别和联系(最新整理)》进程是资源分配单位,线程是调度执行单位,共享资源更高效,创建线程五种方式:继承Thread、Runnable接口、匿名类、lambda,r... 目录进程和线程进程线程进程和线程的区别创建线程的五种写法继承Thread,重写run实现Runnab

Spring IoC 容器的使用详解(最新整理)

《SpringIoC容器的使用详解(最新整理)》文章介绍了Spring框架中的应用分层思想与IoC容器原理,通过分层解耦业务逻辑、数据访问等模块,IoC容器利用@Component注解管理Bean... 目录1. 应用分层2. IoC 的介绍3. IoC 容器的使用3.1. bean 的存储3.2. 方法注

MySQL 删除数据详解(最新整理)

《MySQL删除数据详解(最新整理)》:本文主要介绍MySQL删除数据的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、前言二、mysql 中的三种删除方式1.DELETE语句✅ 基本语法: 示例:2.TRUNCATE语句✅ 基本语

Python变量与数据类型全解析(最新整理)

《Python变量与数据类型全解析(最新整理)》文章介绍Python变量作为数据载体,命名需遵循字母数字下划线规则,不可数字开头,大小写敏感,避免关键字,本文给大家介绍Python变量与数据类型全解析... 目录1、变量变量命名规范python数据类型1、基本数据类型数值类型(Number):布尔类型(bo