-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstar-reference.qsubsec
37 lines (30 loc) · 1.68 KB
/
star-reference.qsubsec
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
# This template generates a salmon index from a given reference set.
# Alastair Droop, 2018-11-21
# Get the necessary Python functions:
from os import makedirs
from os.path import expanduser, expandvars
section('STAR-INDEX-{REF_ID}', description='Generate a Salmon index ({INDEX_PREFIX}-{REF_ID}) from genome reference set {REF_ID}')
if('{USE_WHOLE_NODE}' == 'yes'):
limits(h_rt='{MAX_TIME}', nodes=1)
else:
limits(h_rt='{MAX_TIME}', h_vmem='{MAX_MEM}')
options('pe smp {MAX_THREADS}')
options('V', 'cwd', 'notify')
# Attempt to set up the reference folder:
try:
makedirs(expandvars(expanduser('{LOG_DIR}')))
message('created reference log directory "{LOG_DIR}"')
except FileExistsError: message('reference log directory "{LOG_DIR}" already exists')
except: raise Exception('Failed to create reference log directory {LOG_DIR}')
outputs('{LOG_DIR}')
# Check that the directories are all OK:
for p in ['{INDEX_DIR}', '{LOG_DIR}', '{TEMP_DIR}']:
require(p, 'PATH_READABLE')
require(p, 'PATH_WRITABLE')
# Check that all of the executables are OK:
require('{STAR_EXEC}', 'PATH_EXECUTABLE')
# Submit the salmon index command:
command('{STAR_EXEC} --runMode genomeGenerate --runThreadN {MAX_THREADS} --limitGenomeGenerateRAM {MAX_STAR_MEM} --outTmpDir {TEMP_DIR}/STAR --genomeDir {INDEX_DIR} --genomeFastaFiles {REFSET_FASTA} --sjdbGTFfile {REFSET_GTF} --sjdbOverhang {SJ_OVERHANG} --outFileNamePrefix {LOG_DIR}/', name='generate-index', log=True, test=True)
# Add a link to the original reference FASTA & GTF files:
command('ln -s {REFSET_FASTA} {INDEX_DIR}/{INDEX_PREFIX}-{REF_ID}.fasta', name='ln_fasta')
command('ln -s {REFSET_GTF} {INDEX_DIR}/{INDEX_PREFIX}-{REF_ID}.gtf', name='ln_gtf')