Skip to content

Commit

Permalink
tenetobids example added
Browse files Browse the repository at this point in the history
  • Loading branch information
wiheto committed Feb 5, 2019
1 parent 794089a commit cb2134c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/tutorial/TenetoBIDS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ The compatiblity with the BIDS format allows for Teneto to run the analysis on a
tenetobids/derive
tenetobids/networkmeasure
tenetobids/io
tenetobids/example
tenetobids/bidsinfo

51 changes: 51 additions & 0 deletions docs/tutorial/tenetobids/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Example TenetoBIDS Script
-------------------------

Below is an exmaple script for an entire analysis

>>> import teneto
>>> # Number of concurrent processes to run
>>> njobs = 1
>>> #path to bids directory
>>> data_path = './'
>>> # Define teneto object. The first argument is the path to the BIDS directory. The "pipeline" argument is the directory in the derivartives folder where the preprocessed data is.
>>> tnet = teneto.TenetoBIDS(data_path,pipeline='fmriprep', bids_suffix='preproc', raw_data_exists=False)
>>> # --- PART 1 ---
>>> # Preprocessing
>>> tnet.confounds = None
>>> # Set confounds to remove
>>> confounds = ['X','Y','Z','RotX','RotY','RotZ', 'aCompCor00', 'aCompCor01', 'aCompCor02', 'aCompCor03', 'aCompCor04', 'aCompCor05']
>>> tnet.set_confounds(confounds)
>>> # This contains dictionary of information for additional preprocessing steps done by nilearn when making the parcellation.
>>> nilearn_params = {'standardize': True, 'low_pass': 0.1,'high_pass': 0.01,'t_r':2}
>>> tnet.make_parcellation('gordon2014_333',removeconfounds=True,parc_params=nilearn_params)
>>> # Scrubbing
>>> # Remove all files that have a mean FWD above 0.2. This confound name should be equal to the confoun in get_confound_alternatives() (from fmriprep is FramewiseDisplacement (I think))
>>> tnet.set_exclusion_file('FramewiseDisplacement','>0.5')
>>> # Remove all timepoints with FWD > 0.2 and simulate with cubic spline.
>>> # You can add a tol parameter. Which is a toloerance allowing x% to be above the threshold, other the subject is excluded. e.g. if tol=0.15, then if more than 15% of data is is greater than 0.2 - subject excluded.
>>> tnet.set_exclusion_timepoint('FramewiseDisplacement','>0.5','cubicspline')
>>> # See excluded subjects by (tnet.bad_files)
>>> # Make static funcitonal connectivity (may not be needed)
>>> tnet.make_functional_connectivity()
>>> # Save checkpoint
>>> tnet.save_aspickle(tnet.BIDS_dir + '/tnet_preprocess.pkl')
>>> # --- PART 2 ---
>>> # DERIVE TVC
>>> # Run whichever method you want to use. Make sure only the last you do has update_pipeline=True.
>>> tnet.derive_temporalnetwork({'method': 'jackknife', 'postpro': 'standardize'},confound_corr_report=False)
>>> # Save checkpoint
>>> tnet.save_aspickle(tnet.BIDS_dir + '/tnet_after_tvcderive')
>>> #This how you load (if needed). reload_object is set if I ever have to update the softare.
>>> #tnet = teneto.TenetoBIDS.load_frompickle('./tnet_after_tvcderive.pkl',reload_object=True)
>>> #community detection per slice
>>> # --- PART 3 ---
>>> # COMMUNITY DETECTION
>>> community_detection_params = {'resolution': 1, 'intersliceweight': 1}
>>> tnet.communitydetection(community_detection_params,'temporal')
>>> # --- PART 4 ---
>>> # NETWORK MEASURES
>>> #Calculate the two network measures
>>> network_measures = ['temporal_degree_centrality']
>>> network_measure_params = [{}]
>>> tnet.networkmeasures(network_measures,network_measure_params)

0 comments on commit cb2134c

Please sign in to comment.