diff --git a/app/raw_analysis/CELLRANGER_MULTI_template_v1.txt b/app/raw_analysis/CELLRANGER_MULTI_template_v1.txt new file mode 100644 index 0000000..dba4c2b --- /dev/null +++ b/app/raw_analysis/CELLRANGER_MULTI_template_v1.txt @@ -0,0 +1,46 @@ +sample_metadata: +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + feature_types: Gene Expression/Antibody Capture/CRISPR Guide Capture/Multiplexing Capture/VDJ-B/VDJ-T/VDJ-T-GD/Antigen Capture + cellranger_group: GROUP_NAME +analysis_metadata: + cellranger_multi_config: + - "[gene-expression]" + - "reference,/project/tgu/resources/pipeline_resource/transcriptome/cellranger/v7/GRCh38/refdata-gex-GRCh38-2020-A" + - "# probe-set,/path/to/probe/set, # Required, Fixed RNA Profiling only." + - "# filter-probes,, # Optional, Fixed RNA Profiling only." + - "# r1-length," + - "# r2-length," + - "# chemistry," + - "# expect-cells," + - "# force-cells," + - "# no-secondary," + - "# no-bam," + - "# check-library-compatibility," + - "# include-introns," + - "# min-assignment-confidence,<0.9>, # Optional, Cell Multiplexing only." + - "# cmo-set,/path/to/CMO/reference, # Optional, Cell Multiplexing only." + - "# barcode-sample-assignment,/path/to/barcode-sample-assignment/csv, # Optional, Cell Multiplexing only." + - "[feature] # For Feature Barcode libraries only" + - "# reference,/path/to/feature/reference" + - "# r1-length," + - "# r2-length," + - "# [vdj] # For TCR and BCR libraries only" + - "reference,/project/tgu/resources/pipeline_resource/vdj/v7/hg38/refdata-cellranger-vdj-GRCh38-alts-ensembl-7.1.0" + - "# inner-enrichment-primers,/path/to/primers" + - "# r1-length," + - "# r2-length," + - "[antigen-specificity] # for 5' BCR/TCR Antigen Capture only" + - "#control_id,mhc_allele" + - "#[samples] # for Cell Multiplexing libraries only" + - "#sample_id,cmo_ids,description" + - "#[samples] # for Fixed RNA Profiling multiplexed libraries only" + - "#sample_id,probe_barcode_ids,description" + scanpy: + MITO_PREFIX: MT- + RUN_SCRUBLET: true + RUN_CELLCYCLE_SCORE: true + CELL_MARKER_LIST: /project/tgu/resources/pipeline_resource/cell_markers/PangaloDB/PanglaoDB_markers_27_Mar_2020.tsv + CELL_MARKER_SPECIES: HG38 + S_GENES: '' + G2M_GENES: '' + CELL_MARKER_MODE: NON-VDJ \ No newline at end of file diff --git a/app/raw_analysis/GEOMX_DCC.txt b/app/raw_analysis/GEOMX_DCC.txt index 46810a9..a3c4167 100644 --- a/app/raw_analysis/GEOMX_DCC.txt +++ b/app/raw_analysis/GEOMX_DCC.txt @@ -1,9 +1,9 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - dsp_id: +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + dsp_id: {% endfor -%} analysis_metadata: - config_zip_file: /rds/general/project/genomics-facility-archive-2019/live/orwell/GeoMx/ - geomx_pkc_file: /rds/general/project/genomics-facility-archive-2019/live/orwell/GeoMx/GeoMx_PKC_Files/Hs_R_NGS_WTA_v1.0.pkc - geomx_dcc_params: - - "--threads=8" \ No newline at end of file + config_zip_file: /rds/general/project/genomics-facility-archive-2019/live/orwell/GeoMx/ + geomx_pkc_file: /rds/general/project/genomics-facility-archive-2019/live/orwell/GeoMx/GeoMx_PKC_Files/Hs_R_NGS_WTA_v1.0.pkc + geomx_dcc_params: + - "--threads=8" \ No newline at end of file diff --git a/app/raw_analysis/NF_ATAC_template_v1.txt b/app/raw_analysis/NF_ATAC_template_v1.txt index 795284f..b2501b6 100644 --- a/app/raw_analysis/NF_ATAC_template_v1.txt +++ b/app/raw_analysis/NF_ATAC_template_v1.txt @@ -1,11 +1,11 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - sample: SAMPLE_NAME - replicate: REPLICATE_ID +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + sample: SAMPLE_NAME + replicate: REPLICATE_ID {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/atacseq - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/atacseq + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_Ampliseq_template_v1.txt b/app/raw_analysis/NF_Ampliseq_template_v1.txt index f79c012..c23237c 100644 --- a/app/raw_analysis/NF_Ampliseq_template_v1.txt +++ b/app/raw_analysis/NF_Ampliseq_template_v1.txt @@ -1,10 +1,10 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - condition: CONDITION_NAME +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + condition: CONDITION_NAME {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/ampliseq - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/ampliseq + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_Bactmap_template_v1.txt b/app/raw_analysis/NF_Bactmap_template_v1.txt index 452c2a3..7d436a5 100644 --- a/app/raw_analysis/NF_Bactmap_template_v1.txt +++ b/app/raw_analysis/NF_Bactmap_template_v1.txt @@ -1,9 +1,9 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/bactmap - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/bactmap + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_ChIP_template_v1.txt b/app/raw_analysis/NF_ChIP_template_v1.txt index 8bd474e..d8d3f2d 100644 --- a/app/raw_analysis/NF_ChIP_template_v1.txt +++ b/app/raw_analysis/NF_ChIP_template_v1.txt @@ -1,11 +1,11 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - antibody: ANTIBODY_NAME - control: CONTROL_SAMPLE_ID +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + antibody: ANTIBODY_NAME + control: CONTROL_SAMPLE_ID {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/chipseq - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/chipseq + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_CutAndRun_template_v1.txt b/app/raw_analysis/NF_CutAndRun_template_v1.txt index d6abc9c..1b67a7f 100644 --- a/app/raw_analysis/NF_CutAndRun_template_v1.txt +++ b/app/raw_analysis/NF_CutAndRun_template_v1.txt @@ -1,12 +1,12 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - group: GROUP_NAME - replicate: REPLICATE_ID - control: CONTROL_SAMPLE_ID +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + group: GROUP_NAME + replicate: REPLICATE_ID + control: CONTROL_SAMPLE_ID {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/cutandrun - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/cutandrun + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_HIC_template_v1.txt b/app/raw_analysis/NF_HIC_template_v1.txt index 31560e7..1493ea0 100644 --- a/app/raw_analysis/NF_HIC_template_v1.txt +++ b/app/raw_analysis/NF_HIC_template_v1.txt @@ -1,9 +1,9 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/hic - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/hic + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_Methylseq_template_v1.txt b/app/raw_analysis/NF_Methylseq_template_v1.txt index 71a91be..bf863cf 100644 --- a/app/raw_analysis/NF_Methylseq_template_v1.txt +++ b/app/raw_analysis/NF_Methylseq_template_v1.txt @@ -1,10 +1,10 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/methylseq - nextflow_params: - - "-profile singularity" - - "-r A.B" - - "--aligner bismark" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/methylseq + nextflow_params: + - "-profile singularity" + - "-r A.B" + - "--aligner bismark" \ No newline at end of file diff --git a/app/raw_analysis/NF_RNA_template_v1.txt b/app/raw_analysis/NF_RNA_template_v1.txt index 932d8c6..67de6b1 100644 --- a/app/raw_analysis/NF_RNA_template_v1.txt +++ b/app/raw_analysis/NF_RNA_template_v1.txt @@ -1,13 +1,13 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - condition: CONDITION_NAME (USE CAPS) - strandedness: reverse +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + condition: CONDITION_NAME (USE CAPS) + strandedness: reverse {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/rnaseq - nextflow_params: - - "-profile singularity" - - "-r A.B" - - "--aligner star_rsem" - - "--seq_center IGF" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/rnaseq + nextflow_params: + - "-profile singularity" + - "-r A.B" + - "--aligner star_rsem" + - "--seq_center IGF" \ No newline at end of file diff --git a/app/raw_analysis/NF_Sarek_template_v1.txt b/app/raw_analysis/NF_Sarek_template_v1.txt index ea9b2e0..c162892 100644 --- a/app/raw_analysis/NF_Sarek_template_v1.txt +++ b/app/raw_analysis/NF_Sarek_template_v1.txt @@ -1,12 +1,12 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: - patient: PATIENT_ID - sex: SEX - status: STATUS_ID +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: + patient: PATIENT_ID + sex: SEX + status: STATUS_ID {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/sarek - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/sarek + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/NF_smRNA_template_v1.txt b/app/raw_analysis/NF_smRNA_template_v1.txt index 798d5bf..d50080a 100644 --- a/app/raw_analysis/NF_smRNA_template_v1.txt +++ b/app/raw_analysis/NF_smRNA_template_v1.txt @@ -1,9 +1,9 @@ sample_metadata: -{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" +{% for SAMPLE_ID in SAMPLE_ID_LIST %} {{ SAMPLE_ID }}: "" {% endfor -%} analysis_metadata: - NXF_VER: X.Y.Z - nfcore_pipeline: nf-core/smrnaseq - nextflow_params: - - "-profile singularity" - - "-r A.B" \ No newline at end of file + NXF_VER: X.Y.Z + nfcore_pipeline: nf-core/smrnaseq + nextflow_params: + - "-profile singularity" + - "-r A.B" \ No newline at end of file diff --git a/app/raw_analysis/analysis_validation_cellranger_multi_v1 b/app/raw_analysis/analysis_validation_cellranger_multi_v1 new file mode 100644 index 0000000..fdcbfa0 --- /dev/null +++ b/app/raw_analysis/analysis_validation_cellranger_multi_v1 @@ -0,0 +1,59 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "id": "https://github.com/imperial-genomics-facility/IGFPortal", + "title": "IGF Cellranger Multi analysis validation schema", + "description": "Schema for validation of Cellranger multi analysis yaml file", + "type" : "object", + "version": "0.0.1", + "properties": { + "sample_metadata": { + "type": "object", + "uniqueItems": true, + "minItems": 1, + "patternProperties": { + "^IGF[a-zA-Z0-9-_]+$": { + "type": ["object", "string"], + "properties": { + "feature_types": { + "type": "string", + "enum": [ + "Gene Expression", + "Antibody Capture", + "CRISPR Guide Capture", + "Multiplexing Capture", + "VDJ-B", + "VDJ-T", + "VDJ-T-GD", + "Antigen Capture" + ] + }, + "cellranger_group": { + "type": "string", + "pattern": "^[A-Z0-9-_]+$" + } + } + } + } + }, + "analysis_metadata": { + "type": "object", + "properties": { + "scanpy": { + "type": "object", + "uniqueItems": true, + "minItems": 1 + }, + "cellranger_multi_config": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string" + } + } + }, + "required": ["cellranger_multi_config", "scanpy"] + } + }, + "required": ["sample_metadata", "analysis_metadata"] +} \ No newline at end of file diff --git a/app/raw_analysis_view.py b/app/raw_analysis_view.py index 5eaa501..b2dfeef 100644 --- a/app/raw_analysis_view.py +++ b/app/raw_analysis_view.py @@ -223,21 +223,21 @@ class RawAnalysisView(ModelView): def reject_raw_analysis(self, item): try: if isinstance(item, list): - for i in item: - try: + try: + for i in item: db.session.\ query(RawAnalysis).\ filter(RawAnalysis.raw_analysis_id==i.raw_analysis_id).\ update({'status': 'REJECTED'}) - db.session.commit() - except: - db.session.rollback() - raise + db.session.commit() + except: + db.session.rollback() + raise else: try: db.session.\ query(RawAnalysis).\ - filter(RawAnalysis.raw_analysis_id==i.raw_analysis_id).\ + filter(RawAnalysis.raw_analysis_id==item.raw_analysis_id).\ update({'status': 'REJECTED'}) db.session.commit() except: @@ -574,6 +574,28 @@ def template_geomx_dcc(self, item): log.error(e) return redirect(url_for('RawAnalysisView.list')) + @action("template_cellranger_multi", "Template cellranger multi", confirmation=None, icon="fa-file-excel-o", multiple=False, single=True) + def template_cellranger_multi(self, item): + try: + template_tag = "CELLRANGER_MULTI" + if item.project_id is not None: + formatted_template = \ + generate_analysis_template( + project_igf_id=item.project.project_igf_id, + template_tag=template_tag) + output = BytesIO(formatted_template.encode('utf-8')) + analysis_name = item.analysis_name.encode('utf-8').decode() + output.seek(0) + self.update_redirect() + return send_file(output, download_name=f"{analysis_name}_{template_tag}_analysis.yaml", as_attachment=True) + else: + flash(f"Failed to generate {template_tag} template, no project", 'danger') + return redirect(url_for('RawAnalysisView.list')) + except Exception as e: + flash(f"Failed to generate {template_tag} template", 'danger') + log.error(e) + return redirect(url_for('RawAnalysisView.list')) + class RawAnalysisQueueView(ModelView): datamodel = SQLAInterface(RawAnalysis)