Skip to content

Commit

Permalink
The filepaths folder has been removed from the output. existing_cells…
Browse files Browse the repository at this point in the history
…np is not saved in the output folder if it has only readme.md
  • Loading branch information
Vladimir Ovchinnikov committed Dec 13, 2024
1 parent ba2a996 commit 9b499ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
24 changes: 18 additions & 6 deletions modules/nf-core/modules/cellsnp/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""
"""
}


Expand Down
14 changes: 7 additions & 7 deletions subworkflows/main_deconvolution.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit 9b499ed

Please sign in to comment.