2013年5月12日星期日

[PerlChina] Re: Perl程序在windows下运行成功,但在linux下却运行没有结果,请高手帮忙看下。

我也觉得可疑之处在于 py 的程序。
建议在每个步骤加入debug代码。查看在哪一步执行出错的

在 2013年5月10日星期五UTC+8上午10时45分51秒,Perl360写道:
下面是我写的程序,本人新手,代码写的乱,还请见谅。遇到的问题是在windows下运行成功,但在linux下却运行没有结果,请帮帮我!

use File::Copy ;

open(INPUT,"taxID.txt");

$i=0;
while (<INPUT>) {
        chomp($_);
        chomp($_);
        $M[$i] = $_;
        $i++;
}
$len=@M;

for ($i=0;$i<$len;$i++) {

        open(INPUT1,"417species_PPI.txt");
        open(OUTPUT1,">species_PPI.txt");

        my $species = $M[$i];

        mkdir($species,0755)||die "can't create directory: $!" ;

        print "Now it is ",$species," it is the ",$i," of these species,remains  
",$len-$i," species.\n";

        while(<INPUT1>) {
                if ($_=~/^($M[$i])\.(.*)/){
                print OUTPUT1 $_;
                }
        }
        close(INPUT1);
        close(OUTPUT1);

        open(INPUT2,"species_PPI.txt");
        open(OUTPUT2,">species_PPI2.txt");

        while(<INPUT2>) {
                chomp($_);
                my@a=split/\s/;
                print OUTPUT2 "$a[0]\t$a[1]\n";
        }
        close INPUT2;
        close OUTPUT2;

        $system_check=system("python jisuan.py");

        open INPUT3,"degree_centrality.txt";
        open INPUT4,"closeness_centrality.txt";
        open INPUT5,"betweenness_centrality.txt";
        open INPUT6,"clustering_coefficient.txt";
        open OUTPUT3,">degreenew_centrality.txt";
        open OUTPUT4,">closenessnew_centrality.txt";
        open OUTPUT5,">betweennessnew_centrality.txt";
        open OUTPUT6,">clusteringnew_coefficient.txt";

        while (<INPUT3>) {
                s/{(.*)}/$1/g;
                s/\s//g;
                s/,/\n/g;
                s/'(.*)'\:(\d+)/$1\t$2/g;
                print OUTPUT3 $_,"\n";
        }
        close INPUT3;
        close OUTPUT3;
        while (<INPUT4>) {
                s/{(.*)}/$1/g;
                s/\s//g;
                s/,/\n/g;
                s/'(.*)'\:(\d+)/$2/g;
                print OUTPUT4 $_,"\n";
        }
        close INPUT4;
        close OUTPUT4;
        while (<INPUT5>) {
                s/{(.*)}/$1/g;
                s/\s//g;
                s/,/\n/g;
                s/'(.*)'\:(\d+)/$2/g;
                print OUTPUT5 $_,"\n";
        }
        close INPUT5;
        close OUTPUT5;
        while (<INPUT6>) {
                s/{(.*)}/$1/g;
                s/\s//g;
                s/,/\n/g;
                s/'(.*)'\:(\d+)/$2/g;
                print OUTPUT6 $_,"\n";
        }
        close INPUT6;
        close OUTPUT6;

        move("degreenew_centrality.txt","$species")||warn "could not copy files  
:$!" ;
        move("closenessnew_centrality.txt","$species")||warn "could not copy  
files :$!" ;
        move("betweennessnew_centrality.txt","$species")||warn "could not copy  
files :$!" ;
        move("clusteringnew_coefficient.txt","$species")||warn "could not copy  
files :$!" ;

}
close INPUT;

--
使用Opera的电子邮件客户端:http://www.opera.com/mail/

--
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 perlchina+unsubscribe@googlegroups.com。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
 
 

没有评论: