Skip to content

Instantly share code, notes, and snippets.

@mbk0asis
Created May 31, 2018 04:58
Show Gist options
  • Save mbk0asis/214560e6d5f679e13d8ec70ac696e6f0 to your computer and use it in GitHub Desktop.
Save mbk0asis/214560e6d5f679e13d8ec70ac696e6f0 to your computer and use it in GitHub Desktop.
To profile the INDEL patterns in amplicon sequncing reads
printf "\nINDEL.profiler\n\n usage: ./INDEL.profiler.sh READs.fasta Amplicon.seq.fasta\n\n"
cat $1 | \
while read l; do
printf " \n"
read L
echo $l $L | sed 's/ /\n/g' | cat - $2 | muscle -quiet | fasta_formatter | \
while read c; do
printf "\n"$c"\nDEL:\n"
read d;
echo $d | grep -bo "-" | cut -d: -f1 | \
awk 'NR==1 {a=$1;b=$1;next} ($1 != b+1){print a+1"-"b+1; a=$1} {b=$1} END{print a+1"-"b+1}'
read e
printf $e"\nINS:\n"
read f
echo $f | grep -bo "-" | cut -d: -f1 | \
awk 'NR==1 {a=$1;b=$1;next} ($1 != b+1){print a+1"+"b+1; a=$1} {b=$1} END{print a+1"+"b+1}'
done | grep -v ">" | paste -s -d" "
done | sort | uniq -c | sort -rh > $1.INDEL.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment