From 2e240add27d4b4e927e2da81ff8558c74a7c06b9 Mon Sep 17 00:00:00 2001 From: Xichen Wu Date: Mon, 27 Nov 2023 22:28:25 +0100 Subject: [PATCH 1/2] fix bug when no hto or rna matrix is provided for summary --- bin/donor_match.R | 4 ++++ modules/gene_demultiplexing.nf | 8 ++++---- modules/hash_demultiplexing.nf | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/donor_match.R b/bin/donor_match.R index 0680d5f..99a68eb 100755 --- a/bin/donor_match.R +++ b/bin/donor_match.R @@ -52,6 +52,10 @@ if (!is.null(args$barcode)) { colname_with_singlet <- colnames(result_csv %>% select_if(~ any(. != "negative" & . != "doublet"))) colname_with_singlet <- colname_with_singlet[colname_with_singlet != "Barcode"] +if (length(colname_with_singlet) < 2){ + stop("Please choose more methods to run donor matching!") +} + if (!is.null(args$method1) && !is.null(args$method2)) { method1_all <- colname_with_singlet[startsWith(colnames(result_csv), args$method1)] method2_all <- colname_with_singlet[startsWith(colnames(result_csv), args$method2)] diff --git a/modules/gene_demultiplexing.nf b/modules/gene_demultiplexing.nf index dbf5c2a..938eba7 100644 --- a/modules/gene_demultiplexing.nf +++ b/modules/gene_demultiplexing.nf @@ -62,7 +62,7 @@ process summary{ if(rna_matrix.name == "None"){ error "Error: RNA count matrix is not given." } - generate_adata = "--generate_anndata --read_rna_mtx $rna_matrix" + generate_adata = "--generate_anndata --read_rna_mtx rna_data" } if (generate_mudata == "True"){ if(rna_matrix.name == "None"){ @@ -71,10 +71,10 @@ process summary{ if(hto_matrix.name == "None"){ error "Error: HTO count matrix is not given." } - generate_mdata = "--generate_mudata --read_rna_mtx $rna_matrix --read_hto_mtx $hto_matrix" + generate_mdata = "--generate_mudata --read_rna_mtx rna_data --read_hto_mtx hto_data" } """ - summary_gene.py $demuxlet_files $vireo_files $souporcell_files $scsplit_files $freemuxlet_files $generate_adata $generate_mdata --sampleId $sampleId + summary_gene.py $demuxlet_files $vireo_files $souporcell_files $scsplit_files $freemuxlet_files $generate_adata $generate_mdata """ } @@ -250,7 +250,7 @@ workflow gene_demultiplexing { Channel.fromPath(params.multi_input) \ | splitCsv(header:true) \ - | map { row-> tuple(row.sampleId, row.hto_matrix_filtered, row.rna_matrix_filtered)} + | map { row-> tuple(row.sampleId, file(row.hto_matrix_filtered), file(row.rna_matrix_filtered))} | set {input_list_summary} summary(input_list_summary, demuxlet_out, freemuxlet_out, vireo_out, souporcell_out, scSplit_out, params.generate_anndata, params.generate_mudata) diff --git a/modules/hash_demultiplexing.nf b/modules/hash_demultiplexing.nf index 9ae2a9e..ba215d4 100644 --- a/modules/hash_demultiplexing.nf +++ b/modules/hash_demultiplexing.nf @@ -212,7 +212,7 @@ workflow hash_demultiplexing{ Channel.fromPath(params.multi_input) \ | splitCsv(header:true) \ - | map { row-> tuple(row.sampleId, row.hto_matrix_filtered, row.rna_matrix_filtered)} + | map { row-> tuple(row.sampleId, file(row.hto_matrix_filtered), file(row.rna_matrix_filtered))} | set {input_list_summary} summary(input_list_summary, demuxem_out, hashsolo_out, htodemux_out, multiseq_out, hashedDrops_out,demuxmix_out,bff_out,gmmDemux_out, params.generate_anndata, params.generate_mudata) From e3c949c8518bd9127e3e285da783ff02aadf86e4 Mon Sep 17 00:00:00 2001 From: Xichen Wu Date: Mon, 27 Nov 2023 22:38:43 +0100 Subject: [PATCH 2/2] remove name of grouplist --- modules/gene_demulti/freemuxlet.nf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/gene_demulti/freemuxlet.nf b/modules/gene_demulti/freemuxlet.nf index 6fa84c8..23390ff 100755 --- a/modules/gene_demulti/freemuxlet.nf +++ b/modules/gene_demulti/freemuxlet.nf @@ -74,8 +74,7 @@ process freemuxlet { mkdir freemuxlet_${sampleId} mkdir freemuxlet_${sampleId}/plp touch freemuxlet_${sampleId}/params.csv - barcode_num=\$(wc -l < "${group_list}") - echo -e "Argument,Value \n samfile,${sam} \n tag_group,${tag_group} \n tag_UMI,${tag_UMI} \n vcf_file,${vcf} \n sm,${sm} \n sm_list_file,${sm_list_file_name} \n sam_verbose,${sam_verbose} \n vcf_verbose,${vcf_verbose} \n skip_umi,${skip_umi} \n cap_BQ,${cap_BQ} \n min_BQ,${min_BQ} \n min_MQ,${min_MQ} \n min_TD,${min_TD} \n excl_flag,${excl_flag} \n grouplist,${grouplist.name}_\${barcode_num} \n min_total,${min_total} \n min_uniq,${min_uniq} \n min_umi,${min_umi} \n min_snp,${min_snp} \n init_cluster,${init_cluster} \n nsample,${nsample} \n aux_files,${aux_files} \n verbose,${verbose} \n doublet_prior,${doublet_prior} \n bf_thres,${bf_thres} \n frac_init_clust,${frac_init_clust} \n iter_init,${iter_init} \n keep_init_missing,${keep_init_missing}" >> freemuxlet_${sampleId}/params.csv + echo -e "Argument,Value \n samfile,${sam} \n tag_group,${tag_group} \n tag_UMI,${tag_UMI} \n vcf_file,${vcf} \n sm,${sm} \n sm_list_file,${sm_list_file_name} \n sam_verbose,${sam_verbose} \n vcf_verbose,${vcf_verbose} \n skip_umi,${skip_umi} \n cap_BQ,${cap_BQ} \n min_BQ,${min_BQ} \n min_MQ,${min_MQ} \n min_TD,${min_TD} \n excl_flag,${excl_flag} \n grouplist,${group_list} \n min_total,${min_total} \n min_uniq,${min_uniq} \n min_umi,${min_umi} \n min_snp,${min_snp} \n init_cluster,${init_cluster} \n nsample,${nsample} \n aux_files,${aux_files} \n verbose,${verbose} \n doublet_prior,${doublet_prior} \n bf_thres,${bf_thres} \n frac_init_clust,${frac_init_clust} \n iter_init,${iter_init} \n keep_init_missing,${keep_init_missing}" >> freemuxlet_${sampleId}/params.csv popscle dsc-pileup $samfile ${taggroup} ${tagUMI} $vcffile ${smlist} ${sm_list_file} ${samverbose} ${vcfverbose} \ ${skipumi} ${capBQ} ${minBQ} ${minMQ} ${minTD} ${exclflag} ${grouplist} ${mintotal} ${minuniq} ${minsnp} \