The error message "FASEQ can not open" doesn't look like something
which could be output by the code you've provided.

*Either* you should get the "can not read open $!" message (where the
$! will be interpolated to the reason it failed), or the message is
coming from whatever the "usearch" tool you're executing is.

Have your script print out the ./usearch invocation instead of running
it, then try running it yourself - if you get the same error then you
at least know that it's not coming from your script.

My guess - did you mean "-ublast FASEQ" to be replaced by the name of
the file you're reading - e.g. "-ublast $files" ? 

Likewise, the "-userout OUTFILE" part of the usearch invocation looks
like you may have intended that to be the output filename, e.g.
"-userout $filename.txt" or similar?

(Incidentally, the var name $files when it holds the singular filename
for each iteration irks me - that'd read much better as e.g.:

for my $filename (glob("$dir/*.fa")) {
    ...
}


On Thu, 10 Oct 2019 10:21:45 +0800 (CST) 刘东 <liudong...@163.com>
wrote:

> hellow:
> I have written a script, but it does not work, can you tell me what
> wrong with me?
> 
> 
> #! /usr/bin/perl
> 
> use strict;
> use warnings;
> use Getopt::Long;
> 
> my ($dir, $files, $file_name, $file_format, $file_dir, $file_main);
> 
> GetOptions ('dr=s'  =>\$dir);
> 
> open INF,"<",'sine.fa' or die "can't read open sine";
> 
> foreach $files (glob("$dir/*.fa")) {
> open FASEQ, "<", $files or die "can not read open $!";
>   ($file_dir, $file_main) = split (/\/\//,$files);
>   ($file_name,$file_format) =split(/\./,$file_main);
> open OUTFILE, '>', $file_name.".txt";
> `./usearch -ublast FASEQ -db INF -evalue 1e-5 -userout OUTFILE
> -strand both -userfields
> query+qlo+qhi+ql+qs+qstrand+target+tlo+thi+tl`; }
> 
> close FASEQ;
> close OUTFILE;
> close INF;
> 
> 
> 
> when I run the script, and the results is "FASEQ can not open".
> additional, the results from glob as follows:
> ./fadata//carp-carp01_TKD181002053-1_1.fa
> ./fadata//carp-carp01_TKD181002053-1_2.fa
> ......
> 
> 
> 
> 
> 
> 
> 
> --
> 
> 湖南师范大学生命科学院:刘 东
>  
> 格言:积土而为山,积水而为海;
>     知识在于积累,成功在于勤奋。

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to