Hello,
The general command for Hisat2 alignment is:
hisat2 --threads 8 -t -p 8 --summary-file summary_txt -x /hisat2_index/index -1 read1.fastq.gz -2 read2.fastq.gz -S aligned.sam
I use the following script to run my Hisat2 pipelines. The bam files I am getting are fine. My question is how can I get the summary file for alignment too? How to frame the output to capture the summary.txt files for each alignment?
HISAT2_INDEX_PREFIX = "/hisat2_index/index"
SAMPLES, *_=glob_wildcards('/samples/{sample}.read1.fastq.gz')
rule align_all_samples:
input: expand("samples/{sample}.bam", sample=SAMPLES)
rule align_hisat2:
input:
hisat2_index=expand(f"{HISAT2_INDEX_PREFIX}.{{ix}}.ht2", ix=range(1, 9)),
fastq1="/samples/{sample}.read1.fastq.gz",
fastq2="/samples/{sample}.read2.fastq.gz",
output:
bam = "/samples/align_hisat2_update1/{sample}.bam",
log: "/samples/snakemake_log.txt"
threads: 8
shell:
"hisat2 -p {threads} -x {HISAT2_INDEX_PREFIX}"
" -1 {input.fastq1} -2 {input.fastq2} |"
"samtools sort -@ {threads} -o {output.bam}"
I tried taking another output variable like summary file under the outputs section, but that gives me error! Can I club two different types of output files in the rule_all?
Thanks, Payal
Isn't that printed to
stderr
? So just redirect that to a new file.I am sorry, didn't understand. Can you please elaborate?
Please google what
stderr
is in the Unix world and how you can save things printed to screen to a file. https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-fileThank you Devon and AT.
I see what you are saying. I will try this. Will this output all sample summaries in one summary file like a log file or individual samples will output their individual summary report?