Extract Fasta Sequences Sub Sets by position
2015-12-04 16:52
441 查看
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;
相关文章推荐
- 对django框架架构和request/response处理流程的分析
- mysql key primary key unique index index的区别
- js给select设置value值和显示值
- [zz]UITableView进行讲解 真的是太详细了
- [LeetCode]Unique Paths II
- Android属性之build.prop生成过程
- EsayUI datagrid 刷新问题
- 初探物联网 - 基于Arduino的气象站和View and Data API的结合实例
- iOS上架准备工作(一)--版本号和编译号 (Version Numbers and Build Numbers)
- Builder design pattern in java
- Ubuntu ROS Arduino Gazebo学习镜像iso说明(indigo版)
- Ubuntu ROS Arduino Gazebo学习镜像iso说明(indigo版)
- Ubuntu ROS Arduino Gazebo学习镜像iso说明(indigo版)
- UIImageJPEGRepresentation和UIImagePNGRepresentation
- NSData、 UIImage、ALAsset之间的关系和转化
- ERROR 1269 (HY000): Can't revoke all privileges for one or more of the requested users
- Obtaining, Configuring and Building unixODBC
- 通过实现一个TableView来理解iOS UI编程
- hdu 1159 Common Subsequence
- 关于easyui textbox赋值