From b718b016b89075a79468424d7aec05a42952de9b Mon Sep 17 00:00:00 2001 From: feizhao Date: Wed, 7 Apr 2021 11:10:04 +0800 Subject: [PATCH] rename log file --- .../rules/denovo_sacffold_filter_by_fasta.smk | 2 +- .../rules/denovo_scaffold_filter_by_region.smk | 2 +- tritimap/rules/dna_mapping.smk | 17 +++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tritimap/rules/denovo_sacffold_filter_by_fasta.smk b/tritimap/rules/denovo_sacffold_filter_by_fasta.smk index 9f75218..7de4359 100644 --- a/tritimap/rules/denovo_sacffold_filter_by_fasta.smk +++ b/tritimap/rules/denovo_sacffold_filter_by_fasta.smk @@ -19,7 +19,7 @@ rule uniqScaffoldByFasta: message: "\nGet bulk uniq scaffolds by fasta file. Input file: {input.fa}\n" threads: thread log: - join(dir_path+"/logs", "_".join(samples.bulk.drop_duplicates()) + "_uniqscaffold.log") + join(dir_path+"/logs", "_".join(samples.bulk.drop_duplicates()) + "_uniqscaffold_byfasta.log") shell:""" set +e bash {params.scriptdir}/getuniqscaffold_by_fasta.sh {input.fa} {params.database} {params.length} {params.genome} {threads} {params.datatype} {params.memory} {output.scaffold1} {output.scaffold2} {output.unmap1} {output.unmap2} > {log} 2>&1 diff --git a/tritimap/rules/denovo_scaffold_filter_by_region.smk b/tritimap/rules/denovo_scaffold_filter_by_region.smk index 08b8483..d6c76c8 100644 --- a/tritimap/rules/denovo_scaffold_filter_by_region.smk +++ b/tritimap/rules/denovo_scaffold_filter_by_region.smk @@ -19,7 +19,7 @@ rule uniqScaffoldByRegion: message: "\nGet uniq scaffolds by region file. Input file: {input.fa}\n" threads: thread log: - join(dir_path+"/logs", "_".join(samples.bulk.drop_duplicates()) + "_uniqscaffold.log") + join(dir_path+"/logs", "_".join(samples.bulk.drop_duplicates()) + "_uniqscaffold_byregion.log") shell:""" set +e cat {input.region} | tr ',' '\t' | awk '{{print $1"\tqtl\t"$2"\t"$3}}' > {output.region} diff --git a/tritimap/rules/dna_mapping.smk b/tritimap/rules/dna_mapping.smk index 0f6ad52..70f7b2a 100644 --- a/tritimap/rules/dna_mapping.smk +++ b/tritimap/rules/dna_mapping.smk @@ -13,15 +13,20 @@ rule dnaBWAmem2Mapping: errormap = dir_path+"/03_mappingout/{bulk}_{bulktype}.errormap.sort.bam", unmap = dir_path+"/03_mappingout/{bulk}_{bulktype}.unmap.bam" threads: thread + log: + dir_path+"/logs/{bulk}_{bulktype}_bwamem2.log" message: "Mapping {input} with BWA-mem2" run: shell(""" bwa-mem2 mem -v 1 -t {threads} -M -Y -R '{params.group}' {params.genome} {input} | \ - samtools sort -@ {threads} -o {output.raw} - ; - samtools view -h -f 3 {output.raw} | egrep -v 'XA:Z|SA:Z' | samtools sort -@ {threads} -o {output.truemap} ; - samtools view -h {output.raw} | egrep '^@|XA:Z|SA:Z' | samtools sort -@ {threads} -o {output.errormap} ; + samtools sort -@ {threads} -o {output.raw} -; + echo "raw.down" ; + samtools view -h -f 3 {output.raw} | egrep -v 'XA:Z|SA:Z' | samtools sort -@ {threads} -o {output.truemap} -; + echo "true.down" ; + samtools view -h {output.raw} | egrep '^@|XA:Z|SA:Z' | samtools sort -@ {threads} -o {output.errormap} -; + echo "error.down" ; samtools view -f 4 -b {output.raw} > {output.unmap} ; - samtools index -c {output.raw}; - samtools index -c {output.truemap}; - samtools index -c {output.errormap}; + samtools index -c {output.raw} ; + samtools index -c {output.truemap} ; + samtools index -c {output.errormap} """) \ No newline at end of file