Skip to content

Commit

Permalink
reduce pipeline to clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
AmstlerStephan committed Jul 25, 2024
1 parent a1a7097 commit ad24d5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
13 changes: 6 additions & 7 deletions lib/processes/cluster.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
consensus_fasta="consensus.fasta"
vsearch_dir="vsearch_clusters"

detected_umis_file_name="dected_umis.fastq"
process CLUSTER {

publishDir "${params.output}/${sample}/clustering/${type}", pattern: "cluster*", mode: 'copy'

input:
tuple val( sample ), val( target ), path( detected_umis_fastq )
val ( type )
path sample
output:
tuple val( "${sample}" ), val( "${target}" ), path( "${consensus_fasta}" ), optional: true, emit:consensus_fasta
tuple val( "${sample}" ), val( "${target}" ), path( "cluster*" ), optional: true, emit:cluster_fastas
tuple val( "${sample.baseName}" ), path( "cluster*" ), optional: true, emit:cluster_fastas

script:
def id = "${type}" == "raw" ? params.vsearch_sequence_identity : 0.99
Expand All @@ -20,7 +19,7 @@ process CLUSTER {
--minseqlength ${params.min_length} \
--maxseqlength ${params.max_length} \
--threads ${params.threads} \
--cluster_fast ${detected_umis_fastq} \
--cluster_fast ${sample}/${detected_umis_file_name} \
--clusterout_sort \
--gapopen 0E/5I \
--gapext 0E/2I \
Expand Down
2 changes: 1 addition & 1 deletion lib/processes/reformat_filter_cluster.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process REFORMAT_FILTER_CLUSTER {
publishDir "${params.output}/${sample}/stats/${type}", pattern: "*tsv", mode: 'copy'

input:
tuple val( sample ), val( target ), path( cluster )
tuple val( sample ), path( cluster )
val( type )
path umi_parse_clusters_python

Expand Down
23 changes: 2 additions & 21 deletions lib/workflows/umi-pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ n_parsed_cluster = [:]
// Remove barcode01 and uncalssified from the input fastq folder
Channel.fromPath("${params.input}/*", type: 'dir')
.filter( ~/.*barcode(([0-9][0-9]))/ )
.set { fastq_files_ch }
.set { detected_umis_ch }

////////////////////
// BEGIN PIPELINE //
Expand All @@ -54,26 +54,7 @@ include {REFORMAT_FILTER_CLUSTER} from '../processes/reformat_filter_cluster.nf'
workflow UMI_PIPELINE {

main:
COPY_BED( bed )

if( params.subsampling ){
MERGE_FASTQ( fastq_files_ch )
SUBSAMPLING( MERGE_FASTQ.out.merged_fastq )
.set { merged_fastq }
} else {
MERGE_FASTQ( fastq_files_ch )
.set { merged_fastq }
}

merged_fastq
.filter { sample, target, fastq_file -> fastq_file.countFastq() > params.min_reads_per_barcode }
.set { merged_filtered_fastq }

MAP_READS( merged_filtered_fastq, raw, reference )
SPLIT_READS( MAP_READS.out.bam_consensus, COPY_BED.out.bed, raw, umi_filter_reads )
DETECT_UMI_FASTQ( SPLIT_READS.out.split_reads_fastx, raw, umi_extract )
CLUSTER( DETECT_UMI_FASTQ.out.umi_extract_fastq, raw )

CLUSTER( detected_umis_ch)
REFORMAT_FILTER_CLUSTER( CLUSTER.out.cluster_fastas, raw, umi_parse_clusters )
}

Expand Down

0 comments on commit ad24d5a

Please sign in to comment.