InfoSeeker has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am confused about how to execute 'mass' commands when calling perl code in a shell script. I have around 30,000 DSSP files which I want to process within Perl. This entails creating a Bioperl DSSP object for every DSSP file that I will read. Part of the code (DSSP_output.pl) is as follows:
#!/usr/bin/perl -w use strict; use warnings; use Bio::Structure::SecStr::DSSP::Res; open (DSSPIN, "$ARGV[0]") || die $!; #Create a new DSSP object my $dssp_obj = new Bio::Structure::SecStr::DSSP::Res('-file'=>DSSPIN); # EXAMPLE OF HOW THE OBJECT IS NORMALLY DECLARED #my $dssp_obj = new Bio::Structure::SecStr::DSSP::Res('-file'=>'3bit.d +ssp'); #Get PDB ID and Compound representation for each DSSP file my $pdb_id = $dssp_obj->pdbID(); print "Analysis of PDB:: ". $pdb_id. "\n"; my $cmpd = $dssp_obj->pdbCompound(); print "Representing:: ". $cmpd. "\n"; etc...
My dilemma is as follows: In a shell script, I want to read a list of filenames and execute DSSP_output.pl for each file. I am using in shell this would translate to:
<some loop to read each dssp filename> dssp_output.pl filename.dssp <end loop>
Now how do I read each filename in perl? I can't use STDIN (I think) because I want this running automatically... the way I have written the code, DSSPIN produces the error:
Bareword "DSSPIN" not allowed when "strict subs" in use.If I try the following:
open (DSSPIN, <>) || die $!; my $dssp_obj = new Bio::Structure::SecStr::DSSP::Res('-file'=>DSSPIN);
Same error. And finally:
@data_from_files = <>; #Create a new DSSP object my $dssp_obj = new Bio::Structure::SecStr::DSSP::Res('-file'=>$data_fr +om_files); Error: Global system @data_from_files, $data_from_files requires expli +cit package name
Apologies for a long post...I'm just badly confused with filehandling! What should I write to read in the DSSP filenames in the perl script? Much obliged!
A very confused InfoSeeker
|
|---|