Drkcore

29 12 2006 chemoinformatics Tweet

smi2pngの幅と高さを指定できるようにした

高さとか幅とか指定して画像に出力するように、コマンドを書いた。というわけで、これよりは使いやすくなった。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl

use strict;
use warnings;
use CDK::Smi2Png;
use Getopt::Long;

my $width = 300;
my $height = 300;
my $output = "output.png";

my $result = GetOptions(
                        "width=i" => \$width,
                        "height=i" => \$height,
                        "output=s" => \$output,
);

sub usage
{
  print <<EOF;
usage:

smi2png [-w <width>] [-h <height>] [-o <output>] <SMILES>

  -w, --width             width of output
  -h, --height            height of output
  -o, --output            output PNG file name

EOF
print "\n";
exit;
}

my $smi = shift || usage();

$smi = (split(/\t/, $smi))[0];

my $smic = CDK::Smi2Png->new();
$smic->writePNG($smi,$width,$height,$output);

使い方は、

smi2png -w 200 -h 200 -o thiophene.png "C1=CSC=C1"

とか。

あとは、ベンゼン環をチオフェンに変換するようなモジュールをChemichoに追加した。

benzene

これで、6員環が生物学的等価体の5員環に置換されるようになった。

thiophene

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021