cat Candidate_list_BPA10mg.txt|while read l
do

file=$(echo $l|cut -d " " -f 1)
motif=$(echo $l|cut -d " " -f 2)
gene=$(echo $l|cut -d " " -f 3)

echo $file
echo $motif
echo $gene

findMotifsGenome.pl ${file}.txt mm10 ${file} -size given -find ${file}/homerResults/${motif}.motif > outputfile.txt

mv outputfile.txt ${file}_${gene}.txt

cut -f 1 ${file}_${gene}.txt|sed "1d"|sort -u > ${file}_${gene}_peak.txt

done
