Bio::Affymetrix::CHP- parse Affymetrix CHP files
use Bio::Affymetrix::CHP;
use Bio::Affymetrix::CDF;
# Parse the CDF file
my $cdf=new CDF();
$cdf->parse_from_file("foo.cdf");
# Make a new CHP object, using the CDF file
my $chp=new 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
foreach my $i (keys %{$chp->probe_set_results()}) { print $i.",".$CHP->probe_set_results()->{$i}->{"Signal"}."\n"; }
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 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 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)
Modules were written with the official Affymetrix documentation, which can be located at http://www.affymetrix.com/support/developer/AffxFileFormats.ZIP
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 as well as reading them.
Copyright (C) 2004 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.
Nick James (nick at arabidopsis.info)
David J Craigon (david at arabidopsis.info)
Nottingham Arabidopsis Stock Centre (http://arabidopsis.info), University of Nottingham.
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
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
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
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
Arg [0] : none Example : my $x=$chp->cols() Description: Numbers of columns in the array Returntype : integer Exceptions : none Caller : general
Arg [0] : none Example : my $y=$chp->rows() Description: Get/set numbers of rows in the array Returntype : integer Exceptions : none Caller : general
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
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
Arg [0] : none Example : my $com_id=$chp->original_com_progid() Description: Gets the progid of the orignal COM object that made this CHP file Returntype : string Exceptions : none Caller : general
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
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
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
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
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
Arg [1] : hashref $summary_statistics (optional) Example : my %summary_statistics=%{$chp->summary_statistics()};
# Print RawQ
print $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
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
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
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
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
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
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
To install Bio::Affymetrix::CDF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::Affymetrix::CDF
CPAN shell
perl -MCPAN -e shell install Bio::Affymetrix::CDF
For more information on module installation, please visit the detailed CPAN module installation guide.