Ignore:
Timestamp:
Apr 17, 2008, 12:46:13 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Added support for using configurable columns. Useful if BASE extra values are used for intensity and background SD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/base1/se.lu.thep.wenni/trunk/base/base1/base_plugin_script/wenni.pl

    r115 r665  
    2929sub basefile_options($$);
    3030sub BaseFileConverter($);
    31 sub cleanup($);
     31sub cleanup($$);
    3232sub cmdline_options($);
    3333sub nni($);
    34 sub NNIFileConverter($$);
     34sub NNIFileConverter($);
    3535sub result($$);
    3636
     
    4949# determine beta and number of neighbours. Presedence order is (low to
    5050# high priority): default value, basefile value, command line value.
    51 my %option=( beta => 0.6, datatype => "derived",
    52              neighbours => 4, nodelete => 0 );
     51my %option=(
     52    beta => 0.6,
     53    datatype => "derived",
     54    intensity1 => "intensity1",
     55    intensity2 => "intensity2",
     56    neighbours => 4,
     57    nodelete => 0,
     58    BCh1SD => "BCh1SD",
     59    BCh2SD => "BCh2SD"
     60    );
    5361basefile_options(\%option,$basefile);
    5462foreach my $key (keys %cmdline_option) {
     
    5967}
    6068
    61 BaseFileConverter($option{'datatype'});
    62 NNIFileConverter($option{'beta'},$option{'datatype'});
     69BaseFileConverter(\%option);
     70NNIFileConverter(\%option);
    6371nni($option{'neighbours'});
    64 result($basefile,$option{'datatype'});
     72result($basefile,\%option);
    6573if (!$option{'nodelete'}) {
    66     cleanup($basefile);
     74    cleanup($basefile,\%option);
    6775}
    6876
     
    92100
    93101sub BaseFileConverter($) {
    94     my $datatype=$_[0];
     102    my $option=$_[0];
    95103    my $command="$FindBin::Bin/BaseFileConverter";
    96104    $command.=" BASEfile.data";
    97105    $command.=" wenni_";
    98     if ($datatype eq "derived") {
    99       $command.=" -assayFields intensity1";
    100       $command.=" -assayFields intensity2";
     106    if ($option{"datatype"} eq "derived") {
     107      $command.=" -assayFields $$option{intensity1}";
     108      $command.=" -assayFields $$option{intensity2}";
    101109    }
    102110    else {
     
    106114      $command.=" -assayFields BCh2Mean";
    107115    }
    108     $command.=" -assayFields BCh1SD";
    109     $command.=" -assayFields BCh2SD";
     116    $command.=" -assayFields $$option{BCh1SD}";
     117    $command.=" -assayFields $$option{BCh2SD}";
    110118    return system("$command");
    111119}
    112120
    113 sub cleanup($) {
     121sub cleanup($$) {
    114122    my $basefile=$_[0];
     123    my $option=$_[1];
    115124    unlink($basefile);
    116125    unlink("wenni_BCh1Mean.data");
    117     unlink("wenni_BCh1SD.data");
     126    unlink("wenni_$$option{BCh1SD}.data");
    118127    unlink("wenni_BCh2Mean.data");
    119     unlink("wenni_BCh2SD.data");
     128    unlink("wenni_$$option{BCh2SD}.data");
    120129    unlink("wenni_FCh1Mean.data");
    121130    unlink("wenni_FCh2Mean.data");
    122131    unlink("wenni_imputed.data");
    123     unlink("wenni_intensity1.data");
    124     unlink("wenni_intensity2.data");
     132    unlink("wenni_$$option{intensity1}.data");
     133    unlink("wenni_$$option{intensity2}.data");
    125134    unlink("wenni_logratio.data");
    126135    unlink("wenni_weight.data");
     
    187196}
    188197
    189 sub NNIFileConverter($$) {
    190     my $beta=$_[0];
    191     my $datatype=$_[1];
     198sub NNIFileConverter($) {
     199    my $option=$_[0];
    192200    my $command="$FindBin::Bin/NNIFileConverter";
    193     $command.=" -beta $beta";
    194     if ($datatype eq "derived") {
    195       $command.=" -fg1 wenni_intensity1.data";
    196       $command.=" -fg2 wenni_intensity2.data";
     201    $command.=" -beta $$option{'beta'}";
     202    if ($$option{'datatype'} eq "derived") {
     203      $command.=" -fg1 wenni_$$option{intensity1}.data";
     204      $command.=" -fg2 wenni_$$option{intensity2}.data";
    197205      $command.=" -datatype derived";
    198206    }
     
    204212        $command.=" -datatype raw";
    205213    }
    206     $command.=" -bgstd1 wenni_BCh1SD.data";
    207     $command.=" -bgstd2 wenni_BCh2SD.data";
     214    $command.=" -bgstd1 wenni_$$option{BCh1SD}.data";
     215    $command.=" -bgstd2 wenni_$$option{BCh2SD}.data";
    208216    $command.=" -logratio wenni_logratio.data";
    209217    $command.=" -weight wenni_weight.data";
     
    213221sub result($$) {
    214222    my $basefile=$_[0];
    215     my $datatype=$_[1];
     223    my $option=$_[1];
     224    my $datatype=$$option{'datatype'};
    216225    print "BASEfile\n";
    217226    print "section\tspots\n";
     
    255264    }
    256265    else {
    257         open(F1FILE,"<wenni_intensity1.data");
    258         open(F2FILE,"<wenni_intensity2.data");
     266        open(F1FILE,"<wenni_$$option{intensity1}.data");
     267        open(F2FILE,"<wenni_$$option{intensity2}.data");
    259268    }
    260269    while (<IMPUTEFILE>) {
Note: See TracChangeset for help on using the changeset viewer.