check fasta format
reference: https://www.biostars.org/p/42126/
fasta.y
%{
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int yylex();
int yyerror( char* message);
%}
%error-verbose
%token LT OTHER SYMBOL CR
%start input
%%
input: input sequence | optspaces sequence;
sequence: head body optspaces;
head: LT anylist CR | LT CR;
anylist: anylist any | any;
any: LT | OTHER | SYMBOL;
body: symbols CR | body symbols CR ;
symbols: symbols symbol | symbol ;
symbol: SYMBOL;
optspaces: | crlist;
crlist: crlist CR | CR;
%%
int yyerror( char* message)
{
fprintf(stderr,"NOT A FASTA %s\n",message);
exit(EXIT_FAILURE);
return -1;
}
int yylex()
{
int c=fgetc(stdin);
switch(c)
{
case EOF: return c;
case '>' : return LT;
case '\n' : return CR;
default: return isalpha(c)?SYMBOL:OTHER;
}
}
int main(int argc, char** argv)
{
return yyparse();
}
#compile
bison fasta.y
gcc -Wall -O3 fasta.tab.c
#test
$ ./a.out < ~/file.xml
NOT A FASTA syntax error, unexpected OTHER, expecting LT
$ ./a.out < ~/rotavirus.fasta
$
check fasta format的更多相关文章
- Validate the date format
Validate the date format function checkdate(input) { var validformat = /^\d{2}\/\d{2}\/\d{4}$/; //Ba ...
- How To Use Coordinates To Extract Sequences In Fasta File
[1] bedtools (https://github.com/arq5x/bedtools2) here is also bedtools (https://github.com/arq5x/be ...
- INTZ DX format
http://aras-p.info/texts/D3D9GPUHacks.html 格式 用法 资源 描述 NVIDIA GeForce AMD Radeon 英特尔 阴影映射 D3DFMT_D16 ...
- SAMTOOLS使用 SAM BAM文件处理
[怪毛匠子 整理] samtools学习及使用范例,以及官方文档详解 #第一步:把sam文件转换成bam文件,我们得到map.bam文件 system"samtools view -bS m ...
- 构建NCBI本地BLAST数据库 (NR NT等) | blastx/diamond使用方法 | blast构建索引 | makeblastdb
参考链接: FTP README 如何下载 NCBI NR NT数据库? 下载blast:ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+ 先了解 ...
- Running command-line BLAST
Ubuntu安装BLAST 2014-02-09 10:45:03| 分类: Linux/Ubuntu|举报|字号 订阅 下载LOFTER我的照片书 | very easy! su ...
- 32、Differential Gene Expression using RNA-Seq (Workflow)
转载: https://github.com/twbattaglia/RNAseq-workflow Introduction RNAseq is becoming the one of the mo ...
- samtools常用命令详解
samtools的说明文档:http://samtools.sourceforge.net/samtools.shtmlsamtools是一个用于操作sam和bam文件的工具合集.包含有许多命令.以下 ...
- 使用PowerShell解三道测试开发笔试题
在网上看到了三道测试开发的笔试题,答案是用Python解的.这段时间正好在学PowerShell,练习一下:) 1. 验证邮箱格式 2. 获取URL的后缀名 3. 获取前一天时间或前一秒 我的解法是: ...
随机推荐
- Android编码规范04
private final String MESSAGE_WARN = "您输入的密码有误,请重新输入!"; private final String CLASS_ONE = &q ...
- ADO.NET五大对象理论和实践(草稿)
一.ADO.NET五大对象理论 1. Connection:与数据源建立连接. 2. Command:对数据源执行SQL命令并返回结果. Command对象在执行的的时候有几个比较重要的方法,如Exe ...
- Linux 硬盘分区生效命令partprobe
在Linux中使用fdisk命令进行分区时,有时会遇到"WARNING: Re-reading the partition table failed with error 16: Devic ...
- SQL Server 2008 R2——使用FOR XML PATH实现多条信息按指定格式在一行显示
=================================版权声明================================= 版权声明:原创文章 谢绝转载 请通过右侧公告中的“联系邮 ...
- Android开发究竟用什么工具,Eclipse||AS
所谓公欲善其事必先利器,那就让我们来看一下android的开发工具吧,安卓的开发工具有Eclipse和Android Studio,另外还有IntelliJ IDEA,可能很多人并不知道. 首先看一下 ...
- Linux 如何实现 VLAN - 每天5分钟玩转 OpenStack(12)
LAN 表示 Local Area Network,本地局域网,通常使用 Hub 和 Switch 来连接 LAN 中的计算机.一般来说,两台计算机连入同一个 Hub 或者 Switch 时,它们就在 ...
- jQuery 3.0 的 Data 浅析
jQuery 3.0 在6月9日正式发布了,3.0 也被称为下一代的 jQuery .这个版本从14年10月开始,其中发布过一次beta 版(2016/1/14,)和候选版(2016/05/20).一 ...
- DIV+CSS 图文混排的图片居中办法
不少人为了让 Div 图文混排的图片可以居中,给 IMG 套各式各样的 SPAN.DIV.LI 等等,以便于使用 text-align来进行居中. <div>图文混排 <br> ...
- Ubuntu 部署 Node.js 应用
安装Node.js环境 sudo apt-get install nodejs sudo apt-get install npm 对于不同环境依赖 的node_module可以采用以下命令来重新生成 ...
- Centos7 and docker practices
1. Failed to get D-Bus connection: Operation not permitted error when you execute the systemctl star ...