Skip to content
Snippets Groups Projects
run_clustalx 934 B
Newer Older
  • Learn to ignore specific revisions
  • 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
    RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_clustalx,v 1.3 2005-02-21 11:50:01 tjc Exp $"
    
    tjc's avatar
    tjc committed
    
    PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
    
    
    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