cut -d " " -f 1 sequences.fa | tr -s "\n" "\t"| sed -s 's/>/\n/g' > sequences.tab

while read id start end; do \
g=$(grep "$id" sequences.tab | cut -f 2 | cut -c $start-$end);\
echo ">$id";\
echo $g;\
done<coordinates.txt
#!/usr/bin/perl -w

use Bio::DB::Fasta;

#Usage: extract_substring.pl file.fasta coordinates.txt (where: id, start, stop) > out.fasta

my $fasta = $ARGV[0];
my $query = $ARGV[1];
my ($id,$start,$stop); my $db = Bio::DB::Fasta -> new($fasta); # Create database from a directory of Fasta files
# my $db = Bio::DB::Fasta->new('/path/to/fasta/files/');
open (IN1, $query);
while (<IN1>) {
($id,$start,$stop) = split "\t";
my $subseq = $db->subseq($id,$start,$stop);
print ">", $id, "_", $start, "_", $stop;
print $subseq, "\n";
}
close IN1;

Extract Fasta Sequences Sub Sets by position的更多相关文章

  1. 根据位置信息提取 fasta 文件中的序列 -- extract fasta sequence by their position

    #!/usr/bin/env python # usages: python extract_seq_by_pos.py input.fasta id_start_end > result.fa ...

  2. Lua 5.1 参考手册

    Lua 5.1 参考手册 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes 云风 译 www.codingno ...

  3. Getting started with new I/O (NIO)--reference

    The new input/output (NIO) library, introduced with JDK 1.4, provides high-speed, block-oriented I/O ...

  4. NGS中的一些软件功能介绍

    1.bowtie 短序列比对工具,blast也是短序列比对工具,速度快,结果易理解. 输入可以是fastq或者fasta文件. 生成比对结果文件sam格式的吧. 2.bwa 转自:https://ww ...

  5. T-SQL Recipes之Separating elements

    Separating elements Separating elements is a classic T-SQL challenge. It involves a table called Arr ...

  6. CSharpGL(4)设计和使用Camera

    CSharpGL(4)设计和使用Camera +BIT祝威+悄悄在此留下版了个权的信息说: 主要内容 描述在OpenGL中Camera的概念和用处. 设计一个Camera以及操控Camera的Sate ...

  7. Microsoft Win32 to Microsoft .NET Framework API Map

    Microsoft Win32 to Microsoft .NET Framework API Map .NET Development (General) Technical Articles   ...

  8. Digests from CG articales

    Turtle Talk Prior to the on-set motion capture, the team had the actors perform expressions while be ...

  9. jQuery String Functions

    In today's post, I have put together all jQuery String Functions. Well, I should say that these are ...

随机推荐

  1. FiveChess笔记

    //为0,表示该位置没有棋子:1表示该位置下过黑子:2白子 int[][] allChess = new int[19][19];//同时还通过下标记录了棋子的相对位置 1.对话框: 确认对话框(0是 ...

  2. win7登录后开机密码破解读取

    在win7登录后,win7密码可以直接读取. https://github.com/gentilkiwi/mimikatz

  3. jquery 时间运算、格式化的方法扩张

    /* 函数:日期 加n天 参数:n是天数 返回:n天后的日期 */ Date.prototype.addDays = Date.prototype.addDays || function (n) { ...

  4. 【转】$_POST 与 php://input的区别分析

    $data = file_get_contents("php://input"); php://input 是个可以访问请求的原始数据的只读流. POST 请求的情况下,最好使用 ...

  5. Linux execve函数簇用法

    exec函数簇实现的功能都是用一个新程序替换原来的程序,替换的内容包括堆栈段,代码段,进程控制器PCD,但是原进程的PID保持不变 int execl(const char *path, const ...

  6. eval的对于验证数学公式的用处

    var a=10,b=20; var s=a+b+((a/b)+(a+(a-b)))+(11)/a; var r=eval(s); console.log(r); 只要不报错,说明公式正确, 报错公式 ...

  7. 清北学堂2017NOIP冬令营入学测试P4747 D’s problem(d)

    时间: 1000ms / 空间: 655360KiB / Java类名: Main 背景 冬令营入学测试题 描述 题目描述 小D是一名魔法师,它最喜欢干的事就是对批判记者了. 这次记者招待会上,记者对 ...

  8. 《程序设计教学法--以Java程序设计为例》

    <程序设计教学法--以Java程序设计为例> 当老师上的第一门课就是<Java程序设计>,工作以来,断断续续上了近十次课了吧.十几年来,教材.课程内容.教学方法.教学手段不断改 ...

  9. 数据字典生成工具之旅(3):PowerDesign文件组成结构介绍及操作

    从这篇开始将正式讲解整个重要部分的实现细节,本篇讲解Pdm文件的解析.其实PDM文件就是XML文件,可以用Editplus或者VS打开查看.了解到这一点之后大家就能猜到,可以用解析XML的方式读取PD ...

  10. Theano2.1.10-基础知识之循环

    来自:http://deeplearning.net/software/theano/tutorial/loop.html loop 一.Scan 一个递归的通常的形式,可以用来作为循环语句. 约间和 ...