Skip to content
Snippets Groups Projects
run_clustalx 794 B
Newer Older
tjc's avatar
tjc committed
#!/bin/sh -

# this script will run clustalx on a temporary file containing the concatenated
# contents of files listed in a file of filenames


tjc's avatar
tjc committed


if [ $# != 1 ]
then
    echo usage: $0 file_of_filenames
fi

(echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill

chmod a+x $PROG.kill

file_of_filenames=$1
date=`date +"%y_%m_%d"`
hostname=`hostname`
tjc's avatar
tjc committed
temp_file_name=/tmp/artemis_temp.$$.$hostname.$date.clustalx_input.fasta
tjc's avatar
tjc committed

cat $file_of_filenames | xargs cat > $temp_file_name

# make sure that the identifiers are unique for clustalx
perl -pne 'if (/^>(\S+)/) {
  $name = $1;
  if (exists $h{$name}) {
    $i = $h{$name}++;
    s/^>(\S+)/>$name.$i/;
  } else {
    $h{$name} = 0;
  }
}' $temp_file_name > $temp_file_name.processed

tcarver's avatar
tcarver committed
clustalx -INFILE=$temp_file_name.processed
tjc's avatar
tjc committed

exit 0