Skip to content

Commit e481d49

Browse files
committed
set aligner to be optional so as to accommodate lane level inputs
1 parent 2cac3db commit e481d49

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

payload-gen-rna-alignment/main.nf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@ process payloadGenRnaAlignment {
8181

8282
script:
8383
// add and initialize variables here as needed
84+
arg_aligner = aligner ? "-l ${aligner}": ""
85+
8486
"""
8587
main.py \
8688
-f ${files_to_upload} \
8789
-a ${seq_experiment_analysis} \
88-
-l ${aligner} \
8990
-t ${analysis_type} \
9091
-g "${genome_annotation}" \
9192
-b "${genome_build}" \
9293
-w "${wf_name}" \
9394
-r ${workflow.runName} \
9495
-s ${workflow.sessionId} \
95-
-v ${wf_version}
96+
-v ${wf_version} ${arg_aligner}
9697
9798
"""
9899
}

payload-gen-rna-alignment/main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
'fastqc': ['Quality Control Metrics', 'Sequencing QC', ['Read Group Metrics'], ['FastQC'], ['FastQC']],
5252
'collectrnaseqmetrics': ['Quality Control Metrics', 'Aligned Reads QC', ['Alignment Metrics'], ['Picard:CollectRnaSeqMetrics'], ['Picard:CollectRnaSeqMetrics']],
5353
'duplicates_metrics': ['Quality Control Metrics', 'Aligned Reads QC', ['Duplicates Metrics'], ['biobambam2:bammarkduplicates2'], ['biobambam2:bammarkduplicates2']],
54-
'aln_metrics': ['Quality Control Metrics', 'Aligned Reads QC', ['Alignment Metrics'], ['STAR'], ['HiSAT2']],
5554
'supplement': ['Supplement', 'Running Logs', [None], ['STAR'], ['HiSAT2']]
5655
}
5756

@@ -136,7 +135,7 @@ def get_dupmetrics(file_to_upload):
136135
library.append(metric)
137136
return library
138137

139-
def get_files_info(file_to_upload, aligner, date_str, seq_experiment_analysis_dict):
138+
def get_files_info(file_to_upload, date_str, seq_experiment_analysis_dict, aligner=None):
140139
file_info = {
141140
'fileSize': calculate_size(file_to_upload),
142141
'fileMd5sum': calculate_md5(file_to_upload),
@@ -147,7 +146,7 @@ def get_files_info(file_to_upload, aligner, date_str, seq_experiment_analysis_di
147146
experimental_strategy = seq_experiment_analysis_dict['experiment']['experimental_strategy'].lower()
148147
fname_sample_part = seq_experiment_analysis_dict['samples'][0]['sampleId']
149148

150-
aligner_or_rgid = aligner.lower()
149+
aligner_or_rgid = aligner.lower() if aligner else None
151150
submitter_rg_id = None
152151
if re.match(r'^genome.merged.+?(cram|cram\.crai|bam|bam\.bai)$', file_to_upload):
153152
file_type = 'genome_aln'
@@ -162,8 +161,6 @@ def get_files_info(file_to_upload, aligner, date_str, seq_experiment_analysis_di
162161
file_type = 'collectrnaseqmetrics'
163162
elif re.match(r'.+?\.duplicates_metrics\.tgz$', file_to_upload):
164163
file_type = 'duplicates_metrics'
165-
elif re.match(r'.+?\.aln_metrics\.tgz$', file_to_upload):
166-
file_type = 'aln_metrics'
167164
elif re.match(r'.+?_SJ\.out\.tab$', file_to_upload):
168165
file_type = 'splice_junctions'
169166
elif re.match(r'.+?splicesites\.txt$', file_to_upload):
@@ -212,10 +209,13 @@ def get_files_info(file_to_upload, aligner, date_str, seq_experiment_analysis_di
212209
'data_subtypes': data_type_mapping[file_type][2]
213210
}
214211

215-
if aligner.lower() == 'star':
216-
file_info['info']['analysis_tools'] = data_type_mapping[file_type][3]
212+
if not aligner:
213+
file_info['info']['analysis_tools'] = "FastQC"
214+
elif aligner.lower() == 'star':
215+
file_info['info']['analysis_tools'] = data_type_mapping[file_type][3]
217216
elif aligner.lower() == 'hisat2':
218-
file_info['info']['analysis_tools'] = data_type_mapping[file_type][4]
217+
file_info['info']['analysis_tools'] = data_type_mapping[file_type][4]
218+
219219

220220
if new_fname.endswith('.bai') or new_fname.endswith('.crai'):
221221
file_info['dataType'] = 'Aligned Reads Index'
@@ -280,7 +280,7 @@ def main():
280280
parser.add_argument("-a", "--seq_experiment_analysis", dest="seq_experiment_analysis", required=True,
281281
help="Input analysis for sequencing experiment", type=str)
282282
parser.add_argument("-t", "--analysis_type", dest="analysis_type", required=True, help="Specify analysis_type")
283-
parser.add_argument("-l", "--aligner", dest="aligner", required=True, help="RNA-Seq aligner name")
283+
parser.add_argument("-l", "--aligner", dest="aligner", default=None, help="Provide RNA-Seq aligner if files_to_upload are generated from alignment results. Default=None")
284284
parser.add_argument("-g", "--genome_annotation", dest="genome_annotation", default="GENCODE v38", help="RNA-Seq alignment genome annotation")
285285
parser.add_argument("-b", "--genome_build", dest="genome_build", default="GRCh38_hla_decoy_ebv", help="RNA-Seq alignment genome build")
286286
parser.add_argument("-w", "--wf_name", dest="wf_name", required=True, help="Workflow name")
@@ -333,7 +333,7 @@ def main():
333333
# get file of the payload
334334
date_str = date.today().strftime("%Y%m%d")
335335
for f in args.files_to_upload:
336-
file_info = get_files_info(f, args.aligner, date_str, seq_experiment_analysis_dict)
336+
file_info = get_files_info(f, date_str, seq_experiment_analysis_dict, args.aligner)
337337
payload['files'].append(file_info)
338338

339339

0 commit comments

Comments
 (0)