From c701d6c597fc6a9b15b1e38ea4c96c7ad2c78a66 Mon Sep 17 00:00:00 2001 From: "Davi Marcon (@mxrcon)" Date: Fri, 28 Oct 2022 23:40:42 -0300 Subject: [PATCH] base work on modules --- modules/local/call2plink/bedify.nf | 16 ++++++++++++++++ modules/local/call2plink/combineBed.nf | 19 +++++++++++++++++++ modules/local/call2plink/fillinbam.nf | 10 ++++++++++ modules/local/call2plink/illumina2lgen.nf | 15 +++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 modules/local/call2plink/bedify.nf create mode 100644 modules/local/call2plink/combineBed.nf create mode 100644 modules/local/call2plink/fillinbam.nf create mode 100644 modules/local/call2plink/illumina2lgen.nf diff --git a/modules/local/call2plink/bedify.nf b/modules/local/call2plink/bedify.nf new file mode 100644 index 0000000..75e2147 --- /dev/null +++ b/modules/local/call2plink/bedify.nf @@ -0,0 +1,16 @@ +process bedify { + + input: + set file(ped), file(map) + output: + file("${base}.bed"), emit: bed_ch + file ("${base}.bim"), emit: bim_ch + file("${base}.fam"), emit: fam_ch + script: + def base = ped.baseName + """ + echo $base + + plink --file $base --no-fid --make-bed --out $base + """ + } diff --git a/modules/local/call2plink/combineBed.nf b/modules/local/call2plink/combineBed.nf new file mode 100644 index 0000000..9432629 --- /dev/null +++ b/modules/local/call2plink/combineBed.nf @@ -0,0 +1,19 @@ +// Combine all plinks and possibly remove errprs + process combineBed { + input: + file(bed) + file(bim) + file(fam) + output: + tuple file("raw.bed"), file("raw.fam"), file("raw.log"), emit: plink_src + file("rawraw.bim"), emit: fill_in_bim_ch + script: + """ + ls *.bed | sort > beds + ls *.bim | sort > bims + ls *.fam | sort > fams + paste beds bims fams > mergelist + plink --merge-list mergelist --make-bed --out raw + mv raw.bim rawraw.bim + """ + } diff --git a/modules/local/call2plink/fillinbam.nf b/modules/local/call2plink/fillinbam.nf new file mode 100644 index 0000000..c4f0a9d --- /dev/null +++ b/modules/local/call2plink/fillinbam.nf @@ -0,0 +1,10 @@ +process fillInBim { // Deals with monomorphic or non-called SNPs + input: + file(inbim) + file(strand) + file(manifest) + output: + file("raw.bim"), emit: filled_bim_ch + script: + "fill_in_bim.py ${params.output_align} $strand $manifest $inbim raw.bim" + } diff --git a/modules/local/call2plink/illumina2lgen.nf b/modules/local/call2plink/illumina2lgen.nf new file mode 100644 index 0000000..4a23f28 --- /dev/null +++ b/modules/local/call2plink/illumina2lgen.nf @@ -0,0 +1,15 @@ +process illumina2lgen { + input: + set file(report), file(array) + + output: + tuple file("${output}.ped"), file("${output}.map"), emit: ped_ch + script: + def samplesize = params.samplesize + def idpat = params.idpat + def output = report.baseName + """ + hostname + topbottom.py $array $report $samplesize '$idpat' $output + """ + }