Re: [問題] 想請問一個生物資訊問題 如何找ㄧ串mo …
※ 引述《mzac1b (Goodday)》之銘言:
: --------------------------------------
: [問題]
: 蛋白質序列 -------------motif--motif--motif--motif--motif-----------
: 其中motif 與motif 間隔約10 個胺基酸
: 且一個蛋白質可能不只一串motif
: 我要取每一串的第一個motif 那要怎麼寫呢 ??
: --------------------------------------
: 我學perl 一個多月
: 主要看 Beginning perl for bioinformaitcs
: 這本書只有講用
: $protein =~ /$motif/
: 來找含 motif 之蛋白
: 我聽說能直接指定一串motif中我要的第n 個
: 懇請賜教~~~~
直接取第一個motif
$seq = "-----------motif--motif--motif";
$motif = "xxx";
print $1 if($seq =~/($motif)/) #取第一個結果並印出
要取第n個
@motifs = ($seq =~/$motif/g);
print $motif[$n-1]; #取第n個結果印出
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.129.166.240
討論串 (同標題文章)
Perl 近期熱門文章
PTT數位生活區 即時熱門文章