Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: how can I combine into one method

by thunders (Priest)
on May 05, 2009 at 17:53 UTC ( #761996=note: print w/replies, xml ) Need Help??

in reply to how can I combine into one method

I think you want something more like this. I'm guessing a little on some of the code. Otherwise I factored out all the common code, which as far as I can tell is everything but the url.
sub blast_hu_parse { my($maid,$maid_dir) = @_; my $url_hu = "http://hu_seq/"; blast_parse($maid,$maid_dir,$url_hu); } sub blast_hd_parse { my($maid,$maid_dir) = @_; my $url_hd = "http://hd_seq/"; blast_parse($maid,$maid_dir,$url_hd); } sub blast_parse{ my($maid,$maid_dir,$url) = @_; my $h_file = get($url.$maid); my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa"; #what is $hu where is it declared? #open ($hu); #what is $in where is it declared my $seq=<$in>; close($in); open (my $hu, ">".$maid.".fa"); print $hu ">$maid\n$seq"; close($hu); # syntax # bl2seq -p blastn -i nucleotide1 -j nucleotide2 -F F -D 1 my $command = "bl2seq -p blastn -i $ltvec_small -j $h_file -F F -D + +1"; print $command,"\n"; open OUTPUT, '>', "$maid_dir\\".$maid."_bl2seq.out" ; STDOUT->fdopen( \*OUTPUT, 'w'); system($command); bl2seq_parse(); }

update added some comment on the file handling stuff, which appears to have some errors, after looking over the original again

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://761996]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2016-10-21 13:07 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (289 votes). Check out past polls.