<commit_before>"""
run processing for rsfmri analysis
"""

from myconnectome.rsfmri import *
from myconnectome.utils.get_data import get_base_data,get_directory
from myconnectome.utils.run_shell_cmd import run_shell_cmd

import os

try:
    basedir=os.environ['MYCONNECTOME_DIR']
except:
    raise RuntimeError('you must first set the MYCONNECTOME_DIR environment variable')

logdir=os.path.join(basedir,'logs')
if not os.path.exists(logdir):
    os.mkdir(logdir)
logfile=os.path.join(logdir,'data_downloads.log')

filepath=os.path.dirname(os.path.abspath(__file__))

get_base_data(logfile=logfile)

if not os.path.exists(os.path.join(basedir,'rsfmri')):
    os.mkdir(os.path.join(basedir,'rsfmri'))

# make renumbered parcel file
if not os.path.exists(os.path.join(basedir,'parcellation/all_selected_L_new_parcel_renumbered.func.gii')):
    mk_renumbered_parcel_file.mk_renumbered_parcel_file()

# get parcel info
if not os.path.exists(os.path.join(basedir,'parcellation/parcel_data.txt')):
    get_parcel_info.get_parcel_info()

if not os.path.exists(os.path.join(basedir,'rsfmri/module_assignments.txt')):
    extract_module_assignments.extract_module_assignments()

if not os.path.exists(os.path.join(basedir,'rsfmri/bwmod_corr_labels.txt')):
    extract_module_summary.extract_module_summary()

if not os.path.exists(os.path.join(basedir,'rsfmri/module_within_corr.txt')):
    collapse_module_data.collapse_module_data()

if not os.path.exists(os.path.join(basedir,'rsfmri/corrdata.npy')):
    get_corrdata.get_corrdata()


if not os.path.exists(os.path.join(basedir,'rsfmri/geff_pos.txt')):
  if len(run_shell_cmd('which matlab'))>0:
    cmd='matlab -nodesktop -nosplash <%s/bct_analyses.m'%filepath
    print cmd
    print 'this may take a little while...'
    run_shell_cmd(cmd)
  else:
      print 'MATLAB not available, downloading BCT results from S3'
      get_directory('bct',basedir)
      <commit_msg>fixed missing slash<commit_after>"""
run processing for rsfmri analysis
"""

from myconnectome.rsfmri import *
from myconnectome.utils.get_data import get_base_data,get_directory
from myconnectome.utils.run_shell_cmd import run_shell_cmd

import os

try:
    basedir=os.environ['MYCONNECTOME_DIR']
except:
    raise RuntimeError('you must first set the MYCONNECTOME_DIR environment variable')

logdir=os.path.join(basedir,'logs')
if not os.path.exists(logdir):
    os.mkdir(logdir)
logfile=os.path.join(logdir,'data_downloads.log')

filepath=os.path.dirname(os.path.abspath(__file__))

get_base_data(logfile=logfile)

if not os.path.exists(os.path.join(basedir,'rsfmri')):
    os.mkdir(os.path.join(basedir,'rsfmri'))

# make renumbered parcel file
if not os.path.exists(os.path.join(basedir,'parcellation/all_selected_L_new_parcel_renumbered.func.gii')):
    mk_renumbered_parcel_file.mk_renumbered_parcel_file()

# get parcel info
if not os.path.exists(os.path.join(basedir,'parcellation/parcel_data.txt')):
    get_parcel_info.get_parcel_info()

if not os.path.exists(os.path.join(basedir,'rsfmri/module_assignments.txt')):
    extract_module_assignments.extract_module_assignments()

if not os.path.exists(os.path.join(basedir,'rsfmri/bwmod_corr_labels.txt')):
    extract_module_summary.extract_module_summary()

if not os.path.exists(os.path.join(basedir,'rsfmri/module_within_corr.txt')):
    collapse_module_data.collapse_module_data()

if not os.path.exists(os.path.join(basedir,'rsfmri/corrdata.npy')):
    get_corrdata.get_corrdata()


if not os.path.exists(os.path.join(basedir,'rsfmri/geff_pos.txt')):
  if len(run_shell_cmd('which matlab'))>0:
    cmd='matlab -nodesktop -nosplash <%s/bct_analyses.m'%filepath
    print cmd
    print 'this may take a little while...'
    run_shell_cmd(cmd)
  else:
      print 'MATLAB not available, downloading BCT results from S3'
      get_directory('bct/',basedir)
      
{'fraction_non_alphanumeric': 0.1252930450638187, 'fraction_numerical': 0.001041938004688721, 'mean_word_length': 5.7368421052631575, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5512115', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1399, 'n_words': 212}