sub convert_raw_to_fasta { my $InFileName = shift; my $OutFileNameBase = shift or die "Missing argument(s)!"; open $hu, '<', $InFileName or die $!; my $seq=<$hu>; close $hu or die $!; open $hu, '>', $OutFileNameBase . ".fa" or die $!; print $hu ">$maid\n$seq"; close $hu or die $!; } #### sub blast_parse{ my($maid,$maid_dir) = @_; my $url_hu = "http://hu_seq/"; my $hu = get($url_hu.$maid); my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa"; convert_raw_to_fasta($hu, $maid); # syntax # bl2seq -p blastn -i nucleotide1 -j nucleotide2 -F F -D 1 my $command = "bl2seq -p blastn -i $ltvec_small -j $hu_fa -F F -D 1"; print $command,"\n"; open OUTPUT, '>', "$maid_dir\\".$maid."_bl2seq.out" ; STDOUT->fdopen( \*OUTPUT, 'w'); system($command); bl2seq_parse(); } sub blast_hd_parse{ my($maid,$maid_dir) = @_; my $url_hd = "http://hd_seq/"; my $hd = get($url_hd.$maid); my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa"; convert_raw_to_fasta($hu, $maid); my $command = "bl2seq -p blastn -i $ltvec_small -j $hd_fa -F F -D 1"; print $command,"\n"; open OUTPUT, '>', "$maid_dir\\".$maid."_bl2seq.out" ; STDOUT->fdopen( \*OUTPUT, 'w'); system($command); bl2seq_parse(); } #### sub process_and_parse { my $command = shift; my $output_file = shift or die "Missing argument(s)!"; print $command,"\n"; open OUTPUT, '>', $output_file or die $!; STDOUT->fdopen( \*OUTPUT, 'w'); system($command); bl2seq_parse(); } #### sub blast_parse{ my($maid,$maid_dir) = @_; my $url_hu = "http://hu_seq/"; my $hu = get($url_hu.$maid); my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa"; convert_raw_to_fasta($hu, $maid); process_and_parse( "bl2seq -p blastn -i $ltvec_small -j $hu_fa -F F -D 1", "$maid_dir/" . $maid . "_bl2seq.out" ); } sub blast_hd_parse{ my($maid,$maid_dir) = @_; my $url_hd = "http://hd_seq/"; my $hd = get($url_hd.$maid); my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa"; convert_raw_to_fasta($hu, $maid); process_and_parse( "bl2seq -p blastn -i $ltvec_small -j $hd_fa -F F -D 1", "$maid_dir/" . $maid . "_bl2seq.out" ); } #### # main task initialize_frobnitz(); generate_zanzibar(); show_results(); sub initialize_frobnitz { my $frobber = allocate_frobnitz(1); send_to_frobber($frobber, 'INIT') or die "Can't initialize frobber!"; send_to_frobber($frobber, 'configuration value 1') or die "Can't configure frobber!"; } sub send_to_frobber { my $serial_port = ... etc ...