[Bioperl-l] MicroarrayIO proposal

Allen Day allenday@ucla.edu
Fri, 11 Oct 2002 17:05:05 -0700 (PDT)


Hi all,

I'm getting ready to commit some MicroarrayIO classes to bioperl-live, but 
first I'd like to get some feedback on how I've set them up.  See below:

Hierarchy is like this:

Bio/
	Expression/
		Microarray/
			ProbeI.pm
			Probeset.pm
			Affymetrix/
				Array.pm
				Data.pm
				Probe.pm
		MicroarrayI.pm
		MicroarrayIO.pm
		MicroarrayIO/
			affymetrix.pm
		ProbeI.pm




And usage is like this:

use Bio::Expression::MicroarrayIO;

# create an IO object.  an array object is created
# based on -template
my $mio = Bio::Expression::MicroarrayIO->new(
             -file     => 'path/to/datafile',
             -format   => 'affymetrix',
             -template => 'path/to/template',
          );

# fill the array object created by the constructor
# with data from the next array.  returns a
# Bio::Expression::MicroarrayI compliant object
my $array = $mio->next_array;

# this will write affy-format files, given
# a MicroarrayI compliant object
my $out = Bio::Expression::MicroarrayIO->new(
             -file     => '>path/to/outputfile',
             -format   => 'affymetrix',
          );

#write $array to file
$out->write_array($array);

#print a list of outliers and masked probes
foreach my $probeset ($array->each_probeset){
	foreach my $probe ($probeset->each_probe){
		next unless $probe->is_outlier or $probe->is_masked;
		print join "\t", (
			$probeset->id,
			$probe->x,
			$probe->y,
			$probe->value,
			$probe->is_outlier,
			$probe->is_masked,
			"\n";
		)
	}
}


Comments appreciated.  Enjoy the weekend.

-Allen