-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTCR.txt
136 lines (95 loc) · 3.19 KB
/
TCR.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
## TCR Seq Alignment using MIXCR
Softwared stored at:
`/home/ajn16/softwares/mixcr`
#### Compute node
`srun --pty -p interactive --mem 16G -t 0-06:00 /bin/bash`
#### submit as a job
`vim job_submit.sh`
```
#!/bin/sh
#SBATCH -p priority
#SBATCH -J TCR
#SBATCH -o run.o
#SBATCH -e run.e
#SBATCH -t 0-10:00
#SBATCH --mem=64G
#SBATCH --mail-type=END
#SBATCH --mail-user=ajitj_nirmal@dfci.harvard.edu
module load java/jdk-1.8u112
/home/ajn16/softwares/mixcr/mixcr analyze shotgun \
--species hs \
--starting-material rna \
--only-productive \
--assemble "-ObadQualityThreshold=10" \
/n/scratch3/users/a/ajn16/tcr/raw/DFTL-28776-V1_R1.fastq.gz \
/n/scratch3/users/a/ajn16/tcr/raw/DFTL-28776-V1_R2.fastq.gz \
analysis
```
## Running multiple samples at the same time
#### Generate a CSV files to pair up the right fastq files
Add a `description` column to give sample names
```
(echo 'samplename'; for f in raw/*; do readlink -f $f ; done) > sample_prep.csv
```
#### Create a template sbatch script
`vim sbatch_template.sh`
```
#!/bin/sh
#SBATCH -p short
#SBATCH -t 0-10:00
#SBATCH --mem=64G
module load java/jdk-1.8u112
/home/ajn16/softwares/mixcr/mixcr analyze shotgun \
--species hs \
--starting-material rna \
--only-productive \
${read_1} \
${read_2} \
${name}
```
#### Create a python script to serially submit all the jobs
`vim submitter.py'
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 1 19:53:17 2021
@author: aj
"""
# %% Lib
import sys
import os
import pandas as pd
import subprocess
# %% WD
#cwd = os.getcwd()
# %% Import parameters
csv_file = sys.argv[1] # prints python_script.py
# %% Data
# read the CSV file
#config = pd.read_csv(str(cwd) + '/' + str(csv_file))
config = pd.read_csv(csv_file)
try:
# convert the description column to catergory
config['description'] = config['description'].astype('category')
for i in config['description'].cat.categories:
read_1 = config[config['description'] == i]['samplename'].iloc[0]
read_2 = config[config['description'] == i]['samplename'].iloc[1]
name = i
# sumbit command
submit_command = ("sbatch " + "--job-name=" + str(name) +
" --export=name=" + str(name) + ',' +
"read_1=" + str(read_1) + ',' +
"read_2=" + str(read_2) + " sbatch_template.sh")
#print(submit_command)
# submit job
exit_status = subprocess.call(submit_command, shell=True)
if exit_status is 1: # Check to make sure the job submitted
print("Job" + str(name) + "failed to submit")
except Exception:
pass
```
#### Submit job
```
python submitter.py /n/scratch3/users/a/ajn16/pca/sample_prep.csv
```