#!perl -w # This script converts the normalized data file generated by NimbleGen's # array-CGH platform to the .dcn file accepted by DCNDenoise. The input file # is [array id]_normalized.txt on NimbleGen's data CD/DVD. In fact, # the log2 ratios in this file are the same as those in the [array id]_unavg.txt. # # 5/11/2006 Yuhang Wang yuhangw@engr.smu.edu # V0.9 use strict; if($#ARGV != 1 && $#ARGV != 0) { print "Usage: nimblegen2dcn.pl input_txt_file [ouput_dcn_file]\n"; exit; } my $inputfile = $ARGV[0]; # Name for output .dcn file (extension is optional) my $outputfile; if($#ARGV == 1) { # If the user has entered a name for output .dcn file $outputfile = $ARGV[1]; } else { # If the user did not enter it # The output .dcn file will be the same as the .txt file name # except it has a .dcn extension $outputfile = substr($ARGV[0], 0, index($ARGV[0], ".")).".dcn"; } if($outputfile !~ /\./) { # If there is no extension in the output file name $outputfile .= ".dcn"; } open(INPUT, $inputfile) or die "File \'$inputfile\' cannot be found\n"; open(OUTPUT, ">$outputfile"); my @DATA; # array of arrays # Slurp in the whole file while () { chomp; push @DATA, [ split "\t" ]; } for (my $j = 1; $j < @DATA; $j++) { my @slice = @{$DATA[$j]}[6,7,13]; $slice[0] =~ s/chr0/chr/; my $line = join "\t", @slice; print OUTPUT $line; print OUTPUT "\n"; } close(INPUT); close(OUTPUT);