Exploring DNA Motifs with Custom Bash Script

gene_x 0 like s 369 view s

Tags: bash, Motif Discovery

#!/bin/bash

#./search_motif4.sh test1.fasta GRG 5

if [ $# -ne 3 ]; then
  echo "Usage: $0 <fasta_file> <motif> <context>"
  exit 1
fi

fasta_file=$1
motif=$2
context=$3

motif_regex=$(echo $motif | sed 's/R/[AG]/g' | sed 's/Y/[CT]/g' | sed 's/S/[GC]/g' | sed 's/W/[AT]/g' | sed 's/K/[GT]/g' | sed 's/M/[AC]/g' | sed 's/B/[CGT]/g' | sed 's/D/[AGT]/g' | sed 's/H/[ACT]/g' | sed 's/V/[ACG]/g')

grep -B1 -A1 -i -E -o ".{0,$context}${motif_regex}.{0,$context}" $fasta_file

like unlike

点赞本文的读者

还没有人对此文章表态


本文有评论

没有评论

看文章,发评论,不要沉默


© 2023 XGenes.com Impressum