| 1 |
#!/bin/bash |
| 2 |
similarity=0.80 |
| 3 |
|
| 4 |
print_help() |
| 5 |
{ |
| 6 |
fold --spaces <<EOF |
| 7 |
Usage: star-align [OPTIONS...] |
| 8 |
Build a multiple sequence alignment (MSA) for a set of sequences, using star alignment heuristic. |
| 9 |
|
| 10 |
-i FILE The file containing the sequences in FASTA format. |
| 11 |
Note that the MSAs are built based on the ids |
| 12 |
read from STDIN. |
| 13 |
-h Give this help list |
| 14 |
|
| 15 |
The ids of the sequnces to be aligned are read from STDIN. The MSAs are written to STDOUT. One MSA is generated for each line. The first sequence id on each line is used as the center of the 'star'. |
| 16 |
|
| 17 |
Example: To build a MSA for the first cluster generated by 'dnaclust' do: |
| 18 |
head -n 1 sequences.cluster | ./star-align -i sequences.fasta > alignment.fasta |
| 19 |
EOF |
| 20 |
} |
| 21 |
|
| 22 |
while getopts "i:h" option |
| 23 |
do |
| 24 |
case $option in |
| 25 |
i) input_fasta="$OPTARG";; |
| 26 |
h) print_help; exit 0;; |
| 27 |
[?]) print_help; exit 1;; |
| 28 |
esac |
| 29 |
done |
| 30 |
|
| 31 |
dnaclust_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 32 |
|
| 33 |
tempdir=`mktemp -d -p .` |
| 34 |
trap "rm -fr $tempdir" EXIT |
| 35 |
|
| 36 |
center_fasta=`mktemp -p $tempdir` |
| 37 |
sequences_fasta=`mktemp -p $tempdir` |
| 38 |
|
| 39 |
while read line |
| 40 |
do |
| •41 |
echo $line | "/usr/lib/dnaclust/fastaselect" -f $input_fasta --cluster-centers > $center_fasta |
| 42 |
echo $line | "/usr/lib/dnaclust/fastaselect" -f $input_fasta --cluster-sequences > $sequences_fasta |
| 43 |
"$dnaclust_path/dnaclust" -s $similarity --multiple-alignment --no-k-mer-filter -i $sequences_fasta -p $center_fasta -r |
| •44 |
done |