<commit_before>#!/bin/bash

# <NAME>
# Solgenomics@BTI
# Purpose: Create reciprocal blast hit orthologs for 2 protein sets (P1 and P2).
# Input: Blast reports of P1 to P2 and P2 to P1
# ~/tools/ncbi-blast-2.2.31+/bin/blastp -query dmel-all-translation-r6.10.fasta -db protein.fa -evalue 1e-5 -out dmel_gnomon.eval1e-5.out -num_threads 60 -num_descriptions 10 -num_alignments 10

# Output
#gi|662182960|ref|XP_008470658.1| FBpp0301195
#gi|662182962|ref|XP_008480455.1| FBpp0087031
#gi|662182964|ref|XP_008487638.1| FBpp0291925
#gi|662182972|ref|XP_008470659.1| FBpp0311427

# DOES NOT WORK. PRINT TO SCREEN INSTEAD OF FILE IN LN 48 LOOP

usage(){
	echo "usage:
	$0 <p1-p2.eval1e-5.out> <p2-p1.eval1e-5.out> <P1 genome name(no spaces)> <P2 genome name(no spaces)>"
	exit 1
}

if [ "$#" -ne 4 ]
then
	usage
fi

printf "ARG 1 : %s \n" "$1"
printf "ARG 2 : %s \n" "$2"
printf "ARG 3 : %s \n" "$3"
printf "ARG 4 : %s \n" "$4"


# create blast reports with query and hit lists
arr_blast=(90 80 70 60 50 40 30 20 10 5); 

for N in "${arr_blast[@]}"; 	do 
	echo "$N"; BlastReport.pl -r "$1" --qcutoff "$N" --scutoff "$N" --besthit 1 --qhits 1 --out "$1".scov"${N}".qcov"${N}".xls;
	done<commit_msg>not working as cannot write to file inside a loop<commit_after>#!/bin/bash

# <NAME>
# Solgenomics@BTI
# Purpose: Create reciprocal blast hit orthologs for 2 protein sets (P1 and P2).
# Input: Blast reports of P1 to P2 and P2 to P1
# ~/tools/ncbi-blast-2.2.31+/bin/blastp -query dmel-all-translation-r6.10.fasta -db protein.fa -evalue 1e-5 -out dmel_gnomon.eval1e-5.out -num_threads 60 -num_descriptions 10 -num_alignments 10

# Output
#gi|662182960|ref|XP_008470658.1| FBpp0301195
#gi|662182962|ref|XP_008480455.1| FBpp0087031
#gi|662182964|ref|XP_008487638.1| FBpp0291925
#gi|662182972|ref|XP_008470659.1| FBpp0311427

# DOES NOT WORK. PRINTS TO SCREEN INSTEAD OF FILE IN LN 48 LOOP
# Problem is that output cannot be written to files within a loop, only at the end

usage(){
	echo "usage:
	$0 <p1-p2.eval1e-5.out> <p2-p1.eval1e-5.out> <P1 genome name(no spaces)> <P2 genome name(no spaces)>"
	exit 1
}

if [ "$#" -ne 4 ]
then
	usage
fi

printf "ARG 1 : %s \n" "$1"
printf "ARG 2 : %s \n" "$2"
printf "ARG 3 : %s \n" "$3"
printf "ARG 4 : %s \n" "$4"


# create blast reports with query and hit lists
arr_blast=(90 80 70 60 50 40 30 20 10 5); 

for N in "${arr_blast[@]}"; 	do 
	echo "$N"; BlastReport.pl -r "$1" --qcutoff "$N" --scutoff "$N" --besthit 1 --qhits 1 --out "$1".scov"${N}".qcov"${N}".xls;
	done
{'fraction_non_alphanumeric': 0.15852682145716573, 'fraction_numerical': 0.13931144915932747, 'mean_word_length': 3.871345029239766, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '735237', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1079, 'n_words': 324}