perl脚本,用于在multifasta文件中搜索主题,并打印完整的序列以及标题行 [英] perl Script to search for a motif in a multifasta file and print the complete sequence along with the header line

查看:61
本文介绍了perl脚本,用于在multifasta文件中搜索主题,并打印完整的序列以及标题行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在一个multi fasta文件中搜索一个主题并打印包含该主题的行..但是我需要打印所有序列以及包含fasta序列的主题的标题行.请帮助我,我只是perl的初学者

I am able to search a motif in a multi fasta file and print the line containing the motif.... but i need to print all the sequences along with the header line of the motif containing fasta sequence. Please help me i am just a beginner in perl

#!usr/bin/perl -w
use strict;

print STDOUT "Enter the motif: ";
my $motif = <STDIN>;
chomp $motif;


my $line;
open (FILE, "data.fa");
while ($line = <FILE>) {
  if ($line =~ /$motif/)  {
     print $line;
   }
}

推荐答案

尝试一下:

Bio :: DB :: Fasta

页面上的说明.有关更多示例或说明,请在Google上搜索:使用Bio :: DB :: Fasta"

Instructions on the page. For more examples or instructions just search Google for: "use Bio::DB::Fasta"

要安装此软件,只需遵循以下任何说明,我建议以超级用户身份使用CPAN.pm方法:

To install this simply follow any of these instructions, I suggest using the CPAN.pm method as super user:

安装Perl模块

这篇关于perl脚本,用于在multifasta文件中搜索主题,并打印完整的序列以及标题行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆