在Realm position
中,我们可以知道哪个inserted/updated/removed
列表已更改,且该元素是否从列表中获得dfSmall:
ix,#CHROM,POS,sample,allele,pop,super_pop
0,1,1121557,rs112904239,HG00096,T,GBR,EUR
1,1,1213223,rs113095492,HG00096,T,GBR,EUR
2,1,1000894,rs114006445,HG00096,T,GBR,EUR
(5000 rows)
dfLarge:
#CHROM POS ID REF ALT QUAL FILTER
1 14719 rs527865771 C A 100 PASS ...
1 14728 rs547701710 C A 100 PASS ...
1 1213223 rs113095492 A G 100 PASS ...
...
(>1 million rows, >2000 columns)
#for just these three rows, my output would the row where 1, 1213223 match:
dfMerge:
#CHROM POS ID REF ALT QUAL FILTER
1 1213223 rs113095492 A G 100 PASS
?
答案 0 :(得分:1)
我们可以知道哪个位置列表发生了变化
是
private RealmResults<Obj> results;
private OrderedRealmCollectionChangeListener<RealmResults<Obj>> changeListener = new OrderedRealmCollectionChangeListener<RealmResults<Obj>>() {
@Override
public void onChange(RealmResults<Obj> results, OrderedCollectionChangeSet changeSet) {
String insertions = changeSet.getInsertions().length == 0 ? "" : "\n - Insertions: " + Arrays.toString(changeSet.getInsertions());
String deletions = changeSet.getDeletions().length == 0 ? "" : "\n - Deletions: " + Arrays.toString(changeSet.getDeletions());
String changes = changeSet.getChanges().length == 0 ? "" : "\n - Changes: " + Arrays.toString(changeSet.getChanges());
showStatus("Obj was loaded, or written to. " + insertions + deletions + changes);
}
};
public void ...() {
results = realm.where(Obj.class)...findAllAsync();
results.addChangeListener(changeListener);