1
패턴을위한 뉴클레오티드 문자열 내에서 검색하기 위해 Perl 스크립트를 작업 중입니다. 지금까지 다음 정규 표현식을 사용할 수있었습니다문자열 내 불완전하고 완벽한 패턴 찾기
my $regex1 = qr/(([ACGT]{2}) \2{9,})/x;
my $regex2 = qr/(([ACGT]{3}) \2{6,})/x;
my $regex3 = qr/(([ACGT]{4}) \2{6,})/x;
for my $regex ($regex1, $regex2, $regex3) {
next unless $seq1 =~ $regex;
printf "Matched %s exactly %d times\n", $2, length($1)/length($2);
printf "Length of sequence: $number \n";
}
어떻게하면 다음 작업을 수행 할 수 있습니까?
완벽한 (반복없이 반복됨) 및 불완전한 (반복되지만, 반복의 문자열을 뉴클레오타이드에 의해 분해 할 수 있음) 최소 10 회의 반복이 필요함.
전체 발견 순서를 -print
시료 입력 - 전체에서 GTCGTGTGTGTGTAGTGTGTGTGTGTGAACTGA
현재 스크립트
print "Di-, Tri-, Tetra-nucleotide Tandem Repeat Finder v1.0 \n\n";
print "Please specify the file location (DO NOT DRAG/DROP files!) then press ENTER:\n";
$seq = <STDIN>;
#Remove the newline from the filename
chomp $seq;
#open the file or exit
open (SEQFILE, $seq) or die "Can't open '$seq': $!";
#read the dna sequence from the file and store it into the array variable @seq1
@seq1 = <SEQFILE>;
#Close the file
close SEQFILE;
#Put the sequence into a single string as it is easier to search for the motif
$seq1 = join('', @seq1);
#Remove whitespace
$seq1 =~s/\s//g;
#Count of number of nucleotides
#Initialize the variable
$number = 0;
$number = length $seq1;
#Use regex to say "Find 3 nucelotides and match at least 6 times
# qr(quotes and compiles)/(([nucs]{number of nucs in pattern}) \2{number of repeats,}/x(permit within pattern)
my $regex1 = qr/(([ACGT]{2}) \2{9,})/x;
my $regex2 = qr/(([ACGT]{3}) \2{6,})/x;
my $regex3 = qr/(([ACGT]{4}) \2{6,})/x;
#Tell program to use $regex on variable that holds the file
for my $regex ($regex1, $regex2, $regex3) {
next unless $seq1 =~ $regex;
printf "Matched %s exactly %d times\n", $2, length($1)/length($2);
printf "Length of sequence: $number \n";
}
exit;
아마도 일부 샘플 입력/출력 및 테스트 사례를 포함해야합니다. – TLP
그리고이 샘플 입력에서 원하는 출력은 무엇입니까? 당신은 모든 사람이 생물학 용어와 DNA 전문 용어에 익숙하지 않다는 것을 알아야합니다. – TLP
네 말이 맞아. 미안해. 나는 두 개의 뉴클레오타이드가 반복되는 요소인지, 반복이 몇 번이나 발견되었는지, 전체 시퀀스 (반복이 시작되는 곳에서부터 반복이 끝나는 곳까지)를 알기 위해 결과를 필요로 할 것입니다. – Citizin