# 2021-12-7


# 1.  merge all protein files .faa and .fasta
	datadir=/data/home/anne/PROJECTS/JanMaarten/Yanyan_202112/faa
	cd $datadir 
	cat *.faa >all.fasta

# 2. Rename locus tags, use find and replace in Genome2D cmd or online
714.676.peg.	Aa2R_
714.631.peg.	Aa5R_
714.678.peg.	Aa7R_
714.681.peg.	Aa14R_
714.682.peg.	Aa16R_
714.684.peg.	Aa25R_
714.635.peg.	Aa30R_
 
# 3. convert to tab delimited file
	/data/molgentools/genomics/g2d_conversions.pl -l all.fasta -r Cvrt_fasta2tab -o all.tab

# 4. remove redundant sequences
	/data/molgentools/annotation/make_nr_db.pl -i all.fasta -o all_nr.fasta
		## Entries in Query: 15773
		## Entries in Output: 8911





	/data/molgentools/genomics/g2d_conversions.pl -l all_nr.fasta -r Cvrt_fasta2tab -o all_nr.tab	

# 5. Facop annotation
	http://facop.molgenrug.nl

	
# 6. Blast to uniprot_sprot	==> last time 48 min with 4 cpus
	dbDIR=/data/gsea_pro/databases
	time blastp -outfmt 6 -db $dbDIR/uniprot_sprot.fasta -query $datadir/all_nr.fasta -max_target_seqs 1 -num_threads 4 -evalue 10E-09 -out $datadir/all_nr.uniprot.blast
	# filter for best blast hit only
	/data/molgentools/blast/parse_blast_table.pl -i $datadir/all_nr.uniprot.blast -o $datadir/all_nr.uniprot.filter.blast
	# Align the blast output with the description of uniref50
	/data/molgentools/genomics/g2d_align_tables.pl -s $datadir -k $dbDIR/uniprot_sprot.description -r Align_anycolumn -t $datadir/all_nr.uniprot.filter.blast -o all_nr.uniprot.description.blast
	

# 7 Add the blast results to the all_nr.tab
	/data/molgentools/genomics/g2d_align_tables.pl -s $datadir -k $datadir/all_nr.uniref50.description.blast -r Align_firstcolumn -t $datadir/all_nr.tab -o all_nr.uniref50.table

