Skip to content

Commit

Permalink
added ansible installer
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBuchan committed Nov 25, 2024
1 parent 9f992ff commit d4cc160
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ansible_installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# INSTALL

ansible-playbook -i hosts install.yml
6 changes: 6 additions & 0 deletions ansible_installer/config_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

app_location: ~/test_ansible/Applications
data_location: ~/test_ansible/Data
uniref_db: uniref90
#uniref_db: uniref50
2 changes: 2 additions & 0 deletions ansible_installer/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[all]
localhost
7 changes: 7 additions & 0 deletions ansible_installer/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: Install dompred
hosts: all
roles:
- blast
- dompred
vars_files:
- ./config_vars.yml
62 changes: 62 additions & 0 deletions ansible_installer/roles/blast/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
- name: Check if we the psiblast is installed
stat: path={{ app_location }}/blast-2.2.26/bin/blastpgp
register: blastpgp_exist

- name: Download BLAST+ tarball
when: blastpgp_exist.stat.exists == False
get_url:
url: ftp://ftp.ncbi.nlm.nih.gov/blast/executables/legacy.NOTSUPPORTED/2.2.26/blast-2.2.26-x64-linux.tar.gz
dest: "{{ app_location }}/"
timeout: 120
register: get_url_result

- name: unarchive blast
when: blastpgp_exist.stat.exists == False
unarchive:
src: "{{ app_location }}/blast-2.2.26-x64-linux.tar.gz"
dest: "{{ app_location }}/"
remote_src: yes

- name: remove blast+ tar.gz
when: blastpgp_exist.stat.exists == False
ansible.builtin.file:
state: absent
path: "{{ app_location }}/blast-2.2.26-x64-linux.tar.gz"

- name: Check if we have uniref db
stat:
path: "{{ data_location }}/uniref/{{ uniref_db }}.fasta"
get_md5: false
get_checksum: false
register: uniref_exist

- name: Make uniref dir
file:
path: "{{ data_location }}/uniref/"
mode: uog+rw
state: directory
when: uniref_exist.stat.exists == False

- name: Download uniref
when: uniref_exist.stat.exists == False
get_url:
url: ftp://ftp.uniprot.org/pub/databases/uniprot/uniref/{{ uniref_db }}/{{ uniref_db }}.fasta.gz
dest: "{{ data_location }}/uniref/"
timeout: 120
register: get_url_result

- name: unzip uniref
shell: cd {{ data_location }}/uniref; /bin/gunzip {{ uniref_db }}.fasta.gz
when: uniref_exist.stat.exists == False

- name: Check if we have db formatted
stat:
path: "{{ data_location }}/uniref/{{ uniref_db }}.fasta.00.phr"
get_md5: false
get_checksum: false
register: formatdb_exist

- name: Run formatdb
shell: cd {{ data_location }}/uniref; {{ app_location }}/blast-2.2.26/bin/formatdb -i {{ uniref_db }}.fasta -p T
when: formatdb_exist.stat.exists == False
58 changes: 58 additions & 0 deletions ansible_installer/roles/dompred/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---

- name: "install gnuplot"
dnf:
pkg: gnuplot
state: latest
become_user: root
become_method: sudo
become: true

- name: Check if dompred is present
stat: path={{ app_location }}/dompred/parseDS.pl
register: dompred_exist

- name : Check Out dompred from git
when: dompred_exist.stat.exists == False
git:
repo: https://github.com/psipred/dompred.git
dest: "{{ app_location }}/dompred"
clone: yes
force: yes

- name: Download data files
when: dompred_exist.stat.exists == False
get_url:
url: http://bioinfadmin.cs.ucl.ac.uk/downloads/dompred_data/dompred_data.tar.gz
dest: "{{ app_location }}/dompred/"
timeout: 120
register: get_url_result

- name: untar dompred data
when: dompred_exist.stat.exists == False
unarchive:
src: "{{ app_location }}/dompred/dompred_data.tar.gz"
dest: "{{ app_location }}/dompred/"
remote_src: yes

- name: remove tar.gz
when: dompred_exist.stat.exists == False
ansible.builtin.file:
state: absent
path: "{{ app_location }}/dompred/dompred_data.tar.gz"

- name: compile DomSSEA
when: dompred_exist.stat.exists == False
shell: cd {{ app_location }}/dompred/src; javac DomSSEA.java

# - name: update blast location
# ansible.builtin.lineinfile:
# path: "{{ app_location }}/dompred/"
# regexp: "^my .ncbidir ="
# line: "my $ncbidir = '{{ app_location}}/blast-2.2.26/bin';"

# - name: update blastdb location
# ansible.builtin.lineinfile:
# path: "{{ app_location }}/dompred/"
# regexp: "^my .dbname ="
# line: "my $dbname = '{{ data_location }}/uniref/uniref50.fasta';"

0 comments on commit d4cc160

Please sign in to comment.