-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_magi.sh
47 lines (34 loc) · 2 KB
/
run_magi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Full path to location where magi is installed
magi_path=/home/u30/nathaliagg/magi
# Input fasta file with protein sequences and unique identifiers in the header
# Example of a header:
# >gene_1 some description
fasta_file=./genome/gene_aa.fa
# Input file with either candidate compounds in a column called original_compound
# Or with m/z values in the column original_compound
compounds_file=./metabolome/compounds_input.csv
# Other parameters for MAGI that may be useful
cpu_count=12
output_directory=./magi_output
logfile_name=log_magi_run.txt
error_log_name=error_log_magi_run.txt
mkdir magi_output
#####################################################################################
source activate magi #if this does not work, use conda activate magi
# Run MAGI
echo "Starting MAGI at $(date)"
python $magi_path/workflow/magi_workflow_gene_to_reaction.py --fasta $fasta_file --compounds $compounds_file --output $output_directory --cpu_count $cpu_count > $logfile_name 2> $error_log_name
if [ $? -eq 0 ]; then # Check if previous MAGI run did not fail
python $magi_path/workflow/magi_workflow_accurate_mass_search.py --not_first_script --output $output_directory >> $logfile_name 2>> $error_log_name
else touch $output_directory/incomplete; fi
if [ $? -eq 0 ] && [ ! -f $output_directory/incomplete ]; then
python $magi_path/workflow/magi_workflow_compound_to_reaction.py --not_first_script --output $output_directory >> $logfile_name 2>> $error_log_name
else touch $output_directory/incomplete; fi
if [ $? -eq 0 ] && [ ! -f $output_directory/incomplete ]; then
python $magi_path/workflow/magi_workflow_reaction_to_gene.py --not_first_script --output $output_directory >> $logfile_name 2>> $error_log_name
else touch $output_directory/incomplete; fi
if [ $? -eq 0 ] && [ ! -f $output_directory/incomplete ]; then
python $magi_path/workflow/magi_workflow_scoring.py --not_first_script --output $output_directory >> $logfile_name 2>> $error_log_name
else touch $output_directory/incomplete; fi
echo "Done at $(date)"