免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: sky_lij
打印 上一主题 下一主题

初学者求教 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2011-03-22 14:56 |只看该作者

论坛徽章:
0
12 [报告]
发表于 2011-03-23 10:39 |只看该作者
回复 11# masylichu


   
谢谢

论坛徽章:
0
13 [报告]
发表于 2011-03-24 10:40 |只看该作者
#!/usr/bin/perl

open UNIPROT, "file";

while(<UNIPROT>){
if(/^ID/ && /\s+(.*?_HUMAN)/){
$ID = $1;
chomp($ID);
}
if(/^AC/ && /\s+(.*?)\;/){
$AC = $1;
chomp($AC);
}
if(/^FT/ && /SIGNAL/){
s/By\s+//; #过滤不必要的字符
chomp;
($FT, $SIGNAL, $start, $stop, $status) = split /\s+/;
print "$ID\t$AC\t$SIGNAL\t$start\t$stop\t$status\n";
}
if(/^\/\//){
reset $ID;
reset $AC;
reset $SIGNAL;
reset $start;
reset $stop;
reset $status;
}
}

论坛徽章:
0
14 [报告]
发表于 2011-03-24 11:09 |只看该作者
  1. #!perl

  2. use strict;
  3. use warnings;
  4. use 5.010;

  5. open EMBL, "<", "embl.txt"
  6.         or die "cannot open the file:$!\n";
  7.        
  8. open TMP, ">", "tmp.txt"
  9.         or die "cannot open the file:$!\n";

  10. my $id;
  11. my $ac;

  12. while (<EMBL>) {
  13.        
  14.         chomp;
  15.        
  16.         if (/^ID/ .. /SIGNAL/) {
  17.                 if (/^ID/) {
  18.                         $id = (split)[1];
  19.                 }

  20.                 if (/^AC/) {
  21.                         $ac = (split /;/, (split)[1])[0];
  22.                 }
  23.                
  24.                 if (/SIGNAL/) {
  25.                         my ($s1, $s2, $s3, $s4) = (split)[1, 2, 3, 4];
  26.                         printf TMP "%s %s %s %s %s %s\n", $id, $ac, $s1, $s2, $s3, $s4 // "";
  27.                 }

  28.         }
  29.        
  30. }

  31. close EMBL;
  32. close TMP;
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP