Skip to content

Instantly share code, notes, and snippets.

@alexlicohen
alexlicohen / E2_CBIG_Legacy.sh
Created June 20, 2020 01:55
[E2 slurm CBIG Legacy command] Running the CBIG Legacy script on a BIDS directory with slurm #cohenlab #slurm #BIDS #E2 #CBIG
/lab-share/Neuro-Cohen-e2/Public/repos/e2scripts/sbatch_script_bids_target_sublist.sh \
/lab-share/Neuro-Cohen-e2/Public/repos/e2scripts/single_CBIG_Legacy.sh \
/lab-share/Neuro-Cohen-e2/Public/collections/GSP \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP/GSP1000.txt
@alexlicohen
alexlicohen / clone_to_fork.sh
Created June 19, 2020 11:31
[git clone to git fork] Converting from a clone of a public repo to your own fork to generate a PR without re-cloning #cohenlab #github #CBIG
# On github, fork the public repo: here, I went from https://github.com/ThomasYeoLab/CBIG to https://github.com/bchcohenlab/CBIG.git
git remote rename origin upstream
git remote add origin https://github.com/bchcohenlab/CBIG.git
git fetch origin
git branch --set-upstream-to origin/master master
git pull
@alexlicohen
alexlicohen / CBIG_E2_test.sh
Last active June 20, 2020 01:56
[E2 CBIG test command] Running the CBIG preproc pipeline on one BIDS subject on E2 #cohenlab #BIDS #E2 #CBIG #GSP
/lab-share/Neuro-Cohen-e2/Public/repos/BIDS_to_CBIG_fMRI_Preproc2016/BIDS_E2_CBIG_fMRI_preprocess.sh \
/lab-share/Neuro-Cohen-e2/Public/collections/GSP \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP/freesurfer_v4.5.0 \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP \
sub-0001 \
/lab-share/Neuro-Cohen-e2/Public/repos/BIDS_to_CBIG_fMRI_Preproc2016/configs/Legacy.config
@alexlicohen
alexlicohen / BIDS_parallel_usage.sh
Last active June 20, 2020 01:56
[Corrin CBIG with parallel] Usage for Alex's BIDS_parallel.sh #cohenlab #shell #BIDS #CBIG #parallel
#!/bin/bash
# Scripts are here: https://github.com/bchcohenlab/BIDS_to_CBIG_fMRI_Preproc2016
# Usage for Whole BIDS directory:
# BIDS_parallel.sh <number_of_threads> <script_to_run> <bids_dir> <all_the_arguments>
# BIDS_parallel_list.sh <number_of_threads> <script_to_run> <bids_dir> <list> <all_the_arguments>
#Examples:
/fileserver/caladan_ssd/repos/BIDS_to_CBIG_fMRI_Preproc2016/BIDS_parallel.sh 60 \
/fileserver/caladan_ssd/repos/BIDS_to_CBIG_fMRI_Preproc2016/BIDS_CBIG_fMRI_preprocess.sh \
@alexlicohen
alexlicohen / rsync_parallel.sh
Last active May 26, 2021 20:17
[parallel bids rsync example] Here's how I copied the ABCD1000 from e2 to corrin #cohenlab #bids #E2 #bash #rsync
#!/bin/bash
for i in `cat ABCD1000.txt`; do
echo rsync -ravhP --delete -e ssh \
/reference_databases/RestrictedAccessDatabase/Dropoff_Alex/abcdbids/s3/sub-${i}/ \
ch186161@corrin:/local_raid/collections/ABCD/sub-${i}/ >> commands.txt
done
parallel --eta --jobs 4 < commands.txt
@alexlicohen
alexlicohen / slurm_FSv4.5.sh
Last active June 20, 2020 01:55
[E2 slurm FSv4.5 singularity script with sublist] Command to run a singularity-based pipeline on E2 from a subject list (avoids vServers) #cohenlab #E2 #singularity #BIDS #slurm
#!/bin/bash
/lab-share/Neuro-Cohen-e2/Public/repos/e2scripts/sbatch_script_bids_target_sublist_exclude.sh \
/lab-share/Neuro-Cohen-e2/Public/repos/e2scripts/single_freesurfer_v4.5.sh \
/lab-share/Neuro-Cohen-e2/Public/collections/GSP \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP/freesurfer_v4.5.0 \
/lab-share/Neuro-Cohen-e2/Public/projects/GSP/GSP1000.txt
@alexlicohen
alexlicohen / BIDS_to_datalad.sh
Last active February 14, 2023 07:59
[Adding Datalad to BIDS dir] Shell commands to add Datalad subdatasets #cohenlab #shell #datalad #BIDS
#!/bin/bash
# in study dir:
# Create superdataset
datalad create -c text2git --force
for i in `ls -d sub-*`; do
if [ ! -d "${i}/.git" ]; then
# Create and register the subdataset
datalad create -c text2git --force -d . $i
@alexlicohen
alexlicohen / BIDS_manufacturer_grep.sh
Last active June 16, 2020 20:18
[BIDS Scanner Ident] Quick grep to find the scanner manufacturer for a large multi-site dataset #cohenlab #BIDS #shell #abcd
#!/bin/bash
for i in `ls -d sub-*/`; \
do echo $i `grep '"'Manufacturer'"' ${i}/ses-baselineYear1Arm1/func/sub*_ses-baselineYear1Arm1_task-rest_run-01_bold.json` >> scanner_list; done
@alexlicohen
alexlicohen / Singularityfile
Last active June 10, 2020 11:04
[Freesurfer v4.5.0 Singularity Recipe] Recipe for Building a Centos 6 container with FS v4.5 (req license.txt in same dir) #cohenlab #singularity #freesurfer
Bootstrap:docker
From:centos:6
%files
license.txt /opt/freesurfer/.license
%environment
FREESURFER_HOME=/opt/freesurfer
SUBJECTS_DIR=/output
@alexlicohen
alexlicohen / download.sh
Last active June 16, 2020 20:18
[D/L the ABCD to E2] Command used to download the ABCD-BIDS release from Damien's DCAN using their tool #cohenlab #shell #E2 #abcd
#!/bin/bash
#After logging into E2
srun -A bch -p bch-interactive -n 16 --mem=16GB --pty /bin/bash
python3 /lab-share/Neuro-Cohen-e2/Public/repos/nda-abcd-s3-downloader/download.py \
-i datastructure_manifest.txt \
-o /reference_databases/RestrictedAccessDatabase/Dropoff_Alex/abcdbids/s3 \
-d data_subsets_inputs_only.txt \
-p 16