diff --git a/modules/nf-core/modules/cellsnp/main.nf b/modules/nf-core/modules/cellsnp/main.nf index 459bbd6..4e5603c 100755 --- a/modules/nf-core/modules/cellsnp/main.nf +++ b/modules/nf-core/modules/cellsnp/main.nf @@ -2,7 +2,8 @@ process capture_cellsnp_files{ publishDir path: "${params.outdir}/deconvolution/", saveAs: {filename -> - if (filename == "output_cellsnp.csv" || filename == "existing_cellsnp") { + File file = new File(filename) + if (filename == "output_cellsnp.csv" || filename == "existing_cellsnp_do_not_save") { null }else { filename @@ -18,12 +19,23 @@ process capture_cellsnp_files{ script: """ echo '${params.cellsnp_recapture}' - for OUTPUT in \$(ls ${cellsnp_location}) - do - samplename1=\$(echo \$OUTPUT | sed 's/cellsnp_//g') - echo "\$samplename1 \$PWD/${cellsnp_location}/\$OUTPUT" >> output_cellsnp.csv + echo "deconvolution_test" + for OUTPUT in \$(ls ${cellsnp_location}); do + if [ ${cellsnp_location} == "existing_cellsnp" ] && [ -d ${cellsnp_location} ]; then + file_count=\$(ls -1 ${cellsnp_location} | wc -l) + if [ "\$file_count" -eq 1 ] && [ "\$OUTPUT" == "readme.md" ]; then + echo "Skipping folder ${cellsnp_location}" + mv ${cellsnp_location} existing_cellsnp_do_not_save + else + samplename1=\$(echo \$OUTPUT | sed 's/cellsnp_//g') + echo "\$samplename1 \$PWD/${cellsnp_location}/\$OUTPUT" >> output_cellsnp.csv + fi + else + samplename1=\$(echo \$OUTPUT | sed 's/cellsnp_//g') + echo "\$samplename1 \$PWD/${cellsnp_location}/\$OUTPUT" >> output_cellsnp.csv + fi done - """ + """ } diff --git a/subworkflows/main_deconvolution.nf b/subworkflows/main_deconvolution.nf index 55dacf5..a0c74cb 100755 --- a/subworkflows/main_deconvolution.nf +++ b/subworkflows/main_deconvolution.nf @@ -385,26 +385,26 @@ workflow main_deconvolution { // collect file paths to h5ad files in tsv tables: header_seed="experiment_id\tdonor\th5ad_filepath" - collect_file2(SPLIT_DONOR_H5AD.out.donors_h5ad_tsv.collect(),"donors_h5ad.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + collect_file2(SPLIT_DONOR_H5AD.out.donors_h5ad_tsv.collect(),"donors_h5ad.tsv",0,0,header_seed) header_seed="experiment_id\th5ad_filepath" - collect_file3(SPLIT_DONOR_H5AD.out.exp__donors_h5ad_tsv.collect(),"exp__donors_h5ad.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + collect_file3(SPLIT_DONOR_H5AD.out.exp__donors_h5ad_tsv.collect(),"exp__donors_h5ad.tsv",0,0,header_seed) header_seed="experiment_id\tdonor\th5ad_filepath" - collect_file4(SPLIT_DONOR_H5AD.out.donors_h5ad_assigned_tsv.collect(),"donors_h5ad_assigned.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + collect_file4(SPLIT_DONOR_H5AD.out.donors_h5ad_assigned_tsv.collect(),"donors_h5ad_assigned.tsv",0,0,header_seed) header_seed="experiment_id\th5ad_filepath" - out_h5ad = collect_file5(SPLIT_DONOR_H5AD.out.exp__donors_h5ad_assigned_tsv.collect(),"exp__donors_h5ad_assigned.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + out_h5ad = collect_file5(SPLIT_DONOR_H5AD.out.exp__donors_h5ad_assigned_tsv.collect(),"exp__donors_h5ad_assigned.tsv",0,0,header_seed) header_seed="experiment_id\th5ad_filepath" - collect_file6(SPLIT_DONOR_H5AD.out.h5ad_tsv.collect(),"cellranger_as_h5ad.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + collect_file6(SPLIT_DONOR_H5AD.out.h5ad_tsv.collect(),"cellranger_as_h5ad.tsv",0,0,header_seed) header_seed="experiment_id\tdonor\tn_cells" - ch_vireo_donor_n_cells_tsv = collect_file7(REPLACE_GT_DONOR_ID2.out.sample_summary_tsv.collect(),"vireo_donor_n_cells.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + ch_vireo_donor_n_cells_tsv = collect_file7(REPLACE_GT_DONOR_ID2.out.sample_summary_tsv.collect(),"vireo_donor_n_cells.tsv",0,0,header_seed) // paste experiment_id and donor ID columns with __ separator header_seed="experiment_id\tn_cells" - vireo_out_sample__exp_summary_tsv = collect_file8(SPLIT_DONOR_H5AD.out.donor_n_cells.collect(),"vireo_exp__donor_n_cells.tsv",params.outdir+'/deconvolution/filepaths',0,header_seed) + vireo_out_sample__exp_summary_tsv = collect_file8(SPLIT_DONOR_H5AD.out.donor_n_cells.collect(),"vireo_exp__donor_n_cells.tsv",0,0,header_seed) if (params.genotype_input.run_with_genotype_input & params.genotype_input.posterior_assignment) { if (params.extra_sample_metadata!='' & params.add_donor_metadata){