[R] Accessing examplars in apcluster (apcluster package)

Ulrich Bodenhofer bodenhofer at bioinf.jku.at
Fri Apr 5 08:47:08 CEST 2013

Dear Sachin,

If you need the exemplars for further processing, you can access them 
via the 'exemplars' slot of the resulting APResult object. See the 
following example:

 > apres <- apcluster(negDistMat(r=2), x, details=TRUE)
 > apres

APResult object

Number of samples     =  150
Number of iterations  =  197
Input preference      =  -0.03259635
Sum of similarities   =  -0.2558946
Sum of preferences    =  -0.3585598
Net similarity        =  -0.6144545
Number of clusters    =  11

    x20 x32 x47 x85 x93 x101 x104 x110 x117 x124 x127
    Cluster 1, exemplar x20:
       x5 x10 x11 x17 x20 x22 x31 x34 x40 x41 x42 x44 x55 x62 x63 x78 
x84 x94
       x98 x99
    Cluster 2, exemplar x32:
       x7 x19 x25 x32 x33 x35 x38 x43 x57 x71 x100
    Cluster 3, exemplar x47:
       x4 x8 x15 x16 x27 x47 x49 x54 x59 x60 x66 x68 x69 x70 x79 x82 x90 x97
    Cluster 4, exemplar x85:
       x1 x3 x6 x14 x26 x29 x36 x45 x50 x52 x61 x65 x67 x77 x85 x89 x91 x92
    Cluster 5, exemplar x93:
       x2 x9 x12 x13 x18 x21 x23 x24 x28 x30 x37 x39 x46 x48 x51 x53 x56 
x58 x64
       x72 x73 x74 x75 x76 x80 x81 x83 x86 x87 x88 x93 x95 x96
    Cluster 6, exemplar x101:
       x101 x103 x108 x112 x114 x120 x128 x132 x145
    Cluster 7, exemplar x104:
       x104 x119 x122 x129 x133 x144 x146
    Cluster 8, exemplar x110:
       x105 x106 x110 x115 x116 x118 x121 x137 x149
    Cluster 9, exemplar x117:
       x102 x111 x117 x126 x138 x141
    Cluster 10, exemplar x124:
       x107 x109 x113 x123 x124 x125 x134 x135 x136 x140 x142 x147 x148 x150
    Cluster 11, exemplar x127:
       x127 x130 x131 x139 x143
 > apres at exemplars
  x20  x32  x47  x85  x93 x101 x104 x110 x117 x124 x127
   20   32   47   85   93  101  104  110  117  124  127

So the 'exemplars' slot consists of exemplar indices which, in the above 
example, are printed along with the sample names. I am considering to 
include an accessor functions in future versions to provide easier 
access without the need of accessing slots directly.

If you have further questions, please do not hesitate to ask.

Best regards,

On 04/05/2013 06:22 AM, Sachinthaka Abeywardana wrote:
> Hi,
> I was wondering how it was possible to access the actual cluster 
> exemplars from the APResult class. Currently it only spits it out onto 
> the terminal if you type the object but there is no other way to see 
> which one is the examplar.
> Would appreciate any help.
> Thanks,
> Sachin

More information about the R-help mailing list