酶切位点分析(the analysis of enzyme sites)

转自 http://www.yelinsky.com/blog/archives/278.html
稍有修改

默认位点为“CCGG”。其他位点分析可修改脚本中的 my $site = ‘CCGG';和 my $n = 2;

#!/usr/bin/perl -w

use strict;
use Getopt::Long;
use Bio::SeqIO;

my %opts;

GetOptions(\%opts, "i=s", "o=s");

if (!(defined $opts{i} and defined $opts{o})){
        print "\n";
        &usage;
}

my $input_file = $opts{'i'};
my $output_file = $opts{'o'};
my $site = 'CCGG';
my $n = 2;

my $db = Bio::SeqIO->new(-format => 'fasta', -file => $input_file);

unless ( open(RESULT, ">$output_file") ) {
        print "Cannot open \"$output_file\" to write to!!\n\n";
exit;
}

while ( my $seq = $db->next_seq) {
        my $str = $seq->seq;
        if ( $str =~ /$site/ ) {
                #print RESULT index ($str, $site, 0)+$n, "\n";
                print RESULT $seq->id, " -> ", index ($str, $site, 0)+$n,"\n";
        }
}

close(RESULT);

sub usage {
        print <<"USAGE";
Usage:
        $0 -i <input_file> -o <output_file>
options:
        -i input fasta sequence file
        -o output file name
USAGE
        print "\n";
        exit(1);
}

转载于:https://www.cnblogs.com/liuhui0622/p/5025779.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值