B
BD
Hi All,
I am trying to make program that has First Input file like
OPPPPPPPPPPPPPPRRRRRSSSSSS
and second Inputfile like
PPPPPPPPPPPPPPRRRRRSSSSSS
now I wrote a script which take data from second Input file and match
motif with First Input file and where it match print that header
Like here it match at second Sequence so in Output it should print
seq2
here is my code :
use warnings;
use strict;
my $filename ='file1.txt';
open FILE1,$filename or die "Cannot open file $filename \n $!";
my @seq=<FILE1>;
my $header=' ';
my $Seq=' ' ;
my $i=0;
my (@Header,@Sequence);
foreach my $line (@seq){
chomp $line;
if ($line =~ /^>/){
$i++;
$Header[$i]=$header.$line;
}else{
$Sequence[$i]=$Seq.$line;
}
}
my $Input='file2.txt';
open FILE2,$Input or die "Cannot open file $Input \n $!";
<FILE2>;
my $motif = <FILE2>;
if ($Sequence[$i] =~ /$motif/ ){
print "$Header[$i] \n";
}
else{
print "I couldnot found it.\n";
print $i,"\n";
}
I am getting output that I couldnot found it.
If anybody can help me to get Output or debugging my Code?
I will really appreciate.
Thanks.
I am trying to make program that has First Input file like
KKKKKKKKLLLLLLLLLMMMMMMMMMMMMNNNNNNNOOOOOOOOOOOOOseq1 AAAAAAAAAAABBBBBBBBBBCCCCCCCCCCCCCCCCCCCDDDDDDDD
DDDDDDDDEEEEEEEFFFFFFFFFFFFFFF
seq2
OPPPPPPPPPPPPPPRRRRRSSSSSS
and second Inputfile like
KKKKKKKKLLLLLLLLLMMMMMMMMMMMMNNNNNNNOOOOOOOOOOOOOOseq1
PPPPPPPPPPPPPPRRRRRSSSSSS
now I wrote a script which take data from second Input file and match
motif with First Input file and where it match print that header
Like here it match at second Sequence so in Output it should print
seq2
here is my code :
use warnings;
use strict;
my $filename ='file1.txt';
open FILE1,$filename or die "Cannot open file $filename \n $!";
my @seq=<FILE1>;
my $header=' ';
my $Seq=' ' ;
my $i=0;
my (@Header,@Sequence);
foreach my $line (@seq){
chomp $line;
if ($line =~ /^>/){
$i++;
$Header[$i]=$header.$line;
}else{
$Sequence[$i]=$Seq.$line;
}
}
my $Input='file2.txt';
open FILE2,$Input or die "Cannot open file $Input \n $!";
<FILE2>;
my $motif = <FILE2>;
if ($Sequence[$i] =~ /$motif/ ){
print "$Header[$i] \n";
}
else{
print "I couldnot found it.\n";
print $i,"\n";
}
I am getting output that I couldnot found it.
If anybody can help me to get Output or debugging my Code?
I will really appreciate.
Thanks.