资源简介
bwa算法,经过bwa算法执行后会得到sam文件,sam文件用于之后的gatk工作
代码片段和文件信息
#include
#include
#include
#include
#include
#include “bamlite.h“
#ifdef USE_MALLOC_WRAPPERS
# include “malloc_wrap.h“
#endif
/*********************
* from bam_endian.c *
*********************/
static inline int bam_is_big_endian()
{
long one= 1;
return !(*((char *)(&one)));
}
static inline uint16_t bam_swap_endian_2(uint16_t v)
{
return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8));
}
static inline void *bam_swap_endian_2p(void *x)
{
*(uint16_t*)x = bam_swap_endian_2(*(uint16_t*)x);
return x;
}
static inline uint32_t bam_swap_endian_4(uint32_t v)
{
v = ((v & 0x0000FFFFU) << 16) | (v >> 16);
return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8);
}
static inline void *bam_swap_endian_4p(void *x)
{
*(uint32_t*)x = bam_swap_endian_4(*(uint32_t*)x);
return x;
}
static inline uint64_t bam_swap_endian_8(uint64_t v)
{
v = ((v & 0x00000000FFFFFFFFLLU) << 32) | (v >> 32);
v = ((v & 0x0000FFFF0000FFFFLLU) << 16) | ((v & 0xFFFF0000FFFF0000LLU) >> 16);
return ((v & 0x00FF00FF00FF00FFLLU) << 8) | ((v & 0xFF00FF00FF00FF00LLU) >> 8);
}
static inline void *bam_swap_endian_8p(void *x)
{
*(uint64_t*)x = bam_swap_endian_8(*(uint64_t*)x);
return x;
}
/**************
* from bam.c *
**************/
int bam_is_be;
bam_header_t *bam_header_init()
{
bam_is_be = bam_is_big_endian();
return (bam_header_t*)calloc(1 sizeof(bam_header_t));
}
void bam_header_destroy(bam_header_t *header)
{
int32_t i;
if (header == 0) return;
if (header->target_name) {
for (i = 0; i < header->n_targets; ++i)
if (header->target_name[i]) free(header->target_name[i]);
if (header->target_len) free(header->target_len);
free(header->target_name);
}
if (header->text) free(header->text);
free(header);
}
bam_header_t *bam_header_read(bamFile fp)
{
bam_header_t *header;
char buf[4];
int magic_len;
int32_t i = 1 name_len;
// read “BAM1“
magic_len = bam_read(fp buf 4);
if (magic_len != 4 || strncmp(buf “BAM\001“ 4) != 0) {
fprintf(stderr “[bam_header_read] invalid BAM binary header (this is not a BAM file).\n“);
return NULL;
}
header = bam_header_init();
// read plain text and the number of reference sequences
if (bam_read(fp &header->l_text 4) != 4) goto fail;
if (bam_is_be) bam_swap_endian_4p(&header->l_text);
header->text = (char*)calloc(header->l_text + 1 1);
if (bam_read(fp header->text header->l_text) != header->l_text) goto fail;
if (bam_read(fp &header->n_targets 4) != 4) goto fail;
if (bam_is_be) bam_swap_endian_4p(&header->n_targets);
// read reference sequence names and lengths
header->target_name = (char**)calloc(header->n_targets sizeof(char*));
header->target_len = (uint32_t*)calloc(header->n_targets 4);
for (i = 0; i != header->n_targets; ++i) {
if (bam_read(fp &name_len 4) != 4) goto fail;
if (bam_is_be) bam_swap_endian_4p(&name_len);
header->target_name[i] = (char*)calloc(name_len 1);
if (bam_read(fp header->target_name[
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 55 2016-05-31 23:02 bwa-master\bwa-master\.gitignore
....... 53 2016-05-31 23:02 bwa-master\bwa-master\.travis.yml
....... 6098 2016-05-31 23:02 bwa-master\bwa-master\bamlite.c
....... 3124 2016-05-31 23:02 bwa-master\bwa-master\bamlite.h
....... 13778 2016-05-31 23:02 bwa-master\bwa-master\bntseq.c
....... 2775 2016-05-31 23:02 bwa-master\bwa-master\bntseq.h
....... 26165 2016-05-31 23:02 bwa-master\bwa-master\bwa.1
....... 13684 2016-05-31 23:02 bwa-master\bwa-master\bwa.c
....... 2044 2016-05-31 23:02 bwa-master\bwa-master\bwa.h
....... 17977 2016-05-31 23:02 bwa-master\bwa-master\bwakit\bwa-postalt.js
....... 5953 2016-05-31 23:02 bwa-master\bwa-master\bwakit\README.md
....... 6604 2016-05-31 23:02 bwa-master\bwa-master\bwakit\run-bwamem
....... 1731 2016-05-31 23:02 bwa-master\bwa-master\bwakit\run-gen-ref
....... 411 2016-05-31 23:02 bwa-master\bwa-master\bwakit\run-HLA
....... 1681 2016-05-31 23:02 bwa-master\bwa-master\bwakit\typeHLA-selctg.js
....... 16856 2016-05-31 23:02 bwa-master\bwa-master\bwakit\typeHLA.js
....... 1521 2016-05-31 23:02 bwa-master\bwa-master\bwakit\typeHLA.sh
....... 47544 2016-05-31 23:02 bwa-master\bwa-master\bwamem.c
....... 7958 2016-05-31 23:02 bwa-master\bwa-master\bwamem.h
....... 4428 2016-05-31 23:02 bwa-master\bwa-master\bwamem_extra.c
....... 17361 2016-05-31 23:02 bwa-master\bwa-master\bwamem_pair.c
....... 29383 2016-05-31 23:02 bwa-master\bwa-master\bwape.c
....... 19552 2016-05-31 23:02 bwa-master\bwa-master\bwase.c
....... 1033 2016-05-31 23:02 bwa-master\bwa-master\bwase.h
....... 6868 2016-05-31 23:02 bwa-master\bwa-master\bwaseqio.c
....... 5816 2016-05-31 23:02 bwa-master\bwa-master\bwashm.c
....... 15342 2016-05-31 23:02 bwa-master\bwa-master\bwt.c
....... 4966 2016-05-31 23:02 bwa-master\bwa-master\bwt.h
....... 11004 2016-05-31 23:02 bwa-master\bwa-master\bwtaln.c
....... 3833 2016-05-31 23:02 bwa-master\bwa-master\bwtaln.h
............此处省略53个文件信息
相关资源
- 论文研究 - 协会COL1A1 rs180012 SNP和纤维
- 论文研究 - 接受造血干细胞移植之前
- 论文研究 - 异基因干细胞移植后患者
- 论文研究 - 利用生物信息学工具研究
- 论文研究 - 乳腺癌BRCA1突变基因的微阵
- 论文研究 - 乳腺癌TWIST基因的DNA甲基化
- 论文研究 - 乳腺癌网络中推断基因的
- 转SOS1+SOS2+SOS3基因玉米的获得及耐盐性
- FGFR10P tagSNP基因多态性与中国汉族人
- 猪趋化因子CXCL12及受体基因CXCR4和CX
- 沉默CXCR1和CXCR2基因对肝癌细胞体外增
- 鸟氨酸脱羧酶抗酶1基因结构和功能
- 人可溶性TRAIL基因的克隆及其在毕赤酵
- 论文研究 - 一种新型的治疗优化系统
- 论文研究 - 通过统计学方法鉴定与肺
- 论文研究 - 依那西普治疗类风湿关节
- 论文研究 - 基因型分析显示孟加拉国
- TNF-α抑制剂治疗类风湿关节炎相关
- 紫草LeERF-1基因在拟南芥中的异源表达
- 植物钙网织蛋白基因CalreticulinCRT研究
- 植物蛋白酶抑制剂的作用机理及基因
- 论文研究 - 快速检测转基因大豆油的
- 大豆Kunitz型胰蛋白酶抑制剂基因CAPS标
- 褐飞虱膜结合型海藻糖酶基因的RNAi研
- 利用二穗短柄草鉴定小麦PAL基因的抗
- 利用RNA-Seq技术研究小麦芒长发育相关
- 抗黄曲霉毒素B1单链抗体基因的改造及
- 中华绒螯蟹EsSox21b-like基因干扰载体的
- 克隆和生物信息学分析
- 海带配子体叶绿素a/c结合蛋白基因l
评论
共有 条评论