Extract Fasta Sequences Sub Sets by position
生活随笔
收集整理的這篇文章主要介紹了
Extract Fasta Sequences Sub Sets by position
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 20155336 2016-2017-
- 下一篇: 多媒体开发之---开源库ffmeg的lo