Microarray-GeneXplorer

 view release on metacpan or  search on metacpan

bin/makeMicroarrayDataset.pl  view on Meta::CPAN

	    file         => \$filepath,
	    help         => \$help);


unless(&GetOptions( \%args, "name=s", "file=s", "rootpath=s", "contrast=f", "colorscheme=s", "corrcutoff=f", "verbose", "help")){
    &Usage;
}

if ($verbose) { 
    print "Creating new dataset, $name, from file $filepath...\n";
}

&Usage if($help);

die "Requested <rootpath> path, $rootpath doesn't exist."   if (!&DirectoryIsValid($rootpath));

# if we get here, we have everything we need to try and create a dataset

# first create a Microarray::Config object

# we just pass it a dummy root url, as we know it's not needed during
# dataset construction - not a really good solution, but this is what
# I'm reduced to when hacking other people's code...

my $config = Microarray::Config->new(rootpath => $rootpath,
				     rooturl  => 'blah');

# now create a Microarray::CdtDataset, which will take care of all the
# details to actuallt create the files that underlie a dataset

my $ds = Microarray::CdtDataset->new(name        => $name,
				     contrast    => $contrast,
				     colorscheme => $colorscheme,
				     corrcutoff  => $corrcutoff,
				     datapath    => $rootpath.'/data/explorer/',
				     imagepath   => $rootpath.'/html/explorer/',
				     initialize  => $filepath,
				     verbose     => $verbose,
				     config      => $config);

if ($args{verbose}) { 
    print "Successfully created new dataset object ".$ds->name."\n";
    print "Data are created in ".$ds->datapath."\n"; 
    print "Images are created in ".$ds->imagepath."\n"; 
}

exit;

#########################################################################
sub Usage {
#########################################################################

    print STDOUT <<EOF;

  Usage:

$0 -file <file/name> -name <intended/dataset/name> [-dataout <repository_directory> -imageout <image directory> -contrast <float> -colorscheme <rg|yb> -corrcutoff <float> -verbose]

    -----------------------------------------------------------------------------

    -file        = required input file (currently only '.cdt' files supported)

    -name        = required dataset name to be created
	           (may be delimited by slashes(/) to imply hierarchy)

    -rootpath    = required root directory, under which must exist html
		   and data directories

    -contrast    = optional contrast value for the generated images
                   (defaults to 4, As the data are expected to be in
                   log base 2, this corresponds to a 16-fold change as
                   the maximum color in any image)

    -colorscheme = optional color scheme used for generating the images
	           (rg = red/green, yb = yellow/blue ; defaults to yellow/blue)

    -corrcutoff  = optional value for correlation cutoff during dataset creation
                   (defaults to 0.5 if not specified; allowed range: 0.2 - 1.0)

    -verbose     = show feedback messages during run

EOF

    exit;

}




( run in 1.596 second using v1.01-cache-2.11-cpan-39bf76dae61 )