1. cut -d " " -f 1 sequences.fa | tr -s "\n" "\t"| sed -s 's/>/\n/g' > sequences.tab
  2. while read id start end; do \
  3. g=$(grep "$id" sequences.tab | cut -f 2 | cut -c $start-$end);\
  4. echo ">$id";\
  5. echo $g;\
  6. done<coordinates.txt
  1. #!/usr/bin/perl -w
  2. use Bio::DB::Fasta;
  3. #Usage: extract_substring.pl file.fasta coordinates.txt (where: id, start, stop) > out.fasta
  4. my $fasta = $ARGV[0];
  5. my $query = $ARGV[1];
  6. my ($id,$start,$stop);
  7. my $db = Bio::DB::Fasta -> new($fasta); # Create database from a directory of Fasta files
  8. # my $db = Bio::DB::Fasta->new('/path/to/fasta/files/');
  9. open (IN1, $query);
  10. while (<IN1>) {
  11. ($id,$start,$stop) = split "\t";
  12. my $subseq = $db->subseq($id,$start,$stop);
  13. print ">", $id, "_", $start, "_", $stop;
  14. print $subseq, "\n";
  15. }
  16. 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. 如何撰写PRD

    PRD(Product-Requirement-Document,产品需求文档),这对于任何一个产品经理来说都不会陌生的一个文档,一个PRD是衡量一个产品经理整体思维的标准,一个PRD可以看出一个产品 ...

  2. 启动Eclipse后卡在 android sdk content loader 的解决办法

    Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the tas ...

  3. Java 集合系列12之 TreeMap详细介绍(源码解析)和使用示例

    概要 这一章,我们对TreeMap进行学习.我们先对TreeMap有个整体认识,然后再学习它的源码,最后再通过实例来学会使用TreeMap.内容包括:第1部分 TreeMap介绍第2部分 TreeMa ...

  4. scala 学习笔记(01) 函数定义、分支、循环、异常处理、递归

    package yjmyzz import scala.io.StdIn object ScalaApp { def main(args: Array[String]) { println(" ...

  5. ASP.NET Web API 安全验证之摘要(Digest)认证

    在基本认证的方式中,主要的安全问题来自于用户信息的明文传输,而在摘要认证中,主要通过一些手段避免了此问题,大大增加了安全性. 1.客户端匿名的方式请求 (无认证) HTTP/ Unauthorized ...

  6. C#实现每隔一段时间执行代码(多线程)

    总结以下三种方法,实现c#每隔一段时间执行代码: 方法一:调用线程执行方法,在方法中实现死循环,每个循环Sleep设定时间: 方法二:使用System.Timers.Timer类: 方法三:使用Sys ...

  7. 如何解决xml在eclipse下的拼写报错

    进入preferences——键入“spelling”——看到勾选框:Enable spelling check,去掉勾选框,可消除eclipse下的拼写错误

  8. 10-xargs 简明笔记

    从标准你输入获取内容创建和执行命令 xargs     [options] 选项 -n                                               数字,分组 示例 x ...

  9. 42-stat 显示文件的信息

    显示文件的信息 stat [options] [file-list] 参数 file-list指定stat所显示的一个或多个文件的路径名 选项 -f                     显示文件系 ...

  10. 数据库高可用架构(MySQL、Oracle、MongoDB、Redis)

    一.MySQL MySQL小型高可用架构 方案:MySQL双主.主从 + Keepalived主从自动切换   服务器资源:两台PC Server 优点:架构简单,节省资源 缺点:无法线性扩展,主从失 ...