def _run_interface(self, runtime): from pynets.core.utils import collect_pandas_df combination_complete = collect_pandas_df(self.inputs.network, self.inputs.ID, self.inputs.net_mets_csv_list, self.inputs.plot_switch, self.inputs.multi_nets, self.inputs.multimodal) setattr(self, '_combination_complete', combination_complete) return runtime
def test_collect_pandas_df(multi_nets, multimodal): base_dir = str(Path(__file__).parent / "examples") network = 'Default' ID = '002' func_path = base_dir + '/002/fmri' dmri_path = base_dir + '/002/dmri' plot_switch = False # Rename to proper format. shutil.copy( str(dmri_path + '/DesikanKlein2012/0021001_net_mets_Default_csd_0.1_parc'), str(dmri_path + '/DesikanKlein2012/0021001_Default_net_mets_csd_0.1_parc')) if multi_nets is not None and multimodal is False: net_mets_csv_list = [ str(func_path + '/whole_brain_cluster_labels_PCA200/002_Default_net_mets_sps_0.9' ), str(func_path + '/whole_brain_cluster_labels_PCA200/002_Default_net_mets_sps_0.9' ) ] elif multi_nets is not None and multimodal is True: net_mets_csv_list = [ str(func_path + '/whole_brain_cluster_labels_PCA200/002_Default_net_mets_sps_0.9' ), str(dmri_path + '/DesikanKlein2012/0021001_Default_net_mets_csd_0.1_parc') ] elif multi_nets is None and multimodal is False: net_mets_csv_list = [ str(func_path + '/coords_dosenbach_2010/netmetrics/002_net_mets_partcorr_0.2_4mm' ) ] elif multi_nets is None and multimodal is True: net_mets_csv_list = [ str(func_path + '/coords_dosenbach_2010/netmetrics/002_net_mets_partcorr_0.2_4mm' ), str(dmri_path + '/DesikanKlein2012/0021001_net_mets_csd_0.05_parc') ] else: return combination_complete = utils.collect_pandas_df(network, ID, net_mets_csv_list, plot_switch, multi_nets, multimodal) assert combination_complete is not None
def test_collect_pandas_df(plot_switch, embed): """ Test collect_pandas_df_make functionality """ import glob base_dir = str(Path(__file__).parent/"examples") multi_nets = None multimodal = False network = None ID = '002' net_mets_csv_list = [i for i in glob.glob(f"{base_dir}/topology/*.csv") if '_neat.csv' not in i] out = utils.collect_pandas_df(network, ID, net_mets_csv_list, plot_switch, multi_nets, multimodal, embed) assert out is True assert isinstance(net_mets_csv_list, list) assert len(net_mets_csv_list) == 9
def test_collect_pandas_df(plot_switch, embed): """ Test collect_pandas_df_make functionality """ import glob base_dir = os.path.abspath( pkg_resources.resource_filename("pynets", "../data/examples")) multi_nets = None multimodal = False subnet = None ID = '002' net_mets_csv_list = [ i for i in glob.glob(f"{base_dir}/topology/*.csv") if '_neat.csv' not in i ] out = utils.collect_pandas_df(subnet, ID, net_mets_csv_list, plot_switch, multi_nets, multimodal, embed) assert out is True assert isinstance(net_mets_csv_list, list) assert len(net_mets_csv_list) == 9
def test_collect_pandas_df(): base_dir = str(Path(__file__).parent / "examples") network = None ID = '002' plot_switch = False multi_nets = None multimodal = False if multi_nets is not None and multimodal is False: net_mets_csv_list = [ f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.3_net_mets.csv", f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.2_net_mets.csv" ] elif multi_nets is not None and multimodal is True: net_mets_csv_list = [ f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.3_net_mets.csv", f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.2_net_mets.csv" ] elif multi_nets is None and multimodal is False: net_mets_csv_list = [ f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.3_net_mets.csv", f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.2_net_mets.csv" ] elif multi_nets is None and multimodal is True: net_mets_csv_list = [ f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.3_net_mets.csv", f"{base_dir}/miscellaneous/0021001_modality-dwi_nodetype-parc_est-csa_thrtype-PROP_thr-0.2_net_mets.csv" ] else: return combination_complete = utils.collect_pandas_df(network, ID, net_mets_csv_list, plot_switch, multi_nets, multimodal) assert combination_complete is not None