Print only '+' or '-' if string matches (two files)

I would like to add two additional conditions to the actual code I have: print '+' if in File2 field 5 is greater than 35 and also field 7 is grater than 90.

while read -r line
do
    grep -q "$line" File2.txt && echo "$line +" || echo "$line -"
done < File1.txt '

Input file 1:

HAPS_0001
HAPS_0002
HAPS_0005
HAPS_0006
HAPS_0007
HAPS_0008
HAPS_0009
HAPS_0010

Input file 2 (tab-delimited):

Query	DEG_ID	E-value	Score	%Identity	%Positive	%Matching_Len
HAPS_0001	protein:plasmid:149679	3.00E-67	645	45	59	91
HAPS_0002	protein:plasmid:139928	4.00E-99	924	34	50	85
HAPS_0005	protein:plasmid:134646	3.00E-98	915	38	55	91
HAPS_0006	protein:plasmid:111988	1.00E-32	345	33	54	86
HAPS_0007	-	-	0	0	0	0
HAPS_0008	-	-	0	0	0	0
HAPS_0009	-	-	0	0	0	0
HAPS_0010	-	-	0	0	0	0

Desired output (tab-delimited):

HAPS_0001	+
HAPS_0002	-
HAPS_0005	+
HAPS_0006	-
HAPS_0007	-
HAPS_0008	-
HAPS_0009	-
HAPS_0010	-

Thanks!

You can do all of this using a single awk script instead of "while grep and echo"...

Try:

awk '$5>35&&$7>90{print $1,"+";next}{print $1,"-"}' File2.txt

Bash approach:

#!/bin/bash

declare -A ARR

while read line
do
        ARR["$line"]="$line"
done < File1.txt

while read query degid eval scr iden post matc
do
        [[ "$query" =~ ^Query ]] && continue
        if [ ! -z ${ARR["$query"]} ]
        then
                if [ $iden -gt 35 ] && [ $matc -gt 90 ]
                then
                        printf "%s\t+\n" "$query"
                else
                        printf "%s\t-\n" "$query"
                fi
        fi
done < File2.txt

OR

$ awk 'NR > 1 { print $1,($5 >35 && $7 > 90) ? "+" : "-" }' File2.txt
HAPS_0001 +
HAPS_0002 -
HAPS_0005 +
HAPS_0006 -
HAPS_0007 -
HAPS_0008 -
HAPS_0009 -
HAPS_0010 -

Hello,

Another approach with awk .

awk -vs1=35 -vs2=90 -vs3="+" -vs4="-" 'NR>1{if($5>s1 && $7>s2) {print $1 OFS s3} else {print $1 OFS s4}}' OFS="\t"  file_name

Output will be as follows.

HAPS_0001       +
HAPS_0002       -
HAPS_0005       +
HAPS_0006       -
HAPS_0007       -
HAPS_0008       -
HAPS_0009       -
HAPS_0010       -

Thanks,
R. Singh