diff --git a/lib/processes/cluster.nf b/lib/processes/cluster.nf index e241216..61ca568 100644 --- a/lib/processes/cluster.nf +++ b/lib/processes/cluster.nf @@ -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 @@ -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 \ diff --git a/lib/processes/reformat_filter_cluster.nf b/lib/processes/reformat_filter_cluster.nf index 6def78d..7e5959e 100644 --- a/lib/processes/reformat_filter_cluster.nf +++ b/lib/processes/reformat_filter_cluster.nf @@ -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 diff --git a/lib/workflows/umi-pipeline.nf b/lib/workflows/umi-pipeline.nf index 479a948..86d8cdc 100644 --- a/lib/workflows/umi-pipeline.nf +++ b/lib/workflows/umi-pipeline.nf @@ -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 // @@ -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 ) }