Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
Roeland Hancock committed Apr 13, 2020
0 parents commit 676e77a
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
/*
!.gitignore
!*.md
!*.sh
!error*.log
!contrasts.tsv
!*.py

46 changes: 46 additions & 0 deletions README.md
@@ -0,0 +1,46 @@
# HW7: First level analysis

Due 4/19.


## Part 1: Finish in-class exercise

Complete the level 1 and level 2 analysis we started in class on 4/13. You do not need to submit anything, but you will need the level 2 outputs for all subjects for the 4/20 class meeting.

## Part 2: Level 1 analysis on your data

1. Fork and clone this repository to the cluster. You will also want to clone the [volume](https://github.uconn.edu/psyc5171/volume_scripts) or [surface](https://github.uconn.edu/psyc5171/surface_scripts) repository that contains the processing scripts we discussed in class.
2. Edit `contrasts.tsv` to specify your first level contrasts of interests. These contrasts will compare different conditions within a single run of the task. If your analysis plan includes comparisons between different tasks/sessions/subjects, those will be calculated at the group level.
3. Edit `sbatch_level1.sh` to specify a level1 processing job for a specified subject/session/task/run.
4. Use the `sbatch` command to submit one run of your `sbatch_level1.sh` script and make sure it works.
4. Edit `submit_level1.sh` to use a loop to submit a level1 job for each run you need to analyze. You will need to pay careful attention to the paths in the script. This script will be run at the command line on the cluster, so the paths need to be specified with respect to the filesystem on the cluster, as opposed to a filesystem in a container.
5. Run your `submit_level1.sh` script to queue all the level 1 analyses.
5. Edit `sbatch_level2.sh` to specify a second level processing job that averages across runs. You can use this even if your data does not have multiple runs.
6. Once your level 1 analyses have completed, use the `sbatch` command to submit one run of your `sbatch_level2.sh` script and make sure it works.
7. Edit `submit_level2.sh` to use a loop to submit a level2 job for each subject/session/task you need to analyze. You will need to pay careful attention to the paths in the script. This script will be run at the command line on the cluster, so the paths need to be specified with respect to the filesystem on the cluster, as opposed to a filesystem in a container.
8. Run your `submit_level2.sh` script to queue all the level 2 analyses.

### Submission

- Use git to add, commit, push
- [Create a pull request](https://github.uconn.edu/psyc5171/hw7)


## git workarounds

- To associate your clone with your GitHub username, run the command

```bash
git remote set-url origin \
https://${USER}@github.uconn.edu/${USER}/hw7.git
```
in your `hw7` directory. This will avoid the `The requested URL returned error: 403 Forbidden while accessing ` error when pushing.
- Use the command `unset SSH_ASKPASS` prior to pushing to avoid the error `(gnome-ssh-askpass:19484): Gtk-WARNING **: cannot open display:`
- When committing, you can specify a short commit message on the command line with the `-m` option: `git commit -m 'commit message'`. If you do not do this, the default editor will open so you can write your commit message. The default is usually `vi`.
- Press `i` to enter insertion mode and write your message
- Press `ctrl-c` or `esc` to exit insertion mode
- Type `:wq` to save and quit or `:q!` to quite without saving

- The command `git status` will show files that have changed since the last commit.
- The command `git log` will show the commit history

Empty file added contrasts.tsv
Empty file.
22 changes: 22 additions & 0 deletions sbatch_level1.sh
@@ -0,0 +1,22 @@
#!/bin/bash
#SBATCH --mail-type=ALL
#SBATCH --mail-user=First.Last@uconn.edu
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=2gb
#SBATCH --time=00:15:00
#SBATCH -e error_%A_%a.log
#SBATCH -o output_%A_%a.log
#SBATCH --job-name=level1
#SBATCH --partition=general

participant=$1
run=$2

module load singularity
singularity run --cleanenv \
--bind /your/directory:/data \
/scratch/psyc5171/containers/nipype.sif \


20 changes: 20 additions & 0 deletions sbatch_level2.sh
@@ -0,0 +1,20 @@
#!/bin/bash
#SBATCH --mail-type=ALL
#SBATCH --mail-user=First.Last@uconn.edu
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=2gb
#SBATCH --time=00:15:00
#SBATCH -e error_%A_%a.log
#SBATCH -o output_%A_%a.log
#SBATCH --job-name=level2
#SBATCH --partition=general

participant=$1

module load singularity
singularity run --cleanenv \
--bind /your/directory:/data \
/scratch/psyc5171/containers/nipype.sif \

9 changes: 9 additions & 0 deletions submit_level1.sh
@@ -0,0 +1,9 @@
#!/bin/bash
cat bids/participants.tsv | tail -n +2 \
| awk '{print $1}' | sed -e 's/sub-//' \
| while read sub; do
for run in `seq -f '%02g' 2`; do
sbatch sbatch_level1.sh $sub $run
done
done

7 changes: 7 additions & 0 deletions submit_level2.sh
@@ -0,0 +1,7 @@
#!/bin/bash

cat bids/participants.tsv | tail -n +2 \
| awk '{print $1}' | sed -e 's/sub-//' \
| while read sub; do
sbatch sbatch_level2.sh $sub
done

0 comments on commit 676e77a

Please sign in to comment.