生物分子模拟论坛

 找回密码
 我想注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 8436|回复: 4

[Perl] 查询筛选化合物是否在国内买到的perl脚本

[复制链接]
发表于 2013-10-30 20:08:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,下载更多分子模拟资源。

您需要 登录 才可以下载或查看,没有帐号?我想注册

x
背景:
所筛选的小分子库不是商业库,筛完药以后,我们会得到打分比较靠前的化合物,这时候我们需要想办法购买。
chemical book上面有供应商的信息,是根据cas号查询的。
利用chemical book网站,化合物的cas号以及perl,告诉你那些化合物是买的到的。
脚本puravailable.pl

#!/usr/bin/perl -w

use strict;
use LWP::Simple;
#use Encode;
use utf8;
binmode(STDIN,':encoding(utf8)');
binmode(STDOUT,':encoding(utf8)');
binmode(STDERR,':encoding(utf8)');
#funciont: according the cas id to report the chemical is available in china
#usage:perl puravailable.pl -input cas.txt -output buy.txt
#author :Zhaoqiang Chen 744891290@qq.com

my $name;
my  $baseurl='http://www.chemicalbook.com/Search.aspx?keyword=';
my $url;
if(@ARGV!=4)
{
$name="11006-56-7";




print '#usage:perl puravailable.pl -input cas.txt -output buy.txt';

$url="$baseurl"."$name";
#print $url;
my $content=get($url);

if($content=~/国内供应商(\(\d+\))/)
{
    print "example:11006-56-7 have";
    print $1;
    print " vendors in china,the details in chemical book\n";
}


print "\n";
}
else
{
  open FH,$ARGV[1];
  open FF,">>$ARGV[3]";
  while(<FH>)
  {
    chomp($_);
    $name=$_;
       $url="$baseurl"."$name";
      my $content=get($url);

    if($content=~/国内供应商\((\d+)\)/)
     {
    print "$_  have ";
    print $1;
    print " vendors in china,the details in chemical book\n";
        print FF "$_   ";
    print FF $1;
    print FF "\n";
     }
  }

   

}


   





发表于 2013-10-31 08:47:19 | 显示全部楼层
你真是人才啊   这种事情都能用这么专业的东西解决
 楼主| 发表于 2013-10-31 10:13:30 | 显示全部楼层
发表于 2013-10-31 17:35:42 | 显示全部楼层
{:soso_e179:}{:soso_e142:}
发表于 2015-8-2 11:00:47 | 显示全部楼层
膜拜,真是人才
您需要登录后才可以回帖 登录 | 我想注册

本版积分规则

QQ|分迪科技|小黑屋|手机版|Archiver|生物分子模拟论坛 ( 蜀ICP备14009200号-3 )

GMT+8, 2024-4-27 12:20 , Processed in 0.063372 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表