The file 'samples.chpfile' needs to be created first with a text editor and should contain the filenames of your .cychp files that you want to convert.
Parse text file to obtain log R ratios and allele peaks
use warnings FATAL => qw( all );
use strict;
use Getopt::Long;
my ($lrr_file, $baf_file, $sample_name);
GetOptions
(
"lrr-file=s" => \$lrr_file,
"baf-file=s" => \$baf_file,
"sample-name=s" => \$sample_name,
);
die "ERROR: --lrr-file not specified" if (!$lrr_file);
die "ERROR: --baf-file not specified" if (!$baf_file);
die "ERROR: --sample-name not specified" if (!$sample_name);
open(LRR, ">$lrr_file") or die "ERROR: Could not write to file $lrr_file\n";
open(BAF, ">$baf_file") or die "ERROR: Could not write to file $baf_file\n";
print LRR "\tchrs\tpos\tLRR_$sample_name\n";
print BAF "\tchrs\tpos\tBAF_$sample_name\n";
while(<>)
{
last if (/^ProbeSetName\tChromosome\tPosition\tLog2Ratio\tWeightedLog2Ratio\tSmoothSignal/);
}
while(<>)
{
last if (/^#/);
my ($ProbeSetName, $Chromosome, $Position, $Log2Ratio, $tWeightedLog2Ratio, $tSmoothSignal) = split(/\t/);
print LRR "$ProbeSetName\t$Chromosome\t$Position\t$Log2Ratio\n";
}
while(<>)
{
last if (/^ProbeSetName\tChromosome\tPosition\tAllelePeaks0\tAllelePeaks1/);
}
while(<>)
{
last if (/^#/);
my ($ProbeSetName, $Chromosome, $Position, $AllelePeaks0, $AllelePeaks1) = split(/\t/);
my $baf = ($AllelePeaks0 - 250)/(750-250);
$baf = 0 if ($baf < 0);
$baf = 1 if ($baf > 1);
print BAF "$ProbeSetName\t$Chromosome\t$Position\t$baf\n";
}
while(<>) {}; # read pipe to the end to avoid SIGPIPE error status 141
close(LRR);
close(BAF);
this is not really a data exchange format, rather it is a special binary format, it feels unlikely that other people develop software for it.