shell中实现查找NDA的motif

 

001、

[root@pc1 test02]# ls
a.txt  test.sh
[root@pc1 test02]# cat a.txt       ## 测试序列
GATATATGCATATACTT
[root@pc1 test02]# cat test.sh     ## 计算程序
#!/bin/bash

length=$(awk '{print length}' a.txt)

for i in $(seq $length)
do
        let tmp=$i+3
        cut -c $i-$tmp a.txt | grep -x "ATAT" > /dev/null
        if [ $? -eq 0 ]
        then
                printf "%d\t" $i
        fi
done
printf "\n"
[root@pc1 test02]# bash test.sh     ## 计算结果
2       4       10

 。

 

posted @ 2023-09-07 10:24  小鲨鱼2018  阅读(7)  评论(0编辑  收藏  举报