Skip to content

Commit

Permalink
Rename CWAS to MDMR
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalsolon committed Jun 18, 2018
1 parent ef33b68 commit ccee49a
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 126 deletions.
2 changes: 1 addition & 1 deletion CPAC/GUI/interface/pages/__init__.py
Expand Up @@ -12,7 +12,7 @@
from .smoothing import AfterWarping, AfterWarpingOptions
from .timeseries import TimeSeries, ROITimeseries
from .group_analysis import GroupAnalysis, GPASettings, BASCSettings
from .cwas import CWASSettings
from .mdmr import MDMRSettings

__all__ = [ 'SkullStripProcessing', 'SkullStripOptions', 'AFNI_options', 'BET_options',\
'AnatomicalPreprocessing', 'Segmentation', \
Expand Down
91 changes: 0 additions & 91 deletions CPAC/GUI/interface/pages/group_analysis.py
Expand Up @@ -230,94 +230,3 @@ def __init__(self, parent, counter=0):

def get_counter(self):
return self.counter


class CWAS(wx.html.HtmlWindow):
def __init__(self, parent, counter = 0):
from urllib2 import urlopen
wx.html.HtmlWindow.__init__(self, parent, style= wx.html.HW_SCROLLBAR_AUTO)
self.SetStandardFonts()

self.counter = counter
self.LoadFile(p.resource_filename('CPAC', 'GUI/resources/html/cwas.html'))

def get_counter(self):
return self.counter


class CWASSettings(wx.ScrolledWindow):

def __init__(self, parent, counter = 0):
wx.ScrolledWindow.__init__(self, parent)

self.counter = counter

self.page = GenericClass(self, "Connectome-wide Association Studies (CWAS)")

self.page.add(label="Run CWAS ",
control=control.CHOICE_BOX,
name='runCWAS',
type=dtype.LSTR,
comment="Run CWAS",
values=["Off","On"],
wkf_switch = True)

self.page.add(label="CWAS ROI File ",
control=control.COMBO_BOX,
name='cwasROIFile',
type=dtype.STR,
values = "None",
comment="Path to a mask file. Voxels outside this mask will be excluded from CWAS.")

self.page.add(label="CWAS Regressor File ",
control=control.COMBO_BOX,
name='cwasRegressorFile',
type=dtype.STR,
values= "None",
comment = "Path to a text file containing phenotypic regressor.")

self.page.add(label= "CWAS FSamples ",
control=control.INT_CTRL,
name='cwasFSamples',
type=dtype.NUM,
comment="Number of permutation tests to run on the Psuedo-F statistic.",
values=5000)

self.page.add(label= "CWAS Parallel Nodes ",
control=control.INT_CTRL,
name='cwasParallelNodes',
type=dtype.NUM,
comment="Number of NiPype nodes to be created while computing CWAS.\n"\
"This number depends on computing resources.",
values=10)

self.page.add(label= "Column Number with Regressor of Interest ",
control=control.TEXT_BOX,
name='cwasRegressorCols',
type=dtype.LNUM,
values = "",
size = (300,-1),
validator = CharValidator("no-alpha"),
comment="Column Number with Regressor of Interest.\n\nRemember this is 0 indexed so the 1st column is 0.\n\n"\
"For instance, assuming the 1st column is the intercept, column number with regressor of interest = 1")

self.page.add(label= "CWAS Regressor Strata ",
control=control.TEXT_BOX,
name='cwasRegressorStrata',
type=dtype.STR,
values = "None",
size = (300,-1),
comment="A list with length equal to the total number of rows in your regressor file.\n"\
"Each element of the list, indicates that elements group. Leave it as None.\n"\
"if you have a between-subject design and give it a value if not.\n"\
"For instance, if you have multiple scans per subject, then you would want to\n"\
"do a permutation within-subject between scans. For this to occur, the list\n"\
"below could be something like ['s1', 's1', 's2', 's2', 's3', 's3', ...], \n"\
"indicating what subject each element/scan is associated with and permutations"\
"would only be done between scans within each subject.")

self.page.set_sizer()
parent.get_page_list().append(self)

def get_counter(self):
return self.counter
Expand Up @@ -5,51 +5,51 @@
import os
import pkg_resources as p

class CWASSettings(wx.ScrolledWindow):
class MDMRSettings(wx.ScrolledWindow):
def __init__(self, parent, counter = 0):
wx.ScrolledWindow.__init__(self, parent)

self.counter = counter

self.page = GenericClass(self, "Connectome-wide Association Studies")
self.page = GenericClass(self, "Multivariate Distance Matrix Regression (MDMR)")

self.page.add(label="Run CWAS?",
self.page.add(label="Run MDMR?",
control=control.CHOICE_BOX,
name="runCWAS",
name="runMDMR",
type=dtype.LSTR,
comment="Used to determine if Connectome-wide Association Studies "
comment="Used to determine if Multivariate Distance Matrix Regression (MDMR) "
"will be added to the pipeline or not.",
values=["Off", "On"],
wkf_switch = True)

self.page.add(label="Mask ROI File",
control=control.COMBO_BOX,
name='cwas_roi_file',
name='mdmr_roi_file',
type=dtype.STR,
values=str(""),
validation_req=False,
comment="Path to a mask file. Voxels outside of the mask will "
"be excluded from CWAS.")
"be excluded from MDMR.")

self.page.add(label="Regressor file",
control=control.COMBO_BOX,
name="cwas_regressor_file",
name="mdmr_regressor_file",
type=dtype.STR,
values="",
comment="Path to a CSV file containing the phenotypic "
"regressor.")

self.page.add(label="Regressor Participant Column Name",
control=control.TEXT_BOX,
name="cwas_regressor_participant_column",
name="mdmr_regressor_participant_column",
type=dtype.STR,
comment="Name of the participants column in your "
"regressor file.",
values="")

self.page.add(label="Regressor of Interest columns",
control=control.TEXT_BOX,
name="cwas_regressor_columns",
name="mdmr_regressor_columns",
type=dtype.STR,
values="",
comment="Columns from the CSV file indicating factor "
Expand All @@ -58,18 +58,18 @@ def __init__(self, parent, counter = 0):

self.page.add(label="Permutations",
control=control.INT_CTRL,
name="cwas_permutations",
name="mdmr_permutations",
type=dtype.NUM,
comment="Number of permutation tests to run on the "
"Pseudo-F statistics.",
values=500)

self.page.add(label="Parallel nodes",
control=control.INT_CTRL,
name="cwas_parallel_nodes",
name="mdmr_parallel_nodes",
type=dtype.NUM,
comment="Number of Nipype nodes created while "
"computing CWAS. Dependent upon computing resources.",
"computing MDMR. Dependent upon computing resources.",
values=1)

self.page.set_sizer()
Expand Down
6 changes: 3 additions & 3 deletions CPAC/GUI/interface/windows/config_window.py
Expand Up @@ -14,7 +14,7 @@
AfterWarping, AfterWarpingOptions,\
FilteringSettings,\
TimeSeries, EPI_DistCorr, ROITimeseries, \
GroupAnalysis, GPASettings, CWASSettings, TimeSeriesOptions, \
GroupAnalysis, GPASettings, MDMRSettings, TimeSeriesOptions, \
BASCSettings

ID_SUBMIT = 6
Expand Down Expand Up @@ -123,7 +123,7 @@ def __init__(self, parent):
page45 = GroupAnalysis(self)
page46 = GPASettings(self)
page47 = BASCSettings(self)
page48 = CWASSettings(self)
page48 = MDMRSettings(self)

# add the pages to the notebook with the label to show on the tab
self.AddPage(page1, "Environment Setup", wx.ID_ANY)
Expand Down Expand Up @@ -177,7 +177,7 @@ def __init__(self, parent):
self.AddSubPage(page46, "FSL FEAT Group Analysis", wx.ID_ANY)
self.AddSubPage(page47, "Bootstrapped Analysis of Stable Clusters ",
wx.ID_ANY)
self.AddSubPage(page48, "CWAS Settings", wx.ID_ANY)
self.AddSubPage(page48, "MDMR Settings", wx.ID_ANY)

self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGED, self.OnPageChanged)
self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGING, self.OnPageChanging)
Expand Down
@@ -1,4 +1,4 @@
Connectome-wide Association Studies (CWAS)
Multivariate Distance Matrix Regression (MDMR)
------------------------------------------

Introduction & Background
Expand Down
4 changes: 2 additions & 2 deletions CPAC/__main__.py
Expand Up @@ -116,9 +116,9 @@ def quickrun(pipeline_dir, roi_file, roi_file_two=None, ref_file=None,
basc_proc, basc_memory, scan=scan)


@group.command(name="cwas")
@group.command(name="mdmr")
@click.argument("pipeline_config", type=click.Path(exists=True))
def group_cwas(pipeline_config):
def group_mdmr(pipeline_config):
from CPAC.pipeline.cpac_group_runner import run_cwas

run_cwas(pipeline_config)
Expand Down
6 changes: 3 additions & 3 deletions CPAC/cwas/__init__.py
@@ -1,6 +1,6 @@
from pipeline import joint_mask, \
nifti_cwas, \
create_cwas
from .pipeline import joint_mask, \
nifti_cwas, \
create_cwas

__all__ = ['create_cwas',
'joint_mask',
Expand Down
20 changes: 10 additions & 10 deletions CPAC/pipeline/cpac_group_runner.py
Expand Up @@ -893,12 +893,12 @@ def run_cwas_group(output_dir, working_dir, roi_file,
from CPAC.cwas.pipeline import create_cwas

output_dir = os.path.abspath(output_dir)
working_dir = os.path.join(working_dir, 'group_analysis', 'CWAS',
working_dir = os.path.join(working_dir, 'group_analysis', 'MDMR',
os.path.basename(output_dir))

inclusion_list = None
if inclusion:
inclusion_list = load_text_file(inclusion, "CWAS participant "
inclusion_list = load_text_file(inclusion, "MDMR participant "
"inclusion list")

output_df_dct = gather_outputs(output_dir,
Expand Down Expand Up @@ -931,7 +931,7 @@ def run_cwas_group(output_dir, working_dir, roi_file,
)
}

cwas_wf = create_cwas(name="CWAS_{0}".format(df_scan))
cwas_wf = create_cwas(name="MDMR_{0}".format(df_scan))
cwas_wf.inputs.inputspec.subjects = func_paths
cwas_wf.inputs.inputspec.roi = roi_file
cwas_wf.inputs.inputspec.regressor = regressor_file
Expand All @@ -955,13 +955,13 @@ def run_cwas(pipeline_config):
output_dir = pipeconfig_dct["outputDirectory"]
working_dir = pipeconfig_dct["workingDirectory"]

roi_file = pipeconfig_dct["cwas_roi_file"]
regressor_file = pipeconfig_dct["cwas_regressor_file"]
participant_column = pipeconfig_dct["cwas_regressor_participant_column"]
columns = pipeconfig_dct["cwas_regressor_columns"]
permutations = pipeconfig_dct["cwas_permutations"]
parallel_nodes = pipeconfig_dct["cwas_parallel_nodes"]
inclusion = pipeconfig_dct["cwas_inclusion"]
roi_file = pipeconfig_dct["mdmr_roi_file"]
regressor_file = pipeconfig_dct["mdmr_regressor_file"]
participant_column = pipeconfig_dct["mdmr_regressor_participant_column"]
columns = pipeconfig_dct["mdmr_regressor_columns"]
permutations = pipeconfig_dct["mdmr_permutations"]
parallel_nodes = pipeconfig_dct["mdmr_parallel_nodes"]
inclusion = pipeconfig_dct["mdmr_inclusion"]

if not inclusion or "None" in inclusion or "none" in inclusion:
inclusion = None
Expand Down
2 changes: 1 addition & 1 deletion doc/workflows/index.rst
Expand Up @@ -24,7 +24,7 @@ Contents:
scrubbing
group_analysis
easy_thresh
cwas
mdmr
median_angle
registration
timeseries
Expand Down
2 changes: 1 addition & 1 deletion doc/workflows/cwas.rst → doc/workflows/mdmr.rst
@@ -1,4 +1,4 @@
Connectome Wide Association Studies
Multivariate Distance Matrix Regression
===================================

.. automodule:: CPAC.cwas
Expand Down

0 comments on commit ccee49a

Please sign in to comment.