Algorithm-TrunkClassifier

 view release on metacpan or  search on metacpan

lib/Algorithm/TrunkClassifier/CommandProcessor.pm  view on Meta::CPAN

			}
			my $valid = $commands{$com}{"validArgs"};
			if($arg !~ /$valid/){
				die "Error: Invalid argument '$arg' to $com\n";
			}
		}
		if($commands{$com}{"var"}){
			if($commands{$com}{"value"}){
				${$commands{$com}{"var"}} = $commands{$com}{"value"};
			}
			else{
				${$commands{$com}{"var"}} = $arg;
			}
		}
		if($commands{$com}{"sub"}){
			&{$commands{$com}{"sub"}}($arg, \@allCommands);
		}
	}
	if(!${$self->{"input"}}){
		die "Error: Input data file not supplied\n";
	}
}

#Description: Checks that the -t option is supplied if -c dual is used
#Parameters: (1) The -c argument, (2) command line arguments
#Return value: None
sub checkTestsetArg($ $){
	my ($argument, $comLineRef) = @_;
	if($argument eq "dual"){
		my $foundT = 0;
		foreach my $arg (@{$comLineRef}){
			if($arg eq "-t"){
				$foundT = 1;
				last;
			}
		}
		if(!$foundT){
			die "Error: Command line option -t must be given when -c dual is used\n";
		}
	}
}

#Description: Command line help
#Parameters: None
#Return value: None
sub commandHelp(){
	my $doc = <<END;
Usage
    perl trunk_classifier.pl [Options] [File]

Options
	-p, --procedure     Classification procedure to use [loocv|split|dual]
	-e, --split         Percentage of samples to use as test set when using -p split
	-t, --testset       Dataset to classify when using -c dual
    -c, --classvar      Name of the classification variable to use
    -o, --output        Name of the output folder
    -l, --levels        Force classifier to use trunks with X levels for classification
    -i, --inspect       Check data file before running [samples|probes|classes]
    -s, --supp          Supplementary file containing class information
    -v, --verbose       Report progress during classifier run
    -u, --useall        Circumvent level selection and use all trunks for classification
    -h, --help          Print command line help

Output
    performance:   Classification accuracy for each LOOCV fold, as well as average accuracy
    loo_trunks:    Structures of leave-one-out decision trunks
    cts_trunks:    Structure of trunks built with compete training set
    class_report:  Classification of all test samples
    log:           Arguments used
END
	die $doc;
}

return 1;



( run in 1.574 second using v1.01-cache-2.11-cpan-efa8479b9fe )