Skip to content

Commit

Permalink
Process loop iterations concurrently when cds_files_extra_constr is d…
Browse files Browse the repository at this point in the history
…efined (#9)
  • Loading branch information
nathanweeks authored Feb 4, 2024
1 parent d5f69d5 commit 4e7aad2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/pandagma-pan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -595,12 +595,16 @@ run_add_extra() {
for m8file in 13_extra_out_constr_dir/*.m8; do
base=$(basename "$m8file" .m8)
echo " Processing file $m8file"
top_line.awk "$m8file" | awk -v IDEN="${extra_iden}" '$3>=IDEN {print $1 "\t" $2}' |
perl -pe 's/^\S+__(\S+)__\d+__\d\S*\t\S+__(\S+)__\d+__\d\S+$/2\t$1\t$2/' > 13_extra_out_constr_dir/"$base".top_2nd
filter_mmseqs_by_chroms.pl -chr_pat <(printf '%s %s\n' "${expected_chr_matches[@]}") < "$m8file" |
top_line.awk | awk -v IDEN="${extra_iden}" '$3>=IDEN {print $1 "\t" $2}' |
perl -pe 's/^\S+__(\S+)__\d+__\d+\t\S+__(\S+)__\d+__\d+$/1\t$1\t$2/' > 13_extra_out_constr_dir/"$base".top_1st
{
top_line.awk "$m8file" | awk -v IDEN="${extra_iden}" '$3>=IDEN {print $1 "\t" $2}' |
perl -pe 's/^\S+__(\S+)__\d+__\d\S*\t\S+__(\S+)__\d+__\d\S+$/2\t$1\t$2/' > 13_extra_out_constr_dir/"$base".top_2nd
filter_mmseqs_by_chroms.pl -chr_pat <(printf '%s %s\n' "${expected_chr_matches[@]}") < "$m8file" |
top_line.awk | awk -v IDEN="${extra_iden}" '$3>=IDEN {print $1 "\t" $2}' |
perl -pe 's/^\S+__(\S+)__\d+__\d+\t\S+__(\S+)__\d+__\d+$/1\t$1\t$2/' > 13_extra_out_constr_dir/"$base".top_1st
} &
if [[ $(jobs -r -p | wc -l) -ge ${NPROC} ]]; then wait -n; fi
done
wait
fi
else # don't filter, since chromosome pairings aren't provided; just split lines on "__"
echo "WARNING: No expected_chr_matches.tsv file was provided, but annotations were indicated in the "
Expand Down

0 comments on commit 4e7aad2

Please sign in to comment.