public ArrayList<String> getClusterIDs(int clusterNum) { ArrayList<String> clusterSeqs = new ArrayList<String>(); for (int i = 0; i < seqList.size(); i++) { if (cluster[i] == clusterNum) clusterSeqs.add(seqList.get(i)); } return clusterSeqs; }
public int getClusterSize(int clusterNum) { int count = 0; for (int i = 0; i < seqList.size(); i++) { if (cluster[i] == clusterNum) count++; } return count; }
public void buildClusterer(ArrayList<String> seqDB, double[][] sm) { seqList = seqDB; this.setSimMatrix(sm); Attribute seqString = new Attribute("sequence", (FastVector) null); FastVector attrInfo = new FastVector(); attrInfo.addElement(seqString); Instances data = new Instances("data", attrInfo, 0); for (int i = 0; i < seqList.size(); i++) { Instance currentInst = new Instance(1); currentInst.setDataset(data); currentInst.setValue(0, seqList.get(i)); data.add(currentInst); } try { buildClusterer(data); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }