OSCR

THERM-D uncovers distinct neural mechanisms separating morning and evening body temperature rhythms in Drosophila

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 211 lines · 6.7 KB · CC-BY-4.0

  1. """Entry point for running the fly detection package on a data set.
  2. """
  3. from argparse import ArgumentParser
  4. from pathlib import Path
  5. import cv2
  6. import matplotlib.pyplot as plt
  7. import numpy as np
  8. from . import cli
  9. from . import detect
  10. from . import io
  11. from . import match
  12. from . import ops
  13. from . import registration as reg
  14. from . import train
  15. from . import viz
  16. def register_arenas(config):
  17. """Register the fly arenas.
  18. """
  19. # TODO:
  20. # + Expose mask_hsv parameters
  21. config = config["register"]
  22. # Read the data set.
  23. data_dir = Path(config["data_path"])
  24. print(f"Data set directory: '{data_dir}'")
  25. if not data_dir.is_dir():
  26. raise IOError(f"'{data_dir}' is not a directory.")
  27. dset = io.FlyDatasetReader(data_dir)
  28. print(f" Found {len(dset)} images.\n")
  29. # Make sure the output directory exists.
  30. output_dir = config.get("output_path", data_dir / "arenas")
  31. cli.prompt_overwrite(output_dir, "Output directory", mkdir = True)
  32. debug_dir = None
  33. is_debug = config.get("debug", False)
  34. if is_debug:
  35. debug_dir = data_dir / "debug/arenas"
  36. cli.prompt_overwrite(debug_dir, "Debug directory", mkdir = True)
  37. print()
  38. image_set = dset.iter_read()
  39. if "arena" in config:
  40. # Arena coordinates are specified in config.
  41. arena_set = reg.get_arenas(image_set, config)
  42. else:
  43. # Detect arena coordinates.
  44. arena_set = reg.detect_arenas(image_set, config, debug_dir)
  45. # Rotate images and arenas by specified/detected rotation.
  46. arena_set = reg.rotate_images_with_arenas(arena_set)
  47. image_set, arenas = zip(*arena_set)
  48. # Compute median arena position. No need to convert to int since the
  49. # perspective transformation requires float inputs.
  50. print("Computing median arena boundary...\n")
  51. arenas = np.stack(arenas)
  52. arena = np.median(arenas, axis = 0).reshape(-1, 2)
  53. print(f"{arena=}")
  54. transform, width, height = ops.get_perspective_transform(arena)
  55. print(f"{width=}, {height=}\n")
  56. # Extract and save the arenas.
  57. print("Cropping, gamma-adjusting, and saving arenas...\n")
  58. for path, img in image_set:
  59. img = cv2.warpPerspective(
  60. img, transform, (width, height), flags = cv2.INTER_CUBIC)
  61. img = ops.adaptive_gamma_correction(img)
  62. # Save the cropped, gamma-adjusted image.
  63. output_path = output_dir / path.name
  64. img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
  65. cv2.imwrite(str(output_path), img)
  66. print(f"Wrote '{output_path}'.")
  67. def match_flies(config):
  68. """Apply template matching to fly images.
  69. """
  70. # TODO:
  71. # + Scale templates according to size of image
  72. # + Expose match.extract parameters
  73. apparatuses = config["apparatuses"]
  74. config = config["register"]
  75. # Read the data set.
  76. data_dir = Path(config["data_path"])
  77. print(f"Data set directory: '{data_dir}'")
  78. if not data_dir.is_dir():
  79. raise IOError(f"'{data_dir}' is not a directory.")
  80. dset = io.FlyDatasetReader(data_dir)
  81. print(f" Found {len(dset)} images.\n")
  82. # Make sure the output directory exists.
  83. output_dir = config.get("output_path", data_dir / "match_labels")
  84. cli.prompt_overwrite(output_dir, "Output directory", mkdir = True)
  85. is_debug = config.get("debug", False)
  86. if is_debug:
  87. debug_dir = data_dir / "debug/match_labels"
  88. cli.prompt_overwrite(debug_dir, "Debug directory", mkdir = True)
  89. print()
  90. # Load the templates.
  91. template_path = Path("outputs/fly_template.npz")
  92. #template_path = Path("outputs/test_rotations.npz")
  93. print(f"Template path: '{template_path}'")
  94. templates, template_shape = io.read_fly_template(template_path)
  95. print(f" Found {len(templates)} template images.\n")
  96. # Resize templates based on relative arena size.
  97. arena_w_cm = apparatuses[dset.apparatus]["horizontal"]
  98. # FIXME:
  99. arena_w_px = cv2.imread(str(dset[0])).shape[1]
  100. arena_scale = arena_w_px / arena_w_cm
  101. template_scale = 4280 / 28.6
  102. scale = arena_scale / template_scale
  103. width = int(round(templates[0].shape[1] * scale))
  104. height = int(round(templates[0].shape[0] * scale))
  105. dim = (width, height)
  106. c = 0
  107. for i in templates:
  108. templates[c] = cv2.resize(i, dim, interpolation = cv2.INTER_AREA)
  109. c += 1
  110. # Process each image.
  111. print("Processing images...\n")
  112. for path, img in dset.iter_read_arenas():
  113. print(f"Processing '{path}'.")
  114. # Run template matching.
  115. boxes, scores = match.concatenate(
  116. [match.extract(img, t, verbose = is_debug) for t in templates])
  117. boxes = match.suppress_nonmax(boxes, scores)
  118. print(f" Found {boxes.shape[0]} boxes.")
  119. if is_debug:
  120. # Output a diagnostic image.
  121. ax = viz.plot_image(img, figsize = (15, 15))
  122. for i in range(boxes.shape[0]):
  123. viz.plot_box(boxes[i, :], ax)
  124. debug_path = debug_dir / path.name
  125. plt.savefig(debug_path, bbox_inches = "tight")
  126. print(f" Wrote '{debug_path}'.")
  127. # Save to a YOLO file.
  128. output_path = output_dir / (str(path.stem) + ".txt")
  129. io.write_yolo(output_path, boxes, None, img.shape)
  130. print(f" Wrote '{output_path}'.\n")
  131. fly_label = f"{output_dir}/labels.txt"
  132. with open(fly_label, mode = "wt") as file:
  133. file.write("fly")
  134. def main():
  135. # Parse command line arguments.
  136. parser = ArgumentParser()
  137. parser.add_argument(
  138. "--debug", action = "store_true"
  139. , help = "output diagnostic information")
  140. subparsers = parser.add_subparsers(title = "subcommands")
  141. register_parser = subparsers.add_parser(
  142. "register", help = "(step 1) register arenas in data set")
  143. register_parser.set_defaults(func = register_arenas)
  144. detect_parser = subparsers.add_parser(
  145. "detect", help = "apply a fly detection model to a dataset")
  146. detect_parser.set_defaults(func = detect.main)
  147. match_parser = subparsers.add_parser(
  148. "match", help = "apply template matching to data set")
  149. match_parser.set_defaults(func = match_flies)
  150. assemble_parser = subparsers.add_parser(
  151. "assemble", help = "assemble a YOLO object detection training set "
  152. "from multiple annotated data sets")
  153. assemble_parser.set_defaults(func = train.assemble_training_set)
  154. # Add `config` argument to all subparsers.
  155. for name, subparser in subparsers.choices.items():
  156. subparser.add_argument(
  157. "config", type = Path, help ="path to config file")
  158. args = parser.parse_args()
  159. # Read the config file.
  160. print(f"Config path: '{args.config}'")
  161. config = io.read_config(args.config)
  162. args.func(config)
  163. if __name__ == "__main__":
  164. main()

__main__.py, under CC-BY-4.0 · at the source

Overview

Authors: Tadahiro Goda1, Olivia M Lopez1, Richard Ramolete1, Nils Reinhard2, Nick Ulle3, Ayumi Fukuda4, Yujiro Umezaki1, Kazim Rizvi1, Madison G Aikawa1,5, Roslyn Catiis1, Victoria Z Marquez1, Richard Ngo1, Nikita C Raj1, Cora Fisher1, Gregory T Bui1, Jalen Lee3, Charlotte Helfrich-Förster2, Taishi Yoshii4, Fumika N Hamada1
  1. Department of Neurobiology, Physiology and Behavior, University of California, Davis, Davis, CA 95616, USA
  2. Neurobiology and Genetics, Theodor-Boveri-Institute, Biocenter, Julius-Maximilians-University of Würzburg, Am Hubland, 97074 Würzburg, Germany
  3. DataLab: Data Science and Informatics, University of California, Davis, One Shields Avenue, Davis CA 95616, USA
  4. Graduate School of Environmental, Life, Natural Science and Technology, Okayama University, Okayama 700-8530, Japan
  5. University of California, Berkeley School of Public Health, Berkeley, CA 94720, USA
Journal: Science advances, volume 12, issue 47, article eaed8055
Dates: received 12 November 2025; accepted 15 October 2026; published online 20 November 2026; in print November 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI · PMCID PMC13787506
Status: code verified (how the code is found and verified)
Categories: drosophila (organism)
Methods: Statistics, Evoked potentials
Citations: not cited yet (Europe PMC); 69 references in the paper
Research resources: Rabbit anti-dCRY 1:1000 RRID:AB_2314242, RRID:AB_300798, Goat anti-PER 1:200 RRID:AB_654018, w1118 RRID:BDSC_5905

Abstract

Animal body temperature rises throughout the day and peaks in the evening, a pattern conserved across diurnal endotherms and ectotherms. However, the mechanisms driving the robust body temperature rhythms (BTRs) remain largely unclear. Here, we developed a machine learning–based platform, Temperature Homeostasis Evaluation of Rhythmicity in Model Drosophila (THERM-D), enabling continuous, high-throughput analyses of BTR. Using THERM-D, we identified robust BTR patterns reflecting flies’ morning and evening behaviors and revealed the function of CRYPTOCHROME (CRY)–negative clock neurons. About half of all clock neurons lack CRY, yet their functions are only partially understood. Gal4 drivers targeting CRY-negative neurons demonstrated that these neurons control the morning temperature rise. We further show that separate clock circuits regulate morning and evening BTRs. Thus, THERM-D elucidated the role of CRY-negative clock neurons in BTR and provides a powerful platform for uncovering mechanisms underlying circadian temperature homeostasis.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above.

Zenodo 21184934

License: CC-BY-4.0
State: the link answers, verified on 21 November 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data, code, and materials availability:”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: OpenCV (8 files), NumPy (7 files), pandas (4 files), Matplotlib (3 files), scikit-learn (1 file)
Availability: 1 check, the latest on 21 November 2026: the link answers (HTTP 200)
  • 21 November 2026: the link answers (HTTP 200)
12 files

ucdavisdatalab/therm-d_fly_detection

License: none: the authors keep all their rights
State: the link answers, verified on 21 November 2026
Evidence: files inventoried
Commit: 38149aa097a6a7e06acffa5c7a6f090f83cc4db5, 24 October 2023
Languages: Python (11)
Size: 38 files, 11 scripts
Software Heritage: archived
Found in: the Zenodo archive record
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: OpenCV (8 files), NumPy (7 files), pandas (4 files), Matplotlib (3 files), scikit-learn (1 file)
Availability: 1 check, the latest on 21 November 2026: the link answers
  • 21 November 2026: the link answers
12 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 22 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data, code, and materials availability

All data and code needed to evaluate and reproduce the results in the paper are present in the paper and/or the Supplementary Materials. This study did not generate new materials. Fly detection code and analyses for the paper is DOI: https://doi.org/10.5281/zenodo.21184934.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 21 November 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 19 authors, 65 references, 4 RRIDs.

Cite

This paper

Goda, T., Lopez, O. M., Ramolete, R., Reinhard, N., Ulle, N., Fukuda, A., Umezaki, Y., Rizvi, K., Aikawa, M. G., Catiis, R., Marquez, V. Z., Ngo, R., Raj, N. C., Fisher, C., Bui, G. T., Lee, J., Helfrich-Förster, C., Yoshii, T., & Hamada, F. N. (2026). THERM-D uncovers distinct neural mechanisms separating morning and evening body temperature rhythms in Drosophila. Science advances, 12(47), eaed8055.

BibTeX

@article{goda2026therm,
author = {Goda, Tadahiro and Lopez, Olivia M and Ramolete, Richard and Reinhard, Nils and Ulle, Nick and Fukuda, Ayumi and Umezaki, Yujiro and Rizvi, Kazim and Aikawa, Madison G and Catiis, Roslyn and Marquez, Victoria Z and Ngo, Richard and Raj, Nikita C and Fisher, Cora and Bui, Gregory T and Lee, Jalen and Helfrich-Förster, Charlotte and Yoshii, Taishi and Hamada, Fumika N},
title = {{THERM-D uncovers distinct neural mechanisms separating morning and evening body temperature rhythms in Drosophila}},
journal = {Science advances},
year = {2026},
month = nov,
volume = {12},
number = {47},
pages = {eaed8055},
publisher = {American Association for the Advancement of Science},
issn = {2375-2548},
pmcid = {PMC13787506}
}

RIS

TY - JOUR
AU - Goda, Tadahiro
AU - Lopez, Olivia M
AU - Ramolete, Richard
AU - Reinhard, Nils
AU - Ulle, Nick
AU - Fukuda, Ayumi
AU - Umezaki, Yujiro
AU - Rizvi, Kazim
AU - Aikawa, Madison G
AU - Catiis, Roslyn
AU - Marquez, Victoria Z
AU - Ngo, Richard
AU - Raj, Nikita C
AU - Fisher, Cora
AU - Bui, Gregory T
AU - Lee, Jalen
AU - Helfrich-Förster, Charlotte
AU - Yoshii, Taishi
AU - Hamada, Fumika N
TI - THERM-D uncovers distinct neural mechanisms separating morning and evening body temperature rhythms in Drosophila
T2 - Science advances
J2 - Sci Adv
PY - 2026
DA - 2026/11/20
VL - 12
IS - 47
SP - eaed8055
SN - 2375-2548
PB - American Association for the Advancement of Science
LA - en
ER -

CSL-JSON

{
"id": "pmcid:PMC13787506",
"type": "article-journal",
"title": "THERM-D uncovers distinct neural mechanisms separating morning and evening body temperature rhythms in Drosophila",
"container-title": "Science advances",
"author": [
{
"family": "Goda",
"given": "Tadahiro"
},
{
"family": "Lopez",
"given": "Olivia M"
},
{
"family": "Ramolete",
"given": "Richard"
},
{
"family": "Reinhard",
"given": "Nils"
},
{
"family": "Ulle",
"given": "Nick"
},
{
"family": "Fukuda",
"given": "Ayumi"
},
{
"family": "Umezaki",
"given": "Yujiro"
},
{
"family": "Rizvi",
"given": "Kazim"
},
{
"family": "Aikawa",
"given": "Madison G"
},
{
"family": "Catiis",
"given": "Roslyn"
},
{
"family": "Marquez",
"given": "Victoria Z"
},
{
"family": "Ngo",
"given": "Richard"
},
{
"family": "Raj",
"given": "Nikita C"
},
{
"family": "Fisher",
"given": "Cora"
},
{
"family": "Bui",
"given": "Gregory T"
},
{
"family": "Lee",
"given": "Jalen"
},
{
"family": "Helfrich-Förster",
"given": "Charlotte"
},
{
"family": "Yoshii",
"given": "Taishi"
},
{
"family": "Hamada",
"given": "Fumika N"
}
],
"container-title-short": "Sci Adv",
"volume": "12",
"issue": "47",
"page": "eaed8055",
"PMCID": "PMC13787506",
"ISSN": "2375-2548",
"publisher": "American Association for the Advancement of Science",
"language": "en",
"issued": {
"date-parts": [
[
2026,
11,
20
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1016/j.celrep.2022.110668
Dorsal clock networks drive temperature preference rhythms in Drosophila.
Journal: Cell reports
In common: drosophila, 28 references
[2] doi:10.7554/elife.79139 [code]
Connectomic analysis of the <i>Drosophila</i> lateral neuron clock cells reveals the synaptic basis of functional pacemaker classes.
Journal: eLife
In common: pandas, Matplotlib, NumPy, drosophila, 13 references
[3] doi:10.1073/pnas.2506164122 [code]
A functional clock in only two dorsal clock neurons is sufficient to restore the basal circadian activity pattern of <i>Drosophila melanogaster</i>.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: drosophila, 11 references
[4] doi:10.1371/journal.pbio.3002918
Temperature cues are integrated in a flexible circadian neuropeptidergic feedback circuit to remodel sleep-wake patterns in flies.
Journal: PLoS biology
In common: drosophila, 10 references
[5] doi:10.7554/elife.85410 [code]
Neural mechanisms of parasite-induced summiting behavior in 'zombie' <i>Drosophila</i>.
Journal: eLife
In common: drosophila, 9 references
[6] doi:10.1073/pnas.2206066119
Dopamine and GPCR-mediated modulation of DN1 clock neurons gates the circadian timing of sleep.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: drosophila, 9 references
[7] doi:10.1126/sciadv.adr4580
Transcriptomic DN3 clock neuron subtypes regulate <i>Drosophila</i> sleep.
Journal: Science advances
In common: drosophila, 9 references
[8] doi:10.7554/elife.103359
Circadian control of a sex-specific behavior in &lt;i&gt;Drosophila&lt;/i&gt;.
Journal: eLife
In common: drosophila, 9 references
[9] doi:10.1126/sciadv.adw4666
Synaptic targets of circadian clock neurons influence core clock parameters.
Journal: Science advances
In common: drosophila, 9 references
[10] doi:10.7554/elife.91927 [code]
Conditional chemoconnectomics (cCCTomics) as a strategy for efficient and conditional targeting of chemical transmission.
Journal: eLife
In common: drosophila, 8 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/repo/zenodo:21184934.svg)](https://openscicode.org/badge/repo/zenodo:21184934)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/repo/zenodo:21184934.svg
   :target: https://openscicode.org/badge/repo/zenodo:21184934
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/repo/zenodo:21184934"><img src="https://openscicode.org/badge/repo/zenodo:21184934.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.