16 lines
488 B
Bash
16 lines
488 B
Bash
#! /usr/bash
|
|
if [ "$#" -ne 5 ]; then
|
|
echo "Usage: $0 <reference_genome> <fastq_1> <fastq_2> <output_directory> <stem>"
|
|
exit 1
|
|
fi
|
|
ref=$1
|
|
fq1=$2
|
|
fq2=$3
|
|
outdir=$4
|
|
stem=$5
|
|
mkdir -p "$outdir"
|
|
hisat -p 4 --dta -x "$ref" -1 "$fq1" -2 "$fq2" -S "${outdir}/${stem}.sam"
|
|
samtools view -b -@ 4 "${outdir}/${stem}.sam" | samtools sort -@ 4 -o "${outdir}/${stem}.sorted.bam" --write-index
|
|
rm "${outdir}/${stem}.sam"
|
|
echo "Mapping completed. Sorted BAM file is at ${outdir}/${stem}.sorted.bam"
|