Skip to content

Commit

Permalink
add folder for benisty 2024 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandratrapani committed May 10, 2024
1 parent 2e91738 commit 884f2c5
Show file tree
Hide file tree
Showing 13 changed files with 671 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/higley_lab_to_nwb/benisty_2024/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .benisty_2024_nwbconverter import Benisty2024NWBConverter
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Primary script to run to convert an entire session for of data using the NWBConverter."""

from pathlib import Path
from typing import Union
import os
from .benisty_2024_convert_session import session_to_nwb



# Parameters for conversion
root_path = Path("/media/amtra/Samsung_T5/CN_data")
data_dir_path = root_path / "Higley-CN-data-share"
output_dir_path = root_path / "Higley-conversion_nwb/"

session_ids = os.listdir(data_dir_path)
stub_test = True
for session_id in session_ids:
session_folder = data_dir_path / Path(session_id)
if os.path.isdir(session_folder):
session_to_nwb(
folder_path=session_folder,
output_dir_path=output_dir_path,
session_id=session_id,
stub_test=stub_test,
)
70 changes: 70 additions & 0 deletions src/higley_lab_to_nwb/benisty_2024/benisty_2024_convert_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""Primary script to run to convert an entire session for of data using the NWBConverter."""

from pathlib import Path
from typing import Union
from neuroconv.utils import load_dict_from_file, dict_deep_update
from higley_lab_to_nwb.benisty_2024 import Benisty2024NWBConverter
import os
import glob


def session_to_nwb(
folder_path: Union[str, Path], output_dir_path: Union[str, Path], session_id: str, stub_test: bool = False
):

output_dir_path = Path(output_dir_path)
if stub_test:
output_dir_path = output_dir_path / "nwb_stub"
output_dir_path.mkdir(parents=True, exist_ok=True)

nwbfile_path = output_dir_path / f"{session_id}_new.nwb"

source_data = dict()
conversion_options = dict()

search_pattern = "_".join(session_id.split("_")[:2])

converter = Benisty2024NWBConverter(
source_data=source_data,
)

# Add datetime to conversion
metadata = converter.get_metadata()
date = read_session_start_time(folder_path=folder_path)
metadata["NWBFile"]["session_start_time"] = date
subject_id = session_id.split("_")[1]
metadata["Subject"].update(subject_id=subject_id)
metadata["NWBFile"].update(session_id=session_id)

# Update default metadata with the editable in the corresponding yaml file
editable_metadata_path = Path(__file__).parent / "benisty_2024_metadata.yaml"
editable_metadata = load_dict_from_file(editable_metadata_path)
metadata = dict_deep_update(metadata, editable_metadata)

# Add ophys metadata
ophys_metadata_path = Path(__file__).parent / "metadata" / "benisty_2024_ophys_metadata.yaml"
ophys_metadata = load_dict_from_file(ophys_metadata_path)
metadata = dict_deep_update(metadata, ophys_metadata)

# Run conversion
converter.run_conversion(
metadata=metadata, nwbfile_path=nwbfile_path, conversion_options=conversion_options, overwrite=True
)


if __name__ == "__main__":

# Parameters for conversion
root_path = Path("/media/amtra/Samsung_T5/CN_data")
data_dir_path = root_path / "Higley-CN-data-share"
output_dir_path = root_path / "Higley-conversion_nwb/"
stub_test = True
session_ids = os.listdir(data_dir_path)
session_id = "11222019_grabAM06_vis_stim"
folder_path = data_dir_path / Path(session_id)
session_to_nwb(
folder_path=folder_path,
output_dir_path=output_dir_path,
session_id=session_id,
stub_test=stub_test,
)
12 changes: 12 additions & 0 deletions src/higley_lab_to_nwb/benisty_2024/benisty_2024_metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
NWBFile:
session_description:
A rich text description of the experiment. Can also just be the abstract of the publication.
institution: Institution where the lab is located
lab: Higley
experimenter:
- Last, First Middle
- Last, First Middle
Subject:
species: Rattus norvegicus
age: P1W2D # in ISO 8601, such as "P1W2D"
sex: U # One of M, F, U, or O
12 changes: 12 additions & 0 deletions src/higley_lab_to_nwb/benisty_2024/benisty_2024_nwbconverter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Primary NWBConverter class for this dataset."""

from typing import Dict, List
from neuroconv import NWBConverter



class Benisty2024NWBConverter(NWBConverter):
"""Primary conversion class."""

data_interface_classes = dict(
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nwb-conversion-tools==0.11.1 # Example of specific pinned dependecy
some-extra-package==1.11.3 # Example of another extra package that's necessary for the current conversion
roiextractors
neuroconv @ git+https://github.com/catalystneuro/neuroconv.git@facemap
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ophys:
Device:
OnePhotonSeries:
ImagingPlane:
30 changes: 30 additions & 0 deletions src/higley_lab_to_nwb/benisty_2024/notes/benisty_2024_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Notes concerning the benisty_2024 conversion
* dual mesoscopic and 2-photon imaging data, .tiff files with ScanImage format (custom microscope) --> only mesoscopic shared ([Raw Imaging](#raw-imaging))
* output for rigid transformation, hemodynamic corrections, and filtering
* ROI segmentation (functional parcellation with Local Selective Spectral Clustering)

## Raw Imaging
### Method description from [Benisty 2024](https://www.nature.com/articles/s41593-023-01498-y):
**Mesoscopic imaging**
Widefield mesoscopic calcium imaging was performed using a Zeiss Axiozoom with a 1×, 0.25 NA objective with a 56 mm working distance (Zeiss). Epifluorescent excitation was provided by an LED bank (Spectra X Light Engine, Lumencor) using two output wavelengths: 395/25 (isosbestic for GRABACh3.0) and 575/25 nm (jRCaMP1b). Emitted light passed through a dual camera image splitter (TwinCam, Cairn Research) then through either a 525/50 (GRABACh3.0) or 630/75 (jRCaMP1b) emission filter (Chroma) before it reached two sCMOS cameras (Orca-Flash V3, Hamamatsu). Images were acquired at 512×512 resolution after 4× pixel binning, and each channel was acquired at 10 Hz with 20 ms exposure using HCImage software (Hamamatsu).

**Two-photon imaging**
Two-photon imaging was performed using a MOM microscope (Sutter Instruments) coupled to a 16×, 0.8 NA objective (Nikon). Excitation was driven by a Titanium-Sapphire Laser (Mai-Tai eHP DeepSee, Spectra-Physics) tuned to 920 nm. Emitted light was collected through a 525/50 filter and a gallium arsenide phosphide photomultiplier tube (Hamamatsu). Images were acquired at 512×512 resolution at 30 Hz using a galvo-resonant scan system controlled by ScanImage software (Vidrio).

**Dual mesoscopic and two-photon imaging**
Dual imaging was carried out using a custom microscope combining a Zeiss Axiozoom (as above) and a Sutter MOM (as above), as described previously 25. To image through the implanted prism, a long-working distance objective (20×, 0.4 NA, Mitutoyo) was used. Frame acquisitions were interleaved with an overall rate of 9.15 Hz, with each cycle alternating sequentially between a 920nm two-photon acquisition (512×512 resolution), a 395/25nm widefield excitation acquisition, and a 470/20nm widefield excitation acquisition. Widefield data were collected through a 525/50nm filter into a sCMOS camera (Orca Fusion, Hamamatsu) at 576×576 resolution after 45× pixel binning with 20ms exposure.


### Data structure:
- **Each .tif is a trial of N frame of [512,512]**

### Imaging metadata (from Benisty paper)
- Custom miscroscope: see description in the methods
- stimulation wavelengths for the three optical channel: Imaging was performed by strobing 575 nm (jRCaMP1b), 470 nm (ACh3.0) and 395 nm (control)
excitation light
- emission filters: 525/50 or 630/75 (Chroma)
- image dimension: 512×512
- indicators: Here, we use dual-color mesoscopic imaging of the red-fluorescent calcium indicator jRCaMP1b36 and the green-fluorescent ACh indicator ACh3.0 across the entire dorsal neocortex of the awake mouse to quantify the relationships between behavioral state, cortical activity and cholinergic signaling.

##Lab Code
* [Benisty 2024](https://github.com/cardin-higley-lab/Benisty_Higley_2023)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 884f2c5

Please sign in to comment.