https://drive.google.com/file/d/1MsQyG9i_7IV_GmpuONwPb1bTnmAs1BeG/view?usp=share_link - introduction recording presented via Google Meet’s (in Polish)

First connection and tmux session

Task 1: Using tmux (Terminal Multiplexer)

tmux allows you to create, manage, and navigate between multiple terminal sessions from a single window. Here are the steps to attach, detach, and exit a tmux session without naming the sessions.

Practical Steps

  1. Start a New tmux Session

    tmux
    
  2. Detach from the tmux Session

  3. Reattach to the tmux Session

    tmux attach
    or
    tmux a
    
  4. Exit the tmux Session

Task 2: Using cat & tail to display a CSV File

The tail command is used to display the end of a file. In the context of CSV files, it can be used to skip the header row.

Practical Steps

  1. Create a Sample CSV File

    echo -e "xnat_id,date,project,subject,session,\\nfc9d9ac6-e50c-4d,2024-04-11,MW24a,S2WIO304,,\\nfda17c32-2e88-45,2024-06-23,MW24a,S2WIO158,TP2,\\nfe8f99be-d955-4f,2024-06-23,MW24a,S2WIO870,TP2,\\nff7543be-c3a8-46,2024-06-17,MW24A,S2WIO68,TP2," > sample.csv
    
    cat sample.csv
    
  2. Display the CSV File Skipping the Header

    tail -n +2 sample.csv
    
    

Task 3: Using gnu parallel and tail to Display Specified Columns of a CSV File

gnu parallel is a shell tool for executing jobs in parallel. You can use it with tail to process and display specific columns from a CSV file.

Practical Steps

  1. Display Specified Columns

    tail -n +2 sample.csv | parallel --colsep ',' echo {1} {4}
    
    
  2. Fake fmriprep analysis

    echo 'echo fmriprep /project \\
             /project/derivatives \\
             participant \\
             --fs-license-file /home/user/freesurfer.txt \\
             --participant-label $2 \\
             --nprocs 6 --mem 10000' \\
    				 > run_fake.sh
    	
    chmod a+x ./run_fake.sh
    
  3. Feed the subjects’ list into fake fmriprep script

    tail -n +2 sample.csv | parallel --colsep ',' ./run_fake.sh {1} {4}
    

    This is how we run mriqc, fmriprep, hcp and many others pipelines. It takes just a few commands to glue it together and run efficiently in parallel on a HCP.