Created
June 25, 2021 15:20
-
-
Save telatin/9b0834bd8ebba0fa214b921d542cd719 to your computer and use it in GitHub Desktop.
Remove primers from paired end reads using Cutadapt and SeqFu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
FOR=CCTACGGGNGGCWGCAG | |
REV=GGACTACHVGGGTATCTAATCC | |
# Cutadapt options | |
MINL=250 | |
EXTRA=" --report minimal --cores 0 --discard-untrimmed " | |
# Compute RC | |
FORRC=$(seqfu rc $FOR) | |
REVRC=$(seqfu rc $REV) | |
# CHECK | |
CUTADAPT=$(cutadapt --version) | |
SEQFU=$(seqfu | grep version | cut -f 2 -d :) | |
# Print versions | |
echo CUTADAPT: $CUTADAPT | |
echo SEQFU: $SEQFU | |
if [[ ! -z ${3+z} ]]; then | |
R1=$1 | |
R2=$2 | |
OUTDIR=$3 | |
mkdir -p "$OUTDIR" | |
B1=$(basename $R1) | |
B2=$(basename $R2) | |
echo "CUTADAPT $B1" | |
cutadapt -a "${FOR}...${REVRC}" -A "${REV}...${FORRC}" $EXTRA \ | |
--minimum-length $MINL \ | |
-o "$OUTDIR"/$B1 -p "$OUTDIR"/$B2 $R1 $R2 | |
else | |
echo USAGE: file_R1 file_R2 outdir | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment