From c973bfff243954e4c967cee0e809cbc8e4b379e2 Mon Sep 17 00:00:00 2001 From: pontus_pih Date: Fri, 1 Jul 2005 08:12:41 +0000 Subject: [PATCH] Multiple changes, see the README --- bin/scm | 5 +- bin/sumo | 201 ++++++++++++++++++++++++++++++++------------------ devel/pheno.scm | 3 + diagrams/model.dia | 115 +++++++++++++++++++++-------- diagrams/modelfit.dia | 38 +++++++++- diagrams/scm.dia | 6 +- diagrams/tool.dia | 2 +- 7 files changed, 257 insertions(+), 113 deletions(-) diff --git a/bin/scm b/bin/scm index a5f3f61..49bd2fb 100755 --- a/bin/scm +++ b/bin/scm @@ -242,8 +242,8 @@ my $eval_string = common_options::model_parameters(\%options); if( defined $config_file and $config_file -> extra_data_files ){ foreach my $extra_data_file ( keys %{$config_file -> extra_data_files} ){ - push( @{$options{'extra_data_file'}}, $extra_data_file ); - push( @{$options{'extra_data_header'}}, $config_file -> extra_data_files -> {$extra_data_file} ); + push( @{$options{'extra_data_files'}}, $extra_data_file ); + push( @{$options{'extra_data_headers'}}, $config_file -> extra_data_files -> {$extra_data_file} ); } } @@ -281,7 +281,6 @@ if( $direction eq 'forward' or $direction eq 'both' ){ new ( eval( $common_options::parameters ), models => $models_array, config_file => $config_file ); - open(CMD, ">", $scm -> directory . "/command.txt"); print CMD $cmd_line, "\n"; close(CMD); diff --git a/bin/sumo b/bin/sumo index e612ae7..0b37b1d 100755 --- a/bin/sumo +++ b/bin/sumo @@ -12,31 +12,31 @@ use debug; use strict; use Getopt::Long; -my ($opt_help, - $opt_long_help, - $opt_debug, - $opt_debug_package, - $opt_debug_subroutine, - $opt_compact_format ); - -my $opts = { "h|?" => \$opt_help, - "help" => \$opt_long_help, - "debug:0" => \$opt_debug, - "debug_package:s" => \$opt_debug_package, - "debug_subroutine:s" => \$opt_debug_subroutine, - "compact_format:1" => \$opt_compact_format }; - -my $res = GetOptions( %{$opts} ); +my %options; + +$options{'precision'} = 4; + +my $opts = { "h|?" => $options{'help'}, + "help" => $options{'long_help'}, + "debug:0" => $options{'debug'}, + "debug_package:s" => $options{'debug_package'}, + "debug_subroutine:s" => $options{'debug_subroutine'}, + "compact_format:1" => $options{'compact_format'}, + "csv" => $options{'csv'}, + "precision:4" => $options{'precision'}}; + + +my $res = GetOptions( \%options, %{$opts} ); exit unless $res; -if ( scalar( @ARGV ) < 1 and !($opt_help or $opt_long_help) ){ +if ( scalar( @ARGV ) < 1 and !($options{'help'} or $options{'long_help'}) ){ print "At least one list file must be specified. Use 'sumo.pl -h' for help.\n"; exit; } -if($opt_help or $opt_long_help) { +if($options{'help'} or $options{'long_help'}) { print <<'ENDHELP'; sumo.pl @@ -53,7 +53,7 @@ if($opt_help or $opt_long_help) { ENDHELP - if( $opt_long_help and !$opt_help ){ + if( $options{'long_help'} and !$options{'help'} ){ print <<'ENDHELP'; @@ -116,76 +116,131 @@ ENDHELP exit; } -debug -> level( $opt_debug ); -debug -> package( $opt_debug_package ); -debug -> subroutine( $opt_debug_subroutine ); +debug -> level( $options{'debug'} ); +debug -> package( $options{'debug_package'} ); +debug -> subroutine( $options{'debug_subroutine'} ); + +my $form = '%.' . $options{'precision'} . 'g'; my $outfile = $ARGV[0]; my $outobj = output -> new ('filename'=> $outfile); -my @thetas = defined $outobj -> thetas -> [0][0] ? @{$outobj -> thetas -> [0][0]} : (); -my @thnam = defined $outobj -> thetanames -> [0] ? @{$outobj -> thetanames -> [0]} : (); -my @sethet = defined $outobj -> sethetas -> [0][0] ? @{$outobj -> sethetas -> [0][0]} : (); - -#my @omegas = defined $outobj -> omegas -> [0][0] ? @{$outobj -> omegas -> [0][0]} : (); -my @omegas = defined $outobj -> comegas -> [0][0] ? @{$outobj -> comegas -> [0][0]} : (); -my @omnam = defined $outobj -> omeganames -> [0] ? @{$outobj -> omeganames -> [0]} : (); - -my @sigmas = defined $outobj -> csigmas -> [0][0] ? @{$outobj -> csigmas -> [0][0]} : (); -my @signam = defined $outobj -> sigmanames -> [0] ? @{$outobj -> sigmanames -> [0]} : (); +my @output_matrix; +my @output_matrix_sizes; -my $ofv = $outobj -> ofv -> [0][0]; -my $termess= $outobj -> minimization_message -> [0][0]; +#use Data::Dumper; +#print Dumper( $outobj ); print "$outfile\n\n"; -print join( "",@{$termess} ), "\n"; - -if ( defined $ofv ) { - print "Objective function value: ",$ofv,"\n\n"; -} else { - print "Objective function value: UNDEFINED\n\n"; -} - -my @seomeg; -my @sesigm; - -if(@sethet) { - - @sethet = @{$outobj -> cvsethetas -> [0][0]}; - @seomeg = @{$outobj -> cvseomegas -> [0][0]}; - @sesigm = @{$outobj -> cvsesigmas -> [0][0]}; - -} - -printf "%-4s %-29s %-29s %-18s\n"," ","THETA","OMEGA","SIGMA"; - -my $max_par = $#thetas; -$max_par = $#omegas if ( $#omegas > $max_par ); -$max_par = $#sigmas if ( $#sigmas > $max_par ); - -for ( my $i = 0; $i <= $max_par; $i++ ) { - if ( defined $thetas[$i] ) { - my $se_str = sprintf( "(%.3g)", $sethet[$i] ); - printf( "%-4s %-10.4g %-12s ", $thnam[$i], $thetas[$i], $se_str ); - } else { - printf( "%29s", " " ); - } - if ( defined $omegas[$i] ) { - my $se_str = sprintf( "(%.3g)", $seomeg[$i] ); - printf( "%-5s %-10.4g %-12s ", $omnam[$i], $omegas[$i], $se_str ); - } else { - printf( "%30s", " " ); +for( my $problems = 0; $problems <= $#{$outobj -> problems}; $problems++){ + my $row_counter = 0; + for( my $sub_problems = 0; $sub_problems <= $#{$outobj -> problems -> [$problems] -> subproblems}; $sub_problems++){ + + my @thetas = defined $outobj -> thetas -> [$problems][$sub_problems] ? @{$outobj -> thetas -> [$problems][$sub_problems]} : (); + my @thnam = defined $outobj -> thetanames -> [$problems] ? @{$outobj -> thetanames -> [$problems]} : (); + my @sethet = defined $outobj -> sethetas -> [$problems][$sub_problems] ? @{$outobj -> sethetas -> [$problems][$sub_problems]} : (); + + my @omegas = defined $outobj -> comegas -> [$problems][$sub_problems] ? @{$outobj -> comegas -> [$problems][$sub_problems]} : (); + my @omnam = defined $outobj -> omeganames -> [$problems] ? @{$outobj -> omeganames -> [$problems]} : (); + + my @sigmas = defined $outobj -> csigmas -> [$problems][$sub_problems] ? @{$outobj -> csigmas -> [$problems][$sub_problems]} : (); + my @signam = defined $outobj -> sigmanames -> [$problems] ? @{$outobj -> sigmanames -> [$problems]} : (); + + my $ofv = $outobj -> ofv -> [$problems][$sub_problems]; + my $termess= $outobj -> minimization_message -> [$problems][$sub_problems]; + + if( $termess ){ + print join( "",@{$termess} ), "\n"; + } + + if ( defined $ofv ) { + print "Objective function value: ",$ofv,"\n\n"; + } else { + print "Objective function value: UNDEFINED\n\n"; + } + + my @seomeg; + my @sesigm; + + if(@sethet) { + + @sethet = @{$outobj -> cvsethetas -> [$problems][$sub_problems]}; + @seomeg = @{$outobj -> cvseomegas -> [$problems][$sub_problems]}; + @sesigm = @{$outobj -> cvsesigmas -> [$problems][$sub_problems]}; + + } + + push( @{$output_matrix[$row_counter]}, "","THETA","","","OMEGA","","","SIGMA", "" ); + for( my $i = 0; $i <= $#{$output_matrix[$row_counter]}; $i++ ){ + if( $output_matrix_sizes[$i] < length( $output_matrix[$row_counter][$i] ) ){ + $output_matrix_sizes[$i] = length( $output_matrix[$row_counter][$i] ); + } + } + $row_counter++; + +#printf "%-4s %-29s %-29s %-18s\n"," ","THETA","OMEGA","SIGMA"; + + my $max_par = $#thetas; + $max_par = $#omegas if ( $#omegas > $max_par ); + $max_par = $#sigmas if ( $#sigmas > $max_par ); + + for ( my $i = 0; $i <= $max_par; $i++ ) { + my @row; + if ( defined $thetas[$i] ) { + push( @row, $thnam[$i], sprintf( $form, $thetas[$i] ), + $sethet[$i] ? sprintf( "($form)", $sethet[$i] ) : '' ); + } else { + push( @row, '','','' ); + } + if ( defined $omegas[$i] ) { + push( @row, $omnam[$i], sprintf( $form, $omegas[$i] ), + $seomeg[$i] ? sprintf( "($form)", $seomeg[$i] ) : '' ); + } else { + push( @row, '','',''); + } + if ( defined $sigmas[$i] ) { + push( @row, $signam[$i], sprintf( $form, $sigmas[$i] ), + $sesigm[$i] ? sprintf( "($form)", $sesigm[$i] ) : '' ); + } else { + push( @row, '','',''); + } + + push(@{$output_matrix[$row_counter]}, @row); + for( my $i = 0; $i <= $#{$output_matrix[$row_counter]}; $i++ ){ + if( $output_matrix_sizes[$i] < length( $output_matrix[$row_counter][$i] ) ){ + $output_matrix_sizes[$i] = length( $output_matrix[$row_counter][$i] ); + } + } + $row_counter++; + + } } - if ( defined $sigmas[$i] ) { - my $se_str = sprintf( "(%.3g)", $sesigm[$i] ); - printf( "%-5s %-10.4g %-12s ", $signam[$i], $sigmas[$i], $se_str ); +} + +#for( my $j = 0; $j <= $#output_matrix; $j++ ){ +# for( my $i = 0; $i <= $#{$output_matrix[$j]}; $i++ ){ +# if( $output_matrix_sizes[$i] < length( $output_matrix[$j][$i] ) ){ +# $output_matrix_sizes[$i] = length( $output_matrix[$j][$i] ); +# } +# } +#} + +foreach my $row ( @output_matrix ){ + for( my $i = 0; $i <= $#{$row}; $i++ ){ + my $spaces = $output_matrix_sizes[$i] - length($row -> [$i]); + if( $options{'csv'} ){ + print $row -> [$i], ","; + } else { + print " " x $spaces, $row -> [$i], " "; + } } print "\n"; } + # my $pl = 1; # my @plist; # while($pl) { diff --git a/devel/pheno.scm b/devel/pheno.scm index 6a3267b..347833c 100644 --- a/devel/pheno.scm +++ b/devel/pheno.scm @@ -10,6 +10,9 @@ nm_version=6 continuous_covariates=WGT categorical_covariates=APGR +[extra_data_files] +pheno_extra.dta=ID,WGT,APGR + [test_relations] CL=WGT,APGR V=WGT,APGR diff --git a/diagrams/model.dia b/diagrams/model.dia index 493aa91..f6f1d49 100644 --- a/diagrams/model.dia +++ b/diagrams/model.dia @@ -155,13 +155,13 @@ - + - + @@ -1648,13 +1648,13 @@ - + - + @@ -1969,14 +1969,14 @@ - + - - + + @@ -2025,7 +2025,7 @@ - + @@ -3415,13 +3415,13 @@ - + - + @@ -3675,19 +3675,19 @@ - + - + - + - + #model# @@ -4136,6 +4136,29 @@ + + + #reference_object# + + + ## + + + ## + + + ## + + + + + + + + + + + @@ -4222,6 +4245,36 @@ + #clean_extra_data_code# + + + ## + + + ## + + + + + + ## + + + + + + + + + + + + + + + + + #copy# @@ -9331,14 +9384,14 @@ - + - - + + @@ -9387,7 +9440,7 @@ - + @@ -9496,13 +9549,13 @@ - + - - - + + + @@ -9547,7 +9600,7 @@ - + @@ -12920,13 +12973,13 @@ - + - + @@ -13831,13 +13884,13 @@ - + - + @@ -14645,13 +14698,13 @@ - + - + @@ -14890,13 +14943,13 @@ - + - + diff --git a/diagrams/modelfit.dia b/diagrams/modelfit.dia index 64f6d75..6f47028 100644 --- a/diagrams/modelfit.dia +++ b/diagrams/modelfit.dia @@ -233,7 +233,7 @@ - + @@ -242,7 +242,7 @@ - + #modelfit# @@ -1549,6 +1549,40 @@ + #model# + + + #mandatory object model# + + + ## + + + ## + + + + + + + + #run# + + + #mandatory scalar integer# + + + ## + + + ## + + + + + + + #batchSize# diff --git a/diagrams/scm.dia b/diagrams/scm.dia index 2f433b2..49b76bf 100644 --- a/diagrams/scm.dia +++ b/diagrams/scm.dia @@ -4000,7 +4000,7 @@ - #rm_temp_files# + #remove_temp_files# #scalar boolean# @@ -4563,7 +4563,7 @@ - + @@ -4726,7 +4726,7 @@ - + diff --git a/diagrams/tool.dia b/diagrams/tool.dia index 2b4d3b7..5330231 100644 --- a/diagrams/tool.dia +++ b/diagrams/tool.dia @@ -896,7 +896,7 @@ - #rm_temp_files# + #remove_temp_files# #scalar boolean# -- 2.11.4.GIT