1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/bash
set -e
pkg=hisat2
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
# Double quote below to expand the temporary directory variable now versus
# later is on purpose.
# shellcheck disable=SC2064
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
cp /usr/share/doc/${pkg}/examples/* -a "${AUTOPKGTEST_TMP}"
cd "${AUTOPKGTEST_TMP}"
gunzip -r *
# Run the reproducible suite
hisat2-build reference/22_20-21M.fa --snp reference/22_20-21M.snp 22_20-21M_snp
# Aligning example reads
hisat2 -f -x index/22_20-21M_snp -U reads/reads_1.fa -S eg1.sam
# Paired-end example
hisat2 -f -x index/22_20-21M_snp -1 reads/reads_1.fa -2 reads/reads_2.fa -S eg2.sam
hisat2 -f -x index/22_20-21M_snp -1 reads/reads_1.fa -2 reads/reads_2.fa -S eg2.sam
# Convert to BAM
samtools view -bS eg2.sam > eg2.bam
# Sort the BAM file
samtools sort eg2.bam -o eg2.sorted.bam
# Generate the variant
bcftools mpileup -f reference/22_20-21M.fa eg2.sorted.bam | bcftools view - > eg2.raw.bcf
# View the variant
bcftools view eg2.raw.bcf
|