In addition to the comments made by David, it appears the line:

open FASEQ, "<", $files or die "can not read open $!";

is not needed. The file handle FASEQ is never used in an input operation.
You want to use the file name as noted by David.

Ken


On Thu, Oct 10, 2019 at 4:06 AM 刘东 <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
> ......
>
>
>
>
>
> --
> 湖南师范大学生命科学院:刘 东
>
> *格言:*积土而为山,积水而为海;
>     知识在于积累,成功在于勤奋。
>
>
>
>

Reply via email to