Is there any othere way to do it;

R

Rita

Hi All,
I am getting some result through loop.I want to store all the result
which i am getting.
but i am using temprary file ,so it is using same file every time,and i
couldnt figure out that how i can store the result in 1 file every
time. Here is my program.

use warnings;
use strict;
use Bio::SeqIO;
use Bio::SearchIO;


my $outputfile = 'result.out';
open OUTPUT3 '>', $outputfile || die "Can't open \"$outputfile\" $!";

my $filename = 'file.fasta';

#either open the file, or exit from the program
open FILE,$filename ||die "Cannot open file \"$filename\"\n\n $!";
<FILE>;
#Read the all data of the file in variable called $line;
while(my $line =<FILE>){
#Remove the white space or new line from the data
chomp $line;

(my ( $sequence) = (split /\t/, $line)[4]);
print "Sequence - $sequence\n\n";
my $seqio = Bio::SeqIO-> new(-file =>'>temp1',-format=>'fasta');
$sequence = Bio::Seq-> new(-seq => $sequence, -display_id=>'test1');
$seqio->write_seq($sequence);

system ("mfold SEQ='temp1'");
This mfold generate output in file called "temp1.out"
I tried this line but this is just printing text temp1.out every time
in 'result.out'.
print OUTPUT3 'temp1.out';
}

Inputs are some sequences -

Thanks
 
R

Rita

You have two problems on this line. You need a comma after OUTPUT3;
without it the line will not compile. Please post real code that
compiles. You also have a precedence problem. See 'perldoc perlopentut'
and look at the examples under 'Simple Opens'. Either put paenheses
around (OUTPUT3 '>', $outputfile) or replace || with or. Thanks.


Please do not include comments like this when you post a program.
Anybody who is able to help you will already know what the following
line does. The comment just gets in the way of comprehending your
program.

Sorry for the inconvieniance.
If you are going to put comments inside your program, at least make
them valid Perl comments by prefixing them with '#'.

That is not my programm comment ,that i just explaned to you.
You are telling Perl to write the string 'temp1.out' to the file each
time through the loop, and this is what it does. If you want to append
the contents of temp1.out to the file result.out, you can either tell
the operating system to do it:

system("cat temp1.out >> result.out");

or tell Perl to do it (untested):

open( my $rpt, 'temp1.out') or die("Can't open temp1.out: $!);
while(<$rpt>) {
print OUTPUT3;
}
close($rpt) or die ...;


It is difficult for someone who doesn't have your data, doesn't have
the Bio::SeqIO or Bio::SearchIO modules installed, and doesn't have the
mfold program on their system to run your program and tell what is
wrong. Please work on decomposing your problems and posting only those
parts with which you are having trouble. Eliminate the other parts,
replacing them with stubs or simple assignments. Doing so will increase
the probability of getting help.

Of course, you have been given this advice many times in the past and
either misunderstood or ignored it. Perhaps repeating it one more time
will help.

Good luck!

Thanks,Next time i will be take care and I really appritiated for
help,though my way of asking question is not good.Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top