Skip to content

Commit

Permalink
replace lofreq test data
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Feb 15, 2024
1 parent 6c18541 commit f5b9dbf
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 667,575 deletions.
19 changes: 16 additions & 3 deletions src/lofreq/indelqual/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ set -e

dir_in="${meta_resources_dir%/}/test_data"

#############################################
mkdir uniform
cd uniform

echo "> Run lofreq indelqual uniform"
"$meta_executable" \
--input "$dir_in/a.bam" \
--input "$dir_in/test.bam" \
-u 15 \
--out "uniform.bam" \

Expand All @@ -16,10 +20,16 @@ echo ">> Checking output"
echo ">> Check if output is empty"
[ ! -s "uniform.bam" ] && echo "Output file uniform.bam is empty" && exit 1

cd ..

#############################################
mkdir dindel
cd dindel

echo "> run lofreq indelqual dindel"
"$meta_executable" \
--input "$dir_in/a.bam" \
--ref "$dir_in/hg38_chr21.fa" \
--input "$dir_in/test.bam" \
--ref "$dir_in/test.fa" \
--dindel \
--out "dindel.bam"

Expand All @@ -29,5 +39,8 @@ echo ">> Checking output"
echo ">> Check if output is empty"
[ ! -s "dindel.bam" ] && echo "Output file dindel.bam is empty" && exit 1

cd ..

#############################################

echo "> Test successful"
278 changes: 0 additions & 278 deletions src/lofreq/indelqual/test_data/a.bam

This file was deleted.

667,287 changes: 0 additions & 667,287 deletions src/lofreq/indelqual/test_data/hg38_chr21.fa

This file was deleted.

1 change: 0 additions & 1 deletion src/lofreq/indelqual/test_data/hg38_chr21.fa.fai

This file was deleted.

46 changes: 40 additions & 6 deletions src/lofreq/indelqual/test_data/script.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,44 @@
# pear test data
#!/bin/bash

# Test data was obtained from https://github.com/snakemake/snakemake-wrappers/tree/master/bio/lofreq/indelqual/test/data
set -e

if [ ! -d /tmp/snakemake-wrappers ]; then
git clone --depth 1 --single-branch --branch master https://github.com/snakemake/snakemake-wrappers /tmp/snakemake-wrappers
fi
TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT

cp -r /tmp/snakemake-wrappers/bio/lofreq/indelqual/test/data/* src/lofreq/indelqual/test_data
### Step 1: Generate Test Reference FASTA File (`test.fa`)

cat > $TMPDIR/test.fa <<EOF
>chr1
AACTCTCCGTGCTGTCCGGGGTCACTGTGATGCCAGTGCCGTCGACGGACCACAGGAGCGCCGCCAATTACGATTTATA
GGCGGCCCGGCCGATTATATCTTTGGCGGTCCCCTAGGCTCTCTAGGGGCCCGCACTGAAGAGGGCAACTCTGCAAGGA
CACGAATCTGACTCCTTAATAAAGGTGTGAAATCTGTCCGGTCGTCTCCTAATATGGGGCTTCATCATCTCAGGCGAAA
TCAGCGCCCGACGGGCCATAGTAAGCGGTGTTGTGGCATAGGTGCAGGTGGCCACCGATTATAACAGGATGACATACGC
GGAATTCGGGGTATGATGCTCTCCCGACACTTTGAGACAATAAATAGTTTAGTGTCCTGATGGTCTAAACCGAAGTCAT
TCAAAATAGCTAAGTGTAGTCTTCCCGTTCTAGGGATAGTCTAGGACATGCCCTATATTGGTTTTCTCTTACCGCGGAC
TACTCCCGCGCCCTCGGAGGTGTCTCAATTCATCCATGTTGATCCTTCAAATCGGGGCAGCGACGGGGGCACGGAGGGG
GTACGATAACCGCTAAATTGACCACCACCATCGATGATTCTACCATCTCTATCCATCCAACCCTTTTTTTGTTTATTTC
CTCTATGGGTTACAGCTA
EOF

### Step 2: Index the Reference FASTA File

samtools faidx $TMPDIR/test.fa

### Step 3: Generate Test Reads with `wgsim`

wgsim -N 100 -1 70 -2 70 $TMPDIR/test.fa $TMPDIR/reads1.fq $TMPDIR/reads2.fq

### Step 4: Align Reads to Generate BAM File

bwa index $TMPDIR/test.fa

bwa mem $TMPDIR/test.fa $TMPDIR/reads1.fq $TMPDIR/reads2.fq > $TMPDIR/aligned_reads.sam

### Step 5: Convert SAM to BAM, Sort, and Index

samtools view -Sb $TMPDIR/aligned_reads.sam > $TMPDIR/test.bam

### Step 6: Copy output

cp $TMPDIR/test.bam src/lofreq/indelqual/test_data/test.bam
cp $TMPDIR/test.fa src/lofreq/indelqual/test_data/test.fa
Binary file added src/lofreq/indelqual/test_data/test.bam
Binary file not shown.
10 changes: 10 additions & 0 deletions src/lofreq/indelqual/test_data/test.fa
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
>chr1
AACTCTCCGTGCTGTCCGGGGTCACTGTGATGCCAGTGCCGTCGACGGACCACAGGAGCGCCGCCAATTACGATTTATA
GGCGGCCCGGCCGATTATATCTTTGGCGGTCCCCTAGGCTCTCTAGGGGCCCGCACTGAAGAGGGCAACTCTGCAAGGA
CACGAATCTGACTCCTTAATAAAGGTGTGAAATCTGTCCGGTCGTCTCCTAATATGGGGCTTCATCATCTCAGGCGAAA
TCAGCGCCCGACGGGCCATAGTAAGCGGTGTTGTGGCATAGGTGCAGGTGGCCACCGATTATAACAGGATGACATACGC
GGAATTCGGGGTATGATGCTCTCCCGACACTTTGAGACAATAAATAGTTTAGTGTCCTGATGGTCTAAACCGAAGTCAT
TCAAAATAGCTAAGTGTAGTCTTCCCGTTCTAGGGATAGTCTAGGACATGCCCTATATTGGTTTTCTCTTACCGCGGAC
TACTCCCGCGCCCTCGGAGGTGTCTCAATTCATCCATGTTGATCCTTCAAATCGGGGCAGCGACGGGGGCACGGAGGGG
GTACGATAACCGCTAAATTGACCACCACCATCGATGATTCTACCATCTCTATCCATCCAACCCTTTTTTTGTTTATTTC
CTCTATGGGTTACAGCTA

0 comments on commit f5b9dbf

Please sign in to comment.