コード例 #1
0
ファイル: development.py プロジェクト: vivian-vu/SAMRI
def dr_seed_fc():
	import numpy as np
	from os import path
	from labbookdb.report.tracking import treatment_group, append_external_identifiers
	from samri.plotting.overview import multiplot_matrix, multipage_plot
	from samri.utilities import bids_substitution_iterator
	from samri.analysis import fc

	db_path = '~/syncdata/meta.db'
	groups = treatment_group(db_path, ['cFluDW','cFluDW_'], 'cage')
	groups = append_external_identifiers(db_path, groups, ['Genotype_code'])
	all_subjects = groups['ETH/AIC'].unique()

	substitutions = bids_substitution_iterator(
		["ofM","ofMaF","ofMcF1","ofMcF2","ofMpF"],
		all_subjects,
		["CogB",],
		"~/ni_data/ofM.dr/",
		"composite",
		acquisitions=["EPI",],
		check_file_format='~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv.nii.gz')

	fc_results = fc.seed_based(substitutions, "~/ni_data/templates/roi/DSURQEc_dr.nii.gz", '/usr/share/mouse-brain-atlases/dsurqec_200micron_mask.nii',
		ts_file_template='~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv.nii.gz',
		save_results="~/ni_data/ofM.dr/fc/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv_zstat.nii.gz",
		)
コード例 #2
0
ファイル: development.py プロジェクト: TheChymera/chyMRI
def dr_seed_fc():
	import numpy as np
	from os import path
	from labbookdb.report.tracking import treatment_group, append_external_identifiers
	from samri.plotting.overview import multiplot_matrix, multipage_plot
	from samri.utilities import bids_substitution_iterator
	from samri.analysis import fc

	db_path = '~/syncdata/meta.db'
	groups = treatment_group(db_path, ['cFluDW','cFluDW_'], 'cage')
	groups = append_external_identifiers(db_path, groups, ['Genotype_code'])
	all_subjects = groups['ETH/AIC'].unique()

	substitutions = bids_substitution_iterator(
		["ofM","ofMaF","ofMcF1","ofMcF2","ofMpF"],
		all_subjects,
		["CogB",],
		"~/ni_data/ofM.dr/",
		"composite",
		acquisitions=["EPI",],
		check_file_format='~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv.nii.gz')

	fc_results = fc.seed_based(substitutions, "~/ni_data/templates/roi/DSURQEc_dr.nii.gz", "/usr/share/mouse-brain-atlases/dsurqec_200micron_mask.nii",
		ts_file_template='~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv.nii.gz',
		save_results="~/ni_data/ofM.dr/fc/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_acq-{acquisition}_task-{task}_cbv_zstat.nii.gz",
		)
コード例 #3
0
ファイル: test_report.py プロジェクト: cequn/LabbookDB
def test_groups():
    """Create a `pandas.DataFrame` containing treatment and genotype group assignments"""
    from labbookdb.report.tracking import treatment_group, append_external_identifiers

    known_sorted_ids = [
        '5667', '5668', '5673', '5674', '5675', '5689', '5690', '5691', '5692',
        '5693', '5694', '5694', '5699', '5700', '5704', '5705', '5706', '6254',
        '6256', '6262'
    ]

    df = treatment_group(DB_PATH, ['cFluDW', 'cFluDW_'], level='cage')
    df = append_external_identifiers(DB_PATH, df, ['Genotype_code'])
    sorted_ids = sorted(df['ETH/AIC'].tolist())

    assert sorted_ids == known_sorted_ids
コード例 #4
0
ファイル: development.py プロジェクト: vivian-vu/SAMRI
def seed_connectivity_overview(
    template='/usr/share/mouse-brain-atlases/dsurqec_40micron_masked.nii',
    cut_coords=[None, [0, -4.9, -3.3]],
    plot=False,
):
    import numpy as np
    from labbookdb.report.tracking import treatment_group, append_external_identifiers
    from samri.plotting.overview import multiplot_matrix, multipage_plot

    db_path = '~/syncdata/meta.db'
    groups = treatment_group(db_path, ['cFluDW', 'cFluDW_'], 'cage')
    groups = append_external_identifiers(db_path, groups, ['Genotype_code'])
    all_subjects = groups['ETH/AIC'].unique()
    treatment = groups[(groups['Genotype_code'] == "eptg")
                       & (groups['Cage_TreatmentProtocol_code'] == "cFluDW"
                          )]['ETH/AIC'].tolist()
    no_treatment = groups[(groups['Genotype_code'] == "eptg")
                          & (groups['Cage_TreatmentProtocol_code'] == "cFluDW_"
                             )]['ETH/AIC'].tolist()
    negative_controls = groups[groups['Genotype_code'] ==
                               "epwt"]['ETH/AIC'].tolist()
    print(treatment, no_treatment, negative_controls)
    substitutions = bids_substitution_iterator(
        ["ofM", "ofM_aF", "ofM_cF1", "ofM_cF2", "ofM_pF"],
        all_subjects,
        [
            "EPI_CBV_chr_longSOA",
        ],
        "~/ni_data/ofM.dr/",
        "composite",
    )
    fc_results = fc.seed_based(
        substitutions,
        "~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz",
        '/usr/share/mouse-brain-atlases/dsurqec_200micron_mask.nii',
        ts_file_template=
        "~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-{task}.nii.gz",
    )

    print([i['subject'] for i in fc_results])
    return
    if plot:
        multipage_plot(
            fc_results,
            treatment,
            figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
            template=template,
            threshold=0.1,
            base_cut_coords=cut_coords,
            save_as="fc_treatment.pdf",
            overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
            scale=0.4,
        )
        multipage_plot(
            fc_results,
            no_treatment,
            figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
            template=template,
            threshold=0.1,
            base_cut_coords=cut_coords,
            save_as="fc_no_treatment.pdf",
            overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
            scale=0.4,
        )
        multipage_plot(
            fc_results,
            negative_controls,
            figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
            template=template,
            threshold=0.1,
            base_cut_coords=cut_coords,
            save_as="fc_negative_control.pdf",
            overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
            scale=0.4,
        )
コード例 #5
0
ファイル: development.py プロジェクト: TheChymera/chyMRI
def seed_connectivity_overview(
	template="/usr/share/mouse-brain-atlases/dsurqec_40micron_masked.nii",
	cut_coords=[None,[0,-4.9,-3.3]],
	plot=False,
	):
	import numpy as np
	from labbookdb.report.tracking import treatment_group, append_external_identifiers
	from samri.plotting.overview import multiplot_matrix, multipage_plot

	db_path = '~/syncdata/meta.db'
	groups = treatment_group(db_path, ['cFluDW','cFluDW_'], 'cage')
	groups = append_external_identifiers(db_path, groups, ['Genotype_code'])
	all_subjects = groups['ETH/AIC'].unique()
	treatment = groups[
			(groups['Genotype_code']=="eptg")&
			(groups['Cage_TreatmentProtocol_code']=="cFluDW")
			]['ETH/AIC'].tolist()
	no_treatment = groups[
			(groups['Genotype_code']=="eptg")&
			(groups['Cage_TreatmentProtocol_code']=="cFluDW_")
			]['ETH/AIC'].tolist()
	negative_controls = groups[groups['Genotype_code']=="epwt"]['ETH/AIC'].tolist()
	print(treatment, no_treatment, negative_controls)
	substitutions = bids_substitution_iterator(
		["ofM","ofM_aF","ofM_cF1","ofM_cF2","ofM_pF"],
		all_subjects,
		["EPI_CBV_chr_longSOA",],
		"~/ni_data/ofM.dr/",
		"composite",
		)
	fc_results = fc.seed_based(substitutions, "~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz", "/usr/share/mouse-brain-atlases/dsurqec_200micron_mask.nii",
		ts_file_template="~/ni_data/ofM.dr/preprocessing/{preprocessing_dir}/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-{task}.nii.gz",
		)

	print([i['subject'] for i in fc_results])
	return
	if plot:
		multipage_plot(fc_results, treatment,
			figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
			template=template,
			threshold=0.1,
			base_cut_coords=cut_coords,
			save_as="fc_treatment.pdf",
			overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
			scale=0.4,
			)
		multipage_plot(fc_results, no_treatment,
			figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
			template=template,
			threshold=0.1,
			base_cut_coords=cut_coords,
			save_as="fc_no_treatment.pdf",
			overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
			scale=0.4,
			)
		multipage_plot(fc_results, negative_controls,
			figure_title="Chronic Fluoxetine (drinking water) Treatment Group",
			template=template,
			threshold=0.1,
			base_cut_coords=cut_coords,
			save_as="fc_negative_control.pdf",
			overlays=['~/ni_data/templates/roi/DSURQEc_dr_xs.nii.gz'],
			scale=0.4,
			)