#!/usr/bin/perl #$pathname = $ARGV[0]; #**** pathname is inserted here by make_data_dirstruct $pathname = "xxWORKING_DIRxx"; $datasetname = $ARGV[0]; $fluor_thresh = $ARGV[1]; $cycletable_fn = $pathname."IMAGES/RAW/cycle_id_table.txt"; $baseorderlist_fn = $pathname."EXEC/base_order.dat"; $logfile_fn = $pathname."PROC/DATASETS/create_dataset.log"; print STDERR "Opening logfile $logfile_fn\n"; open LOGFILE, >>$logfile_fn; #load cycle data into memory open CYCLETABLE, $cycletable_fn; $index = 0; while (){ $_ =~ /^([\d]+)\t(.+)\t.+$/g; #input is cycle_num\tcycle_pos\tcycle_type\n ; we ignore the type $cycle_num[$index] = $1; $cycle_num[$index]++; #we need to convert cycle_num from a string to a number, so we treat it as a number here $cycle_num[$index]--; $cycle_pos[$index] = $2; $index++; } $num_cycles = $index; print LOGFILE "create_dataset.pl executing w/ cycletable $cycletable_fn which has $num_cycles cycles...\n"; print STDERR "create_dataset.pl executing w/ cycletable $cycletable_fn which has $num_cycles cycles...\n"; close CYCLETABLE; #load base ordering info into memory open BASEORDERLIST, $baseorderlist_fn; $index = 0; while (){ chomp $_; $baseorder[$index] = $_; print STDERR "$_ "; print LOGFILE "$_ "; $index++; } $num_bases = $index; print LOGFILE "\n"; print STDERR "\n"; print LOGFILE "create_dataset.pl executing w/ baseorder list $baseorderlist_fn which has $num_bases bases...\n"; print STDERR "create_dataset.pl executing w/ baseorder list $baseorderlist_fn which has $num_bases bases...\n"; close BASEORDERLIST; #iterate over the number of bases specified in the ordering file, and #pick the correct cycle numbers from the cycletable $output_string = "./create_dataset $pathname $datasetname $fluor_thresh 0 "; for ($i=0; $i<$num_bases; $i++){ $num_cyc_curr_base = 0; $index = 0; while ($num_cyc_curr_base < 4){ if ($index == $num_cycles){ #we couldn't find enough entries for the current position; PROBLEM! print STDERR "ERROR: could not find enough entries for the current position.\n"; } if($cycle_pos[$index] eq $baseorder[$i]){ $num_cyc_curr_base++; $output_string = $output_string." ".$cycle_num[$index]; } $index++; } } print "ALL CYCLES PRESENT; EXECUTING:\n$output_string\n"; print LOGFILE "ALL CYCLES PRESENT; EXECUTING:\n$output_string\n"; close LOGFILE; `$output_string`;