185185 # # fixed the issue of long proteins with best total hmm bit score but very poor domain scores. Allow now the option to sort
186186 # # hmmsearch output according to the best domain bit score. The current routine assumes that neither query nor
187187 # # hit has whitespaces in their names
188+
189+ # # 14.04.2020 (Vinh)
190+ # # Bug fix (solved): existing symbolic link cannot recognized while checking the reference fasta file
191+
188192# ####################### start main ###########################################
189- my $version = " HaMStR v.13.2.10 " ;
193+ my $version = " HaMStR v.13.2.11 " ;
190194# ####################### checking whether the configure script has been run ###
191195my $configure = 0;
192196if ($configure == 0){
195199# ######### EDIT THE FOLLOWING LINES TO CUSTOMIZE YOUR SCRIPT ##################
196200my $prog = ' hmmsearch' ; # program for the hmm search
197201my $eval = 1; # default evalue cutoff for the hmm search
198- my $sedprog = ' sed ' ;
199- my $grepprog = ' grep ' ;
202+ my $sedprog = ' gsed ' ;
203+ my $grepprog = ' ggrep ' ;
200204my $alignmentprog = ' clustalw' ;
201205my $alignmentprog_co = ' muscle' ;
202206# ######### EDIT THE FOLLOWING TWO LINES TO CHOOSE YOUR BLAST PROGRAM ##########
@@ -1158,12 +1162,19 @@ sub checkInput {
11581162 push @log , " \n CHECKING FOR REFERENCE FASTA FILES\n " ;
11591163 for (my $i = 0; $i < @refspec ; $i ++) {
11601164 my $referencedb = " $blastpath /$refspec [$i ]/$refspec [$i ]" ." .fa" ;
1161- my $referencedb_prot = " $blastpath /$refspec [$i ]/$refspec [$i ]" ." _prot.fa" ; # backward compatibility
1165+ my $referencedb_prot = " $blastpath /$refspec [$i ]/$refspec [$i ]" ." _prot.fa" ; # backward compatibility
11621166 my $ref_dir = " $blastpath /$refspec [$i ]" ;
1163- my $link = ` readlink $referencedb ` ;
1164- my $ref_location = $referencedb ;
1167+ my $link = $referencedb ;
1168+ unless (-e $referencedb ) {
1169+ $link = ` readlink $referencedb ` ;
1170+ unless ($link =~ / ^\. / || $link =~ / ^\/ / ) {
1171+ my $cwd = cwd();
1172+ die " Linked source for $referencedb not found in $cwd !" ;
1173+ }
1174+ }
1175+ # my $ref_location = $referencedb; # not used anywhere else
11651176 chomp ($link );
1166- if (-e " $referencedb " ) {
1177+ if (-e $referencedb || -e $link ) {
11671178 if (defined $link ){
11681179 # link to file (.fa)
11691180 my $cwd = cwd();
@@ -1195,7 +1206,7 @@ sub checkInput {
11951206 }
11961207 }
11971208
1198- }elsif (-e " $referencedb_prot " ){
1209+ } elsif (-e " $referencedb_prot " ){
11991210 # checking files
12001211 if (-e " $referencedb_prot .mod" ) {
12011212 push @log , " \t A infile is already modified: linked $referencedb .mod existst. Using this one" ;
@@ -1221,7 +1232,7 @@ sub checkInput {
12211232 }
12221233 }
12231234
1224- } else {
1235+ } else {
12251236 # the provided reference fasta file does not exist or link to file does not exist:
12261237 push @log , " ${bold} FATAL:${norm} FASTA file for the specified reference $refspec [$i ] does not exist. PLEASE PROVIDE A VALID REFERENCE SPECIES!\n " ;
12271238 $check = 0;
0 commit comments