美文网首页ggplot集锦
gtf文件转化为bed12

gtf文件转化为bed12

作者: 日月其除 | 来源:发表于2022-02-16 15:38 被阅读0次

    bed文件的定义:
    【生信】数据格式:bed12格式详解 - 简书 (jianshu.com)

    bed文件定义中有12列,其中前三列是必须的。
    bed12表示包含12列的bed文件,包含的信息最完整。
    bed文件官方网页: https://m.ensembl.org/info/website/upload/bed.html

    前三列:

    1. chrom - name of the chromosome or scaffold. Any valid seq_region_name can be used, and chromosome names can be given with or without the 'chr' prefix.

    2. chromStart - Start position of the feature in standard chromosomal coordinates (i.e. first base is 0). 注意这里以0开始

    3. chromEnd - End position of the feature in standard chromosomal coordinates


      image.png

      其他列:
      Nine additional fields are optional. Note that columns cannot be empty - lower-numbered fields must always be populated if higher-numbered ones are used.

    4. name - Label to be displayed under the feature, if turned on in "Configure this page".

    5. score - A score between 0 and 1000. See track lines, below, for ways to configure the display style of scored data.

    6. strand - defined as + (forward) or - (reverse).

    7. thickStart - coordinate at which to start drawing the feature as a solid rectangle
      片段加粗表示的起始位点,比如基因的起始密码子位置。没有特别需求,可以直接用第二列代替

    8. thickEnd - coordinate at which to stop drawing the feature as a solid rectangle
      片段加粗表示的结束位点,比如基因上的终止密码子位置。没有特别需求,可以直接用第三列代替

    9. itemRgb - an RGB colour value (e.g. 0,0,255). Only used if there is a track line with the value of itemRgb set to "on" (case-insensitive).
      (R,G,B)格式的RGB颜色值,在用基因组浏览器显示的时候提供颜色信息。

    10. blockCount - the number of sub-elements (e.g. exons) within the feature
      block的数量,这里的block可以理解为组成同一个基因的不同exon,虽然位置没有连续在一起,但是属于同一个基因。比如,这里表示一个基因上有几个exon

    11. blockSizes - the size of these sub-elements
      逗号分隔开的N个数,N等于col10即block的数量,每个数字表示每个block的长度。

    12. blockStarts - the start coordinate of each sub-element
      逗号分隔开的N个数,N等于col10即block的数量,每个数字表示一个block的相对于第一个block的起始位置。
      比如,第一个数字一定为0,因为第一个blcok相对于它自己的起始位点为0;最后一个block的相对起始位点 + 最后一个block的长度 = chromEnd - chromStart。

    image.png

    这个例子也只给了前9列的信息

    bed12的例子
    来源:https://www.jianshu.com/p/4880f1969919

    image.png

    先使用convert2bed把gtf转化为bed6文件。再使用别人开发的工具把bed6文件转化为bed12文件。

    或者使用gtf2bed
    链接:
    https://gffutils.readthedocs.io/en/latest/gtf2bed.html
    参考:
    https://www.jianshu.com/p/847801e8bf92
    这篇文章作者写了一个python脚本可以把bed6转化为bed12。

    本来我是想使用bedtools 把bed12文件提取出fasta文件,得到read的序列信息
    所以才这么折腾

    后面查了一下,可以直接使用cufflink中的gffread把gtf文件提取出对应的fasta文件
    参考链接:
    https://www.jianshu.com/p/566954bd5711
    或者使用Tophat中的gtf_to_fasta

    gtf_to_fasta test.gtf genome.fa out_file
    

    参考:https://www.tqwba.com/x_d/jishu/204915.html

    相关文章

      网友评论

        本文标题:gtf文件转化为bed12

        本文链接:https://www.haomeiwen.com/subject/xkorlrtx.html