Skip to content

Commit

Permalink
fix reviewer suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia.pena.perez@scilifelab.se committed Oct 25, 2023
1 parent c4b0983 commit 71a93cd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
4 changes: 1 addition & 3 deletions bin/drop_sample_annot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3

import argparse
from pathlib import Path
import csv
from pandas import read_csv, DataFrame, concat
import os
Expand Down Expand Up @@ -59,8 +58,7 @@ def write_final_annot_to_tsv(ref_count_file: str, ref_annot: str, out_file: str)
df_samples: DataFrame = read_csv("drop_annotation_given_samples.tsv", sep="\t")
df_reference: DataFrame = read_csv(ref_annot, sep="\t")
df_reference["GENE_COUNTS_FILE"] = ref_count_file
df_reference["SPLICE_COUNTS_DIR"] = df_reference["SPLICE_COUNTS_DIR"].str.rstrip("/")
df_reference["SPLICE_COUNTS_DIR"] = df_reference["SPLICE_COUNTS_DIR"].apply(os.path.basename)
df_reference["SPLICE_COUNTS_DIR"] = df_reference["SPLICE_COUNTS_DIR"].str.rstrip("/").apply(os.path.basename)
df_reference["DROP_GROUP"] = df_reference["DROP_GROUP"].str.replace(" ", "")
df_samples["COUNT_OVERLAPS"] = df_reference["COUNT_OVERLAPS"].iloc[0]
df_samples["COUNT_MODE"] = df_reference["COUNT_MODE"].iloc[0]
Expand Down
4 changes: 1 addition & 3 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,11 @@ process {

process {
withName: '.*ANNOTATE_SNV:ENSEMBLVEP' {
ext.prefix = { "${vcf.simpleName}_rohann_vcfanno_filter_vep" }
ext.prefix = { "${vcf.simpleName}_vep" }
ext.args = [
'--dir_plugins cache/Plugins',
'--plugin LoFtool,cache/Plugins/LoFtool_scores.txt',
'--plugin pLI,cache/Plugins/pLI_values_107.txt',
'--plugin SpliceAI,snv=cache/Plugins/spliceai_21_scores_raw_snv_-v1.3-.vcf.gz,indel=cache/Plugins/spliceai_21_scores_raw_snv_-v1.3-.vcf.gz',
'--plugin MaxEntScan,cache/Plugins/fordownload,SWA,NCSS',
'--distance 5000',
'--buffer_size 20000',
'--format vcf --max_sv_size 248956422',
Expand Down
9 changes: 4 additions & 5 deletions subworkflows/local/analyse_transcripts.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ workflow ANALYSE_TRANSCRIPTS {
// Generates count files for samples and merges them with reference count file

// Generates sample annotation
star_samples = gene_counts.map{ meta, cnt_file -> meta }.collect()
star_samples = gene_counts.map{ meta, cnt_file -> meta }.collect()
ch_bam_files = ch_bam_ds_bai.collect{it[1]}
DROP_SAMPLE_ANNOT(
ch_bam_files,
Expand All @@ -46,8 +46,8 @@ workflow ANALYSE_TRANSCRIPTS {
)

// Generates config file and runs Aberrant expression module
ch_bai_files = ch_bam_ds_bai.collect{it[2]}.toList()
ch_bam_bai_files=ch_bam_files.toList().combine(ch_bai_files)
ch_bai_files = ch_bam_ds_bai.collect{ it[2] }.toList()
ch_bam_bai_files = ch_bam_files.toList().combine(ch_bai_files)
DROP_CONFIG_RUN_AE(
ch_fasta_fai_meta,
ch_gtf,
Expand Down Expand Up @@ -90,7 +90,7 @@ workflow ANALYSE_TRANSCRIPTS {
)

// Stringtie
ch_bam = ch_bam_bai.map{ meta, bam, bai -> [meta, [bam]]}
ch_bam = ch_bam_bai.map{ meta, bam, bai -> [meta, [bam]] }
STRINGTIE_STRINGTIE(
ch_bam,
ch_gtf
Expand All @@ -103,7 +103,6 @@ workflow ANALYSE_TRANSCRIPTS {
ch_gtf.map{ gtf -> [ [id:gtf.simpleName], gtf ] }
)

//ch_versions = ch_versions.mix(DROP_COUNTS.out.versions)
ch_versions = ch_versions.mix(DROP_SAMPLE_ANNOT.out.versions)
ch_versions = ch_versions.mix(DROP_CONFIG_RUN_AE.out.versions)
ch_versions = ch_versions.mix(DROP_CONFIG_RUN_AS.out.versions)
Expand Down
12 changes: 5 additions & 7 deletions subworkflows/local/prepare_references.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ workflow PREPARE_REFERENCES {
main:
ch_versions = Channel.empty()

fasta_meta=Channel.fromPath(fasta).map { it -> [[id:it[0]], it]}.collect()
fasta_meta = Channel.fromPath(fasta).map { it -> [ [id:it[0] ], it] }.collect()
GUNZIP_FASTA(fasta_meta)
ch_fasta = fasta.endsWith(".gz") ? GUNZIP_FASTA.out.gunzip.collect() : fasta_meta

Expand All @@ -43,7 +43,7 @@ workflow PREPARE_REFERENCES {
BUILD_DICT(ch_fasta)
ch_dict = BUILD_DICT.out.dict.collect()

gtf_meta=Channel.fromPath(gtf).map{it -> [[id:it[0]], it]}.collect()
gtf_meta = Channel.fromPath(gtf).map{ it -> [ [id:it[0]], it ] }.collect()
GUNZIP_GTF(gtf_meta)
ch_gtf_no_meta = gtf.endsWith(".gz") ? GUNZIP_GTF.out.gunzip.map{ meta, gtf -> [gtf] }.collect() : Channel.fromPath(gtf)

Expand All @@ -57,21 +57,19 @@ workflow PREPARE_REFERENCES {
UNTAR_STAR_INDEX( ch_star.map { it -> [[:], it] } )
ch_star_index = (!star_index) ? BUILD_STAR_GENOME.out.index.collect() :
(star_index.endsWith(".gz") ? UNTAR_STAR_INDEX.out.untar.map { it[1] } : star_index)

// Convert gtf to refflat for picard
GTF_TO_REFFLAT(ch_gtf_no_meta)

// Get rRNA transcripts and convert to interval_list format
GET_RRNA_TRANSCRIPTS(ch_gtf_no_meta)

BEDTOINTERVALLIST( GET_RRNA_TRANSCRIPTS.out.bed.map {it -> [ [id:it.name], it ]}, ch_dict )
BEDTOINTERVALLIST( GET_RRNA_TRANSCRIPTS.out.bed.map { it -> [ [id:it.name], it ] }, ch_dict )

UNTAR_VEP_CACHE (ch_vep_cache)

// Preparing transcript fasta
ch_fasta_fai = ch_fasta.join(ch_fai).collect()
GFFREAD(ch_gtf_no_meta.map{it -> [[id:it[0].simpleName], it]},ch_fasta_fai)
tr=GFFREAD.out.tr_fasta.collect()
GFFREAD(ch_gtf_no_meta.map{ it -> [ [id:it[0].simpleName], it ] },ch_fasta_fai)
transcript_fasta_no_meta = (!transcript_fasta) ? GFFREAD.out.tr_fasta.collect() :
(transcript_fasta.endsWith(".gz") ? GUNZIP_TRFASTA.out.gunzip.collect().map{ meta, fasta -> [ fasta ] } : transcript_fasta)

Expand Down Expand Up @@ -109,6 +107,6 @@ workflow PREPARE_REFERENCES {
refflat = GTF_TO_REFFLAT.out.refflat.collect()
rrna_bed = GET_RRNA_TRANSCRIPTS.out.bed.collect()
interval_list = BEDTOINTERVALLIST.out.interval_list.map{ meta, interv -> [interv] }.collect()
vep_resources = UNTAR_VEP_CACHE.out.untar.map{meta, files -> [files]}.collect() // channel: [ path(cache) ]
vep_resources = UNTAR_VEP_CACHE.out.untar.map{ meta, files -> [files] }.collect() // channel: [ path(cache) ]
versions = ch_versions
}
1 change: 0 additions & 1 deletion workflows/tomte.nf
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ workflow TOMTE {
exit 1, 'Input samplesheet not specified!'
}

//fasta = Channel.fromPath(params.fasta).map { it -> [[id:it[0].simpleName], it] }.collect()
ch_vep_cache_unprocessed = params.vep_cache ? Channel.fromPath(params.vep_cache).map { it -> [[id:'vep_cache'], it] }.collect()
: Channel.value([[],[]])
ch_vep_filters = params.vep_filters ? Channel.fromPath(params.vep_filters).collect()
Expand Down

0 comments on commit 71a93cd

Please sign in to comment.