subsetByLabeling (
ds,
labeling,
obj,
)
Creates and returns an arbitrary view based on a valid labeling of the
dataset. If the labeling passed is not directly tied to the dataset object,
the subset returned will be the subset of self which corresponds
to the datapoints labeling in the dataset to which the labeling is
attatched.
The application of this behavior can be expressed in the following
situation: Given a Dataset, perform two clusterings which result in two
labelings. Using these labelings, create two views, one per
clustering of a particular cluster. Then create a labeling for the
view which labels all the data. Now apply this labeling to the
second view to create a subset of common datapoints. The code to do
this may be like the following.
view1 = dataset.subset(labeling1, "cluster 2")
view2 = dataset.subset(labeling2, "cluster 6")
newlabeling1 = view1.createLabeling()
newlabeling1.addLabelToRows("foo", range(view1.getNumRows()))
commonGenes = view2.subset(newlabeling1, "foo")
At the conclusion of this code, the commonGenes view will hold the
data which is in view2 and also labeled "foo" in newlabeling1
|