美文网首页
perl调用fisher检验子程序

perl调用fisher检验子程序

作者: pumpkinC | 来源:发表于2022-05-01 08:38 被阅读0次

    介绍:perl子程序: 调用R中fisher检验

    sub fisher {
    
        my ($a, $b, $c, $d, $result) = @_;
    
        ##########################################
        ##               Mem     Women
        ##Dieting        a       c
        ##Non-dieting    b       d
    
        my $tmpOut = "xxxtmpOut.R";
    
        open   OUTZZZ, ">$tmpOut";
        print  OUTZZZ  'x <- matrix('."c($a, $b, $c, $d)".',ncol=2,nrow=2)', "\n";
        print  OUTZZZ  'fisher.test(x)$p.value', "\n";
        close  OUTZZZ;
    
        my $line = `Rscript $tmpOut`;
    
        if($line =~ /\s+(\S+)\n/){
           $$result = $1;
        }
    
    }
    
    

    相关文章

      网友评论

          本文标题:perl调用fisher检验子程序

          本文链接:https://www.haomeiwen.com/subject/deesyrtx.html