Skip to content

Commit

Permalink
add samtools stats rule - connect with multiqc
Browse files Browse the repository at this point in the history
  • Loading branch information
borauyar committed Apr 19, 2018
1 parent f5cb356 commit 8ecadc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Binary file modified dag.pdf
Binary file not shown.
17 changes: 14 additions & 3 deletions pigx_crispr.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def get_output_file_list(DIR, ext):
get_output_file_list(TRIMMED_READS_DIR, "fastq.gz"),
get_output_file_list(MAPPED_READS_DIR, "sam"),
get_output_file_list(MAPPED_READS_DIR, "bam"),
get_output_file_list(MAPPED_READS_DIR, "bam.bai"),
get_output_file_list(MAPPED_READS_DIR, "bam.bai"),
get_output_file_list(MAPPED_READS_DIR, "samtools.stats.txt"),
get_output_file_list(os.path.join(MAPPED_READS_DIR, "mpileup"), "mpileup.tsv"),
get_output_file_list(os.path.join(MAPPED_READS_DIR, "mpileup"), "mpileup.counts.tsv"),
get_output_file_list(BEDGRAPH_DIR, "deletionScores.bedgraph"),
Expand Down Expand Up @@ -130,7 +131,16 @@ def get_output_file_list(DIR, ext):
output: os.path.join(MAPPED_READS_DIR, "{amplicon}", "{sample}.bam.bai")
log: os.path.join(LOG_DIR, "{amplicon}", "samtools_index_{sample}.log")
shell: "samtools index {input} >> {log} 2>&1"


rule samtools_stats:
input:
bamfile = os.path.join(MAPPED_READS_DIR, "{amplicon}", "{sample}.bam"),
ref = lambda wildcards: get_amplicon_file(wildcards, 'fasta')
output: os.path.join(MAPPED_READS_DIR, "{amplicon}", "{sample}.samtools.stats.txt")
log: os.path.join(LOG_DIR, "{amplicon}", "samtools_stats.{sample}.log")
shell: "samtools stats --reference {input.ref} {input.bamfile} > {output} 2> {log}"


rule parse_mpileup:
input: os.path.join(MAPPED_READS_DIR, "mpileup", "{amplicon}", "{sample}.mpileup.tsv")
output: os.path.join(MAPPED_READS_DIR, "mpileup", "{amplicon}", "{sample}.mpileup.counts.tsv")
Expand All @@ -142,7 +152,8 @@ def get_output_file_list(DIR, ext):
rule multiqc:
input:
fastqc = get_output_file_list(FASTQC_DIR, "fastqc.done"),
trimmomatic = get_output_file_list(TRIMMED_READS_DIR, "fastq.gz")
trimmomatic = get_output_file_list(TRIMMED_READS_DIR, "fastq.gz"),
samtools = get_output_file_list(MAPPED_READS_DIR, "samtools.stats.txt")
output:
os.path.join(OUTPUT_DIR, "multiqc", "multiqc_report.html")
params:
Expand Down

0 comments on commit 8ecadc3

Please sign in to comment.