Marble maze: Mice with a mutation in SHANK2 (bottom) spend less time burying marbles (left column) than wildtype mice do.

Open-source algorithm automates common marble-burying assay

The machine-learning tool, which automatically counts how many marbles a mouse buries, appears to distinguish between hyperactivity and repetitive behaviors.

A new open-source algorithm stands to improve the reproducibility and depth of data collected from a marble-burying assay, which is commonly used to infer anxious or repetitive behaviors in autism mouse models. The tool automatically tracks a mouse’s movement, counts how many marbles it buries and records the time it spends doing so.

To conduct this assay, researchers typically place mice in a cage with multiple marbles and take a photograph. After a certain amount of time, they take another and compare the two images. Mice that bury more marbles than usual are said to have anxiety- or repetitive-like behaviors.

“The marble-burying assay, the way it’s currently analyzed, it does show reproducible results,” says study investigator Lucas Wahl, a graduate student in Aleksandra Badura’s lab at Erasmus University in Rotterdam, the Netherlands.

But labs vary in how they perform the assay, says Badura, associate professor of neuroscience and lead investigator of the study. “Behavioral studies are a little bit of a messy ground.”

The new tool, described in eNeuro in March and freely available online, uses machine learning to standardize the process.

“It requires you to have a camera and a good enough computer to run the code,” Badura says, “but it really doesn’t have to be something super fancy.”

This paper “really is important,” says Sam Golden, assistant professor of neuroscience at the University of Washington in Seattle, who was not involved in the study. “And it really is the future of a lot of behavioral neuroscience to remove subjectivity and improve reproducibility by using machine learning.”


ahl turned to an open-source machine-learning system, Janelia Automatic Animal Behavior Annotator (JAABA), to develop the marble-burying tracker. The system uses information from videos with manually annotated behaviors to automatically annotate the same behaviors in other videos. JAABA has tracked a slew of behaviors in mice, fruit flies and zebrafish.

For the new study, Wahl and his colleagues collected video clips of mice with mutations in UBE3A, SHANK2 or SAPAP3, genes linked to Angelman syndrome, autism and obsessive-compulsive disorder, respectively.

They manually annotated more than 13,000 video frames as ‘burying’ or ‘not burying,’ for example, to train their machine-learning algorithm, after which it could accurately identify burying behaviors in a different set of video frames 83 percent of the time, even across two different types of bedding — wood chips and corn cob.

As long as the data used to train the algorithm are accurate, Golden says, the output should be reliable. “The old adage of ‘garbage in, garbage out’ perfectly describes machine learning for behavioral neuroscience,” he says. Golden’s team developed SimBA, another machine-learning tool to analyze animal behaviors, in 2020.


he tool also revealed unique insights into the marble-burying assay. The SHANK2 animals, for instance, spent significantly less time burying marbles than wildtype mice did but were hyperactive; they ran twice as fast and traveled twice as far.

Mice with mutations in SHANK2 spent just as much time burying marbles as the wildtype mice did, but tended to bury the marbles in the middle of the cage after being injected with midazolam, a drug used to reduce anxiety-like behaviors. The result runs counter to previous findings that the drug decreases marble burying, suggesting a disconnect between the behavior and anxiety.

This sort of nuance — where an animal walks, where it buries marbles — is typically not tracked in traditional behavioral assays, Wahl says.

The automated tracker could prove useful for the pharmaceutical industry, which often uses marble-burying assays to test anxiety drugs in preclinical trials, Badura says. Counting only the number of buried marbles could skew those results.

“I hope to show [our tool] to the neuropharmacological community and say, ‘Look, this is not very difficult,’” she says. The pharmaceutical industry “should implement it and use it for research on anxiety, particularly when it comes to anxiety meds and anxiety disorders.”