close
Warning:
Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.
File ClusterUtils.tol, 1.1 KB (added by Jorge, 13 years ago) |
|
Line | |
---|
1 | NameBlock Rhclust = |
---|
2 | [[ |
---|
3 | Text _.cwd = GetAbsolutePath("."); |
---|
4 | Text _.ClusterUtils.r = _.cwd+"/"+ "ClusterUtils.r"; |
---|
5 | Text _.tmpdir = Replace(TmpDir, "\\", "/"); |
---|
6 | Text _.dist.bbm = _.tmpdir+"/"+"dist%S.bbm"; |
---|
7 | Text _.result.bbm = _.tmpdir+"/"+"result%S.bbm"; |
---|
8 | |
---|
9 | Matrix Run( Matrix dist, Text method, Real size ) |
---|
10 | { |
---|
11 | Real verbose = False; |
---|
12 | |
---|
13 | Set args.info = |
---|
14 | [[ |
---|
15 | [[ method, "method" ]], |
---|
16 | [[ size, "size", "int" ]], |
---|
17 | [[ _.result.bbm, "result.bbm"]] |
---|
18 | ]]; |
---|
19 | Set args.bbm = |
---|
20 | [[ |
---|
21 | [[ _.dist.bbm, dist ]] |
---|
22 | ]]; |
---|
23 | |
---|
24 | Text argList = Rapi::CreateArgList("Hclust_args", args.info); |
---|
25 | Set result.names = |
---|
26 | [[ |
---|
27 | _.result.bbm |
---|
28 | ]]; |
---|
29 | Text script = |
---|
30 | "source('"+_.ClusterUtils.r+"'); " |
---|
31 | "Hclust.TOL('"+_.dist.bbm+"','%A')"; |
---|
32 | //WriteLn( "argList = " << argList ); |
---|
33 | //WriteLn( "script = " << script ); |
---|
34 | Set rrs = Rapi::RunRScript( script, |
---|
35 | args.bbm, argList, result.names, verbose ); |
---|
36 | Matrix If(Card(rrs), |
---|
37 | { |
---|
38 | Matrix groups = rrs[1] |
---|
39 | }, |
---|
40 | { |
---|
41 | WriteLn("[Hclust::Run] Cannot run R script"); |
---|
42 | UnknownMatrix |
---|
43 | }) |
---|
44 | } |
---|
45 | ]]; |
---|
Download in other formats: