-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from catalystneuro/change_repo_structure
Separate conversion folder for benisty_2024 and lohani_2022
- Loading branch information
Showing
38 changed files
with
926 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
102 changes: 0 additions & 102 deletions
102
src/higley_lab_to_nwb/benisty_2022/benisty_2022_imaginginterface.py
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
src/higley_lab_to_nwb/benisty_2022/benisty_2022behaviorinterface.py
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
src/higley_lab_to_nwb/benisty_2022/benisty_2022nwbconverter.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .benisty_2024_nwbconverter import Benisty2024NWBConverter |
25 changes: 25 additions & 0 deletions
25
src/higley_lab_to_nwb/benisty_2024/benisty_2024_convert_all_sessions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
70
src/higley_lab_to_nwb/benisty_2024/benisty_2024_convert_session.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
src/higley_lab_to_nwb/benisty_2024/benisty_2024_nwbconverter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | ||
) |
4 changes: 4 additions & 0 deletions
4
src/higley_lab_to_nwb/benisty_2024/benisty_2024_requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
4 changes: 4 additions & 0 deletions
4
src/higley_lab_to_nwb/benisty_2024/metadata/benisty_2024_ophys_metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Ophys: | ||
Device: | ||
OnePhotonSeries: | ||
ImagingPlane: |
Oops, something went wrong.