The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bio::Affymetrix::CHP- parse Affymetrix CHP files

SYNOPSIS

use Bio::Affymetrix::CHP;

use Bio::Affymetrix::CDF;

# Parse the CDF file

my $cdf=new Bio::Affymetrix::CDF();

$cdf->parse_from_file("foo.cdf");

# Make a new CHP object, using the CDF file

my $chp=new Bio::Affymetrix::CHP($cdf);

# Parse CHP file

$chp->parse_from_file("foo.chp");

# Find some fun facts about this chip

print $chp->algorithm_name()."\n";

print $chp->version()."\n";

# Print out all of the signal values for this chip

while (my ($probename,$results)=each %{$chp->probe_set_results()}) { print $probename.",".$results->{"Signal"}."\n"; }

DESCRIPTION

The Affymetrix microarray system produces files in a variety of formats. If this means nothing to you, these modules are probably not for you :). This module parses CHP files.

This module requires a Bio::Affymetrix::CDF object before it can do anything. This must be supplied to the constructor. See the perldoc for that to see how to use that module. The module can parse various types of CHP file transparently. You can find out what type you have by using the original_version() method.

All of the Bio::Affymetrix modules parse a file entirely into memory. You therefore need enough memory to hold these objects. For some applications, parsing as a stream may be more appropriate- hopefully the source to these modules will give enough clues to make this an easy task.

You can also use this software to write CHP files (see the write_to_file and write_to_filehandle methods).

HINTS

You fill the object filled with data using the parse_from_filehandle, parse_from_string or parse_from_file routines. You can get/set various statistics using methods on the object. Data is retrieved as a giant hash from probe_set_results. Subroutines marked "original_" give values as they are claimed in the original file, not as they are now (for instance if you modify the value)

NOTES

REFERENCE

Modules were written with the official Affymetrix documentation, which can be located at http://www.affymetrix.com/support/developer/AffxFileFormats.ZIP

COMPATIBILITY

This module can parse the CHP files produced by the Affymetrix software MAS 5 and GCOS v1.2. It can also process files produced by GCOS v1.0 in theory. However the authors of this module have never actually seen an actual GCOS v1.0 file, and so we rely on the specification supplied by Affymetrix only. If you have GCOS v1.0 files, feedback as to whether the code actually works is welcome.

Whatever file format you use the module should work transparently.

These modules are focused on GCOS v1.2 CHP files. The MAS5 CHP files actually contain a lot of extra information that is not displayed in MAS5 or GCOS. This information is thrown away by the parser.

This module can only do expression arrays.

Writing CHP files should work no matter what kind of CHP file was parsed originally. In other words, you can use these modules as a CHP file converter.

As stated above, some of the information that is in a MAS5 file is not present in an GCOS file. This module throws away all of this additional information. This means that if you try and write a MAS5 file, there will be large blank sections. This should not put off any programs that use them- this tactic was based on the Affymetrix conversion.

KNOWN BUG

Change P Value always comes out wrong when using comparison CHP files from MAS5. If you have a solution for this, please send email to the addresses below.

COPYRIGHT

Copyright (C) 2005 by Nick James, David J Craigon, NASC (arabidopsis.info), The University of Nottingham

This module is free software. You can copy or redistribute it under the same terms as Perl itself.

Affymetrix is a registered trademark of Affymetrix Inc., Santa Clara, California, USA.

AUTHORS

Nick James (nick at arabidopsis.info)

David J Craigon (david at arabidopsis.info)

Nottingham Arabidopsis Stock Centre (http://arabidopsis.info), University of Nottingham.

METHODS

new

  Arg [1]    : Bio::Affymetrix::CDF $db_file
  Example    : my $chp=new Bio::Affymetrix::CHP($cdf);
  Description: constructor for CHP object
  Returntype : new Bio::Affmetrix::CHP object
  Exceptions : none
  Caller     : general

CDF

  Arg [1]    : Bio::Affymetrix::CDF $db_file
  Example    : none
  Description: get/set for CDF file associated with this CHP file. The db is the one that 
               belongs to the external_name.  
  Returntype : Bio::Affymetrix::CDF object
  Exceptions : none
  Caller     : general

original_format

  Arg [0]    :  none
  Example    :  my $format=$chp->original_format()
  Description:  Returns the format of the CHP file parsed
                                (currently) either "XDA" (which is a GCOS v1.2 format,
                                also known as version 4) or "MAS5" (which is produced
                                either by MAS 5 or GCOS v1.0, also known as version 3)
  Returntype : string ("XDA" or "MAS5")
  Exceptions : none
  Caller     : general

original_version

  Arg [0]    :  none
  Example    :  my $version=$chp->original_version()
  Description:  Returns the version of the CHP file parsed
                Best used in conjunction with original_format,
                above. For XDA files, the version is always
                (currently) 1. For MAS5 files the version is either 12
                for a file produced by MAS5, or 13 for a GCOS v1.0
                file. Code is written for parsing version 13 files,
                but we\'ve no idea if it works.

  Returntype : string
  Exceptions : none
  Caller     : general

cols

  Arg [0]    :  none
  Example    :  my $x=$chp->cols()
  Description:  Numbers of columns in the array 
  Returntype :  integer
  Exceptions :  none
  Caller     :  general

rows

  Arg [0]    :  none
  Example    :  my $y=$chp->rows()
  Description:  Get/set numbers of rows in the array 
  Returntype :  integer
  Exceptions :  none
  Caller     :  general

original_number_of_probes

  Arg [0]    :  none
  Example    :  my $original_probes=$chp->original_number_of_probes()
  Description:  Gets the original number of probes reported in the
                                array.

                                The CHP files have the number of probes stored in
                                them, and this function lets you read this number as
                                it was stored in the file originally.

                                A better way of finding out the current number of
                                probes is to count the number in the probe_set_results
                                hash, like so: scalar(keys %{$chp->probe_set_results()});
                
  Returntype :  integer
  Exceptions :  none
  Caller     :  general

original_number_qc_units

  Arg [0]    :  none
  Example    :  my $original_qc=$chp->original_number_qc_units()
  Description:  Gets the original number of QC units in the file.
  Returntype :  integer
  Exceptions :  none
  Caller     :  general

original_com_progid

  Arg [0]    :  none
  Example    :  my $com_id=$chp->original_com_progid()
  Description:  Gets the progid of the original Microsoft COM object that made
                                this CHP file
  Returntype :  string
  Exceptions :  none
  Caller     :  general

CEL_file_name

  Arg [1]    :  string $cel_file_name (optional)
  Example    :  my $cel_file_name=$chp->CEL_file_name();
  Description:  Get/set the CEL file this CHP file was made from
  Returntype :  string
  Exceptions :  none
  Caller     :  general

original_file_name

  Arg [0]    :  none
  Example    :  my $chp_file_name=$chp->original_file_name();
  Description:  If this object was created using parse_from_file, the original filename. Otherwise undef.
  Returntype :  string
  Exceptions :  none
  Caller     :  general

probe_array_type

  Arg [1]    :  string $array_type (optional)
  Example    :  my $probe_array_type=$chp->probe_array_type();
  Description:  Get/set the Affymetrix chip type used in the
production of this CHP file. String is same format as CDF file name,
for example ATH1-121501
  Returntype :  string
  Exceptions :  none
  Caller     :  general

algorithm_name

  Arg [1]    :  string $algorithm_name (optional)
  Example    :  my $algorithm_name=$chp->algorithm_name();
  Description:  Get/set the algorithm name that turned the CEL file
into this CHP file
  Returntype :  string
  Exceptions :  none
  Caller     :  general

algorithm_version

  Arg [1]    :  string $algorithm_version (optional)
  Example    :  my $algorithm_version=$chp->algorithm_version();
  Description:  Get/set the algorithm version that turned the CEL file
into this CHP file
  Returntype :  string
  Exceptions :  none
  Caller     :  general

algorithm_params

  Arg [1]    :  hashref $algorithm_params (optional)
  Example    :  my %algorithm_params=%{$chp->algorithm_params()};

# Print scale factor

print $algorithm_params("SF");

  Description:  Get/set the algorithm parameters for turning the CEL
file into this CHP file. Returns a reference to a hash, keyed on
parameter name.

Parameters include: SF (scale factor) Alpha1 Alpha2 Tau NF (normalisation factor)

  Returntype :  hashref
  Exceptions :  none
  Caller     :  general

summary_statistics

  Arg [1]    :  hashref $summary_statistics (optional)
  Example    :  my %summary_statistics=%{$chp->summary_statistics()};

# Print RawQ

print $chp->summary_statistics()->{"RawQ"};

  Description:  Get/set the summary statistics for turning the CEL
file into this CHP file. Returns a reference to a hash, keyed on
parameter name.

Parameters include: RawQ Noise Background

  Returntype :  hashref
  Exceptions :  none
  Caller     :  general

smooth_factor

  Arg [1]    :  float $smooth_factor (optional)
  Example    :  my $smooth_factor=$chp->smooth_factor();
  Description:  Get/set the smooth factor. Your guess is as good as
mine as to what this actually is, although it is used in calculating
the background. Not available in MAS5 files.
  Returntype :  float
  Exceptions :  none
  Caller     :  general

background_zones

  Arg [1]    :  arrayref of arrayrefs $background_zones (optional)
  Example    :  my @background_zones=@{$chp->background_zones()};

# Print "X", "Y", "Background Value" for background zone 0 print $background_zones[0]->[0],$background_zones[0]->[1],$background_zones[0]->[2];

  Description:  Get/set an array of background zones. Again, your guess is as good as
mine as to what this actually is, although it is used in calculating
the background. Not available in MAS5 files.

Returns an arrayref to an arrayref. Each zone has an array three values long, which are X,Y and background value respectively. Returntype : arrayref of arrayrefs Exceptions : none Caller : general

probe_set_results

  Arg [1]    :  hashref of hashrefs $probe_set_results (optional)
  Example    :  my %results=%{$chp->probe_set_results()};
e
# Print "Signal", "Detection Call", "StatPairsUsed" for my favourite probe

print ($results{"246310_at"}->{"Signal"}."\n".$results{"246310_at"}->{"DetectionCall"}."\n".$results{"246310_at"}->{"StatPairsUsed"}."\n");

  Description:  Gain access to the actual data. Returns a reference to
hash, keyed on probe name. Each value contains another reference
to a hash with the following keys:

Signal DetectionCall (detection call- one of P M A N) DetectionPValue StatPairs StatPairsUsed Probeset (a Bio::CDF::ProbeSet object, q.v.)

and optionally: Change ChangePValue SignalLogRatio SignalLogRatioHigh SignalLogRatioLow CommonPairs

when it is a CHP files with a comparison in it.

  Returntype :  hashref of hashrefs
  Exceptions :  none
  Caller     :  general

parse_from_string

  Arg [1]    :  string
  Example    :  $chp->parse_from_string($chp_file_in_a_string);
  Description:  Parse a CHP file from a buffer in memory
  Returntype :  none
  Exceptions :  none
  Caller     :  general

parse_from_file

  Arg [1]    :  string
  Example    :  $chp->parse_from_file($chp_filename);
  Description:  Parse a CHP file from a file
  Returntype :  none
  Exceptions :  dies if can\'t open file
  Caller     :  general

parse_from_filehandle

  Arg [1]    :  reference to filehandle
  Example    :  $chp->parse_from_filehandle(\*STDIN);
  Description:  Parse a CHP file from a filehandle
  Returntype :  none
  Exceptions :  none
  Caller     :  general

write_to_file

  Arg [1]    :  string $filename
  Arg [2]    :  string $format
  Arg [3]    :  string $version
  Example    :  $cdf->write_to_file($cdf_filename);
  Description:  Writes a CDF file to a file. See write_to_filehandle for descriptions of format and version
  Returntype :  none
  Exceptions :  dies if cannot open file
  Caller     :  general

write_to_filehandle

  Arg [1]    :  filehandle $filehandle
  Arg [2]    :  string $format
  Arg [3]    :  string $version
  Example    :  $chp->write_to_filehandle(\*STDOUT);
  Description:  Writes a CDF file to a filehandle. Takes arguments of
  the filehandle, the desired format, and the desired version of that
  format.
  Currently, format defaults to MAS5, and version defaults to
  GC3.0.
  Returntype :  none
  Exceptions :  dies if cannot open file
  Caller     :  general