Find duplicates in Matrixtable

I know there is a method to remove duplicates from MatrixTable - distinct_by_row() - but how to get these duplicates into a separate .mt to inspect them? Lets say that an .mt is keyed by a field called locus:

mt = mt.key_rows_by('locus')

How to get an mt where locus is the same?

how about:

loci = mt.rows() # only deal with row fields
loci = loci.group_by(*loci.key).aggregate(n = hl.agg.count())
loci = loci.filter(loci.n > 1)
1 Like