1 GenBank

1.1 NCBI——美国国家生物技术信息中心(美国国立生物技术信息中心)

NCBI(美国国立生物技术信息中心)是在NIH的国立医学图书馆(NLM)的一个分支。它的使命包括四项任务:1. 建立关于分子生物学,生物化学,和遗传学知识的存储和分析的自动系统 ;2.实行关于用于分析生物学重要分子和复合物的结构和功能的基于计算机的信息处理的,先进方法的研究;3. 加速生物技术研究者和医药治疗人员对数据库和软件的使用;4. 全世界范围内的生物技术信息收集的合作努力。NCBI数据库由Nucleotide(核苷酸序列数据库)、 Genome(基因组数据库)、Structure(结构数据库或称分子模型数据库)、Taxonomy(生物学门类数据库)、 PopSet几个子库组成。

美国国立生物技术信息中心(National Center for Biotechnology Information),是由美国国立卫生研究院(NIH)于1988年创办。创办NCBI的初衷是为了给分子生物学家提供一个信息储存和处理的系统。除了建有GenBank核酸序列数据库(该数据库的数据资源来自全球几大DNA数据库,其中包括日本DNA数据库DDBJ、欧洲分子生物学实验室数据库EMBL以及其它几个知名科研机构)之外,NCBI还可以提供众多功能强大的数据检索与分析工具。目前,NCBI提供的资源有Entrez、Entrez Programming Utilities、My NCBI、PubMed、PubMed Central、Entrez Gene、NCBI Taxonomy Browser、BLAST、BLAST Link (BLink)、Electronic PCR等共计36种功能,而且都可以在NCBI的主页www.ncbi.nlm.nih.gov上找到相应链接,其中多半是由BLAST功能发展而来的。

1.2 GenBank DNA数据库

GenBank是美国国家生物技术信息中心(National Center for Biotechnology Information ,NCBI)建立的DNA序列数据库,从公共资源中获取序列数据,主要是科研人员直接提供或来源于大规模基因组测序计划( Benson等, 1998)。为保证数据尽可能的完全,GenBank与EMBL(欧洲EMBL-DNA数据库)、DDBJ(日本DNA数据库:DNA Data Bank of Japan)建立了相互交换数据的合作关系。

GenBank文件就是NCBI支持的主要生信格式。读懂 GenBank 后 EMBL 就很简单了。

GenBank格式是最早和最古老的生物信息学数据格式之一,最初的发明是为了弥补人类可读的表达方式和可被计算机有效处理的表达方式之间的差距,为人类阅读而优化的,不适合大规模的数据处理。该格式有一个所谓的固定宽度格式,前十个字符组成一列,作为一个标识符,其余的行是与该标识符相对应的信息。

2 GenBank Overview

What is GenBank?
GenBank ® is the NIH genetic sequence database, an annotated collection of all publicly available DNA sequences (Nucleic Acids Research, 2013 Jan;41(D1):D36-42). GenBank is part of the International Nucleotide Sequence Database Collaboration, which comprises the DNA DataBank of Japan (DDBJ), the European Nucleotide Archive (ENA), and GenBank at NCBI. These three organizations exchange data on a daily basis.

A GenBank release occurs every two months and is available from the ftp site. The release notes for the current version of GenBank provide detailed information about the release and notifications of upcoming changes to GenBank. Release notes for previous GenBank releases are also available. GenBank growth statistics for both the traditional GenBank divisions and the WGS division are available from each release.

An annotated sample GenBank record for a Saccharomyces cerevisiae gene demonstrates many of the features of the GenBank flat file format.

Access to GenBank
There are several ways to search and retrieve data from GenBank.

Search GenBank for sequence identifiers and annotations with Entrez Nucleotide.
Search and align GenBank sequences to a query sequence using BLAST (Basic Local Alignment Search Tool). See BLAST info for more information about the numerous BLAST databases.
Search, link, and download sequences programatically using NCBI e-utilities.
The ASN.1 and flatfile formats are available at NCBI's anonymous FTP server: ftp://ftp.ncbi.nlm.nih.gov/ncbi-asn1 and ftp://ftp.ncbi.nlm.nih.gov/genbank.

GenBank Data Usage
The GenBank database is designed to provide and encourage access within the scientific community to the most up-to-date and comprehensive DNA sequence information. Therefore, NCBI places no restrictions on the use or distribution of the GenBank data. However, some submitters may claim patent, copyright, or other intellectual property rights in all or a portion of the data they have submitted. NCBI is not in a position to assess the validity of such claims, and therefore cannot provide comment or unrestricted permission concerning the use, copying, or distribution of the information contained in GenBank.

Data Processing, Status and Release
The most important source of new data for GenBank is direct submissions from a variety of individuals, including researchers, using one of our submission tools. Following submission, data are subject to automated and manual processing to ensure data integrity and quality and are subsequently made available to the public. On rare occasions, data may be removed from public view. More details about this process can be found on the NLM GenBank and SRA Data Processing.

Confidentiality
Some authors are concerned that the appearance of their data in GenBank prior to publication will compromise their work. GenBank will, upon request, withhold release of new submissions for a specified period of time. However, if the accession number or sequence data appears in print or online prior to the specified date, your sequence will be released. In order to prevent the delay in the appearance of published sequence data, we urge authors to inform us of the appearance of the published data. As soon as it is available, please send the full publication data--all authors, title, journal, volume, pages and date--to the following address: update@ncbi.nlm.nih.gov

Privacy
If you are submitting human sequences to GenBank, do not include any data that could reveal the personal identity of the source. GenBank assumes that the submitter has received any necessary informed consent authorizations required prior to submitting sequences.

3 GenBank Parser解释器C#源代码

using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Legal.BIOG
{
    [DataContract]
    public class GENBANK_ELEMENT
    {
        [DataMember(Order = 1)]
        public string Name { get; set; } = "";
        [DataMember(Order = 2)]
        public string Content { get; set; } = "";

public GENBANK_ELEMENT(int position, string buf)
        {
            Name = buf.Substring(0, position).Trim();
            Content = buf.Substring(position).Trim();
        }

public GENBANK_ELEMENT(string name, string content)
        {
            Name = name;
            Content = content;
        }
    }

[DataContract]
    public class GENBANK_REFERENCE
    {
        [DataMember(Order = 1)]
        public string Name { get; set; } = "";
        [DataMember(Order = 2)]
        public List<GENBANK_ELEMENT> Items { get; set; } = new List<GENBANK_ELEMENT>();

public void Append(int position, string buf)
        {
            Items.Add(new GENBANK_ELEMENT(position, buf));
        }

public void Append(string name, string content)
        {
            Items.Add(new GENBANK_ELEMENT(name, content));
        }

public GENBANK_ELEMENT Find(string name)
        {
            return Items.Find(t => t.Name == name);
        }
    }

[DataContract]
    public class GENBANK_FEATURE
    {
        [DataMember(Order = 1)]
        public string Name { get; set; } = "";
        [DataMember(Order = 2)]
        public string Lines { get; set; } = "";

public GENBANK_FEATURE(string name, string lines)
        {
            Name = name;
            Lines = lines;
        }

public List<string> FeatureList
        {
            get
            {
                string[] ra = B.S2L(Lines);
                return ra.ToList();
            }
        }

/// <summary>
        /// 搜索 FEATURE 项目
        /// 比如:/db_xref=
        /// </summary>
        /// <param name="name">db_xref</param>
        /// <param name="branch">db_xref</param>
        /// <returns></returns>
        public string FindBranch(string name, string branch)
        {
            List<string> list = FeatureList;
            if (Name == name)
            {
                foreach (string s in list)
                {
                    if (s.StartsWith("/" + branch + "="))
                    {
                        return s.Substring(branch.Length + 2);
                    }
                }
            }
            return "";
        }

public string Position
        {
            get
            {
                List<string> list = FeatureList;
                return (list[0].Contains("..")) ? list[0] : "";
            }
        }

public List<Point> PositionList
        {
            get
            {
                return Utility.PositionList(Position);
            }
        }
    }

[DataContract]
    public class GENBANK_Item
    {
        [DataMember(Order = 1)]
        public List<GENBANK_ELEMENT> Descriptions { get; set; } = new List<GENBANK_ELEMENT>();
        [DataMember(Order = 2)]
        public List<GENBANK_REFERENCE> References { get; set; } = new List<GENBANK_REFERENCE>();
        [DataMember(Order = 3)]
        public List<GENBANK_REFERENCE> Source { get; set; } = new List<GENBANK_REFERENCE>();
        [DataMember(Order = 4)]
        public List<GENBANK_FEATURE> Features { get; set; } = new List<GENBANK_FEATURE>();

public string Find(string name)
        {
            GENBANK_ELEMENT de = Descriptions.Find(t => t.Name == name);
            return (de.Name == name) ? de.Content : "";
        }

public string Sequence
        {
            get
            {
                GENBANK_ELEMENT sq = Descriptions.Find(t => t.Name == "ORIGIN");
                return (sq.Name == "ORIGIN") ? (sq.Content) : "";
            }
        }
    }

public class GENBANK_File
    {
        public List<GENBANK_Item> Items { get; set; } = new List<GENBANK_Item>();

public GENBANK_File(string buf)
        {
            try
            {
                string[] xlines = B.S2L(buf);
                GENBANK_Item item = null;
                for (int i = 0; i < xlines.Length; i++)
                {
                    if (xlines[i].StartsWith("LOCUS"))
                    {
                        if (item != null) { Items.Add(item); item = null; }
                        item = new GENBANK_Item();
                        item.Descriptions.Add(new GENBANK_ELEMENT(12, xlines[i]));
                        continue;
                    }
                    if (xlines[i].StartsWith("DEFINITION") ||
                        xlines[i].StartsWith("ACCESSION") ||
                        xlines[i].StartsWith("VERSION") ||
                        xlines[i].StartsWith("KEYWORDS") ||
                        xlines[i].StartsWith("COMMENT"))
                    {
                        string rs = Utility.ReadMultiLines(ref i, xlines, out string kw, 12, " ");
                        item.Descriptions.Add(new GENBANK_ELEMENT(kw, rs));
                        continue;
                    }
                    else if (xlines[i].StartsWith("SOURCE"))
                    {
                        GENBANK_REFERENCE src = new GENBANK_REFERENCE();
                        src.Name = xlines[i].Substring(12).Trim(); i++;
                        while (true)
                        {
                            string rs = Utility.ReadMultiLines(ref i, xlines, out string kw, 12);
                            src.Append(kw, rs);
                            if (xlines[i + 1].Substring(0, 1) != " ") { break; }
                            i++;
                        }
                        item.Source.Add(src);
                        continue;
                    }
                    else if (xlines[i].StartsWith("REFERENCE"))
                    {
                        GENBANK_REFERENCE rfx = new GENBANK_REFERENCE();
                        rfx.Name = xlines[i].Substring(12).Trim(); i++;
                        while (true)
                        {
                            string rs = Utility.ReadMultiLines(ref i, xlines, out string kw, 12);
                            rfx.Append(kw, rs);
                            if (xlines[i + 1].Substring(0, 1) != " ") { break; }
                            i++;
                        }
                        item.References.Add(rfx);
                        continue;
                    }
                    else if (xlines[i].StartsWith("FEATURES"))
                    {
                        item.Descriptions.Add(new GENBANK_ELEMENT("FEATURES", xlines[i].Substring(12).Trim())); i++;
                        while (true)
                        {
                            string rs = Utility.ReadFeatureLines(ref i, xlines, out string kw, 0, 21);
                            GENBANK_FEATURE ef = new GENBANK_FEATURE(kw, rs);
                            item.Features.Add(ef);
                            if (xlines[i + 1].Substring(0, 1) != " ") { break; }
                            i++;
                        }
                        continue;
                    }
                    else if (xlines[i].StartsWith("//"))
                    {
                        if (item != null) { Items.Add(item); item = null; }
                        continue;
                    }
                    else if (xlines[i].StartsWith("ORIGIN"))
                    {
                        i++;
                        string rs = Utility.ReadSequenceLines(ref i, xlines, 10);
                        item.Descriptions.Add(new GENBANK_ELEMENT("ORIGIN", rs));
                        continue;
                    }
                    else
                    {
                        item.Descriptions.Add(new GENBANK_ELEMENT("UNKNOW", xlines[i]));
                        continue;
                    }
                }
                if (item != null)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("GENBANK_File() ERROR: " + ex.Message);
            }
        }

public static GENBANK_File FromFile(string filename)
        {
            try
            {
                string buf = File.ReadAllText(filename);
                return new GENBANK_File(buf);
            }
            catch (Exception ex)
            {
                throw new Exception("GENBANK_File() ERROR: " + ex.Message);
            }
        }

public void Write_Json(string filename)
        {
            try
            {
                File.WriteAllText(filename, SimpleJson.SerializeObject(Items));
            }
            catch (Exception ex)
            {
                throw new Exception("GENBANK_File.Write_Json ERROR: " + ex.Message);
            }
        }

public string Fasta_Sequences()
        {
            StringBuilder sb = new StringBuilder();
            foreach (GENBANK_Item item in Items)
            {
                sb.AppendLine(">" + item.Find("DEFINITION"));
                sb.AppendLine(B.BreakTo(item.Sequence));
                sb.AppendLine("");
            }
            return sb.ToString();
        }

public string Print_Features()
        {
            StringBuilder sb = new StringBuilder();
            foreach (GENBANK_Item item in Items)
            {
                foreach (GENBANK_FEATURE feature in item.Features)
                {
                    if (feature.FeatureList.Count > 1)
                    {
                        sb.AppendLine(">" + feature.Name + " " + feature.FeatureList[1]);
                        sb.AppendLine(B.BreakTo(Utility.SequenceByPosition(item.Sequence, feature.PositionList)));
                        sb.AppendLine("");
                    }
                }
            }
            return sb.ToString();
        }

public string Protein()
        {
            StringBuilder sb = new StringBuilder();
            foreach (GENBANK_Item item in Items)
            {
                foreach (GENBANK_FEATURE feature in item.Features)
                {
                    string tr = feature.FindBranch("CDS", "translation");
                    if (tr.Length > 0)
                    {
                        sb.AppendLine(">" + feature.Name + " " + feature.FeatureList[1]);
                        sb.AppendLine(B.BreakTo(tr.Replace(" ", "").Replace("\"", "")));
                        sb.AppendLine("");
                    }
                }
            }
            return sb.ToString();
        }

}
}

C#,生信软件实践(06)——DNA数据库GenBank文件的详解介绍及解释器之完整C#源代码相关推荐

  1. C#,生信软件实践(01)——DNA序列数据库FASTA文件合并工具的源代码

    1 生物信息学简介 生物信息学(BioInformatics)是研究生物信息的采集.处理.存储.传播,分析和解释等各方面的学科,也是随着生命科学和计算机科学的迅猛发展,生命科学和计算机科学相结合形成的 ...

  2. C#,生信软件实践(03)——DNA数据库GenBank格式详解及转为FASTA序列格式的源代码

    1 GenBank 1.1 NCBI--美国国家生物技术信息中心(美国国立生物技术信息中心) NCBI(美国国立生物技术信息中心)是在NIH的国立医学图书馆(NLM)的一个分支.它的使命包括四项任务: ...

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

    该R包在全基因组测序WGS中可以通过用于描述突变位点在染色体上的分布,在转录组测序RNA-Seq中可用于描述差异表达基因在染色体上的分布,在WGBS中可用于描述DNA甲基化在染色体上的分布等. R包软 ...

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

    使用wisecondorX可进行拷贝数变异CNV的分析,作者在论文中对比了多种软件的使用效果,可自行根据自己的项目需要,判断是否使用. wisecondrX安装 # conda安装 conda ins ...

  5. 生信软件c语言,科学网—[转载]没有docker我真的不想动这样的生信软件 - 张成岗的博文...

    没有docker我真的不想动这样的生信软件 2020-03-26阅读 2620 C语言源代码需要编译的软件 最开始开发者都是C语言流派, 所以标准的源代码安装三部曲即可,即使 configure+ma ...

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

    下游比对数据的统计工具 picard Picard是一组命令行工具,用于处理高通量排序数据和格式,如sam/ bam/ cran和vcf文件. 安装 在Linux系统目录下执行以下命令下载软件 wge ...

  7. 生信软件 | FastQC(质量控制,查看测序质量)

    生信软件 | FastQC 介绍 高通量测序数据的高级质控工具 输入FastQ,SAM,BAM文件,输出对测序数据评估的网页报告 安装 conda install fastqc 这里需要安装Conda ...

  8. 生信软件 | Samtools(SAM文件处理工具)

    介绍 SAM(sequence Alignment/mapping) 数据格式是目前高通量测序中存放比对数据的标准格式 转换 BAM 与 SAM 格式 比对文件排序,建立fastq索引 安装 cond ...

  9. 【软件分析】软件分析、设计与建模迭代式详解

    软件分析.设计与建模迭代式详解 1.introduction 1.1 OOA/D 1.2 Iterative, Evolutionary, and Agile 2.Case Study and Req ...

最新文章

  1. python调用oracle的存储过程_python 调用 oracle 存储过程
  2. 滑动平均滤波_11种滤波算法程序大全(含源代码分享)
  3. kafka在zookeeper下的目录结构
  4. 前端一HTML:十一:其他选择器
  5. AM3354开发 -- bash: /root/opt/arm-arago-linux-gnueabi/bin/arm-arago-linux-gnueabi-gcc: No such file or
  6. 通过NetMassDownloader批量下载和使用微软.NET框架源代码
  7. 【XSY1594】棋盘控制 概率DP
  8. 系统安全防护之UNIX下***检测方法
  9. ASP.NET Core Web API + Identity Server 4 + Angular 6 实战小项目视频
  10. Ubuntu下安装nfs服务
  11. 主存储器物理地址,逻辑地址,转换
  12. vue组件(Vue+webpack项目实战系列之三)
  13. 阿里云云计算6 ECS的概念
  14. 使用JavaScript读取excel表格数据并导入到数据库
  15. 7z 7Zip 命令行压缩,解压缩文件
  16. mac怎么无线打印机连接到服务器,Mac如何连接打印机-Mac连接打印机教程 - 河东软件园...
  17. 从0开始学java-day08:eclipse的使用和超市管理系统案例
  18. HDU6438-Buy and Resell(贪心、思维题)
  19. jQuery fsBanner 手风琴
  20. cocos2dx 3.10 功夫小子学习笔记

热门文章

  1. 自定义弹窗从未如此简单——NiceDialog
  2. 深度学习 - 41.Word2vec、EGES 负采样实现 By Keras
  3. 安装MySQL8,安装时初始化数据库失败
  4. 收集的几种exe嵌入网页的方法(3)
  5. 常用元器件使用方法35:SPI Flash芯片W25Q128JVSIQ
  6. CODE 1015 计算器的改良
  7. 网络安全保险的新兴发展与监管研究
  8. 高等数学——函数连续性的相关证明(凯哥)
  9. 如何安装STM32CubeMX
  10. Android 开发日常积累