Skip to content

Commit f9e178d

Browse files
committed
add script to extract memote scores
1 parent 646bec6 commit f9e178d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

code/bash/extract-scores-memote.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# Extract memote scores from html report files.
3+
# Prints the result to stdout.
4+
5+
get_score() {
6+
# Input 1 is filename
7+
# Input 2 is query
8+
echo $(cat $1 | grep -A2 "$2" | grep -o "[0-9][0-9\.\,]*")
9+
}
10+
11+
# isolate ID
12+
ID=$(head -1 $1)
13+
14+
# stoichiometric consistency
15+
s_con=$(get_score $1 "Stoichiometric Consistency")
16+
17+
# mass balance
18+
m_bal=$(get_score $1 "Mass Balance")
19+
20+
# charge balance
21+
c_bal=$(get_score $1 "Charge Balance")
22+
23+
# metabolite connectivity
24+
m_conn=$(get_score $1 "Metabolite Connectivity")
25+
26+
# unbounded flux
27+
ubd_flx=$(get_score $1 "Unbounded Flux In Default Medium")
28+
29+
# stoichiometrically balanced cycles
30+
sbc=$(get_score $1 "Stoichiometrically Balanced Cycles")
31+
32+
# universally blocked reactions
33+
blocked=$(get_score $1 "Universally Blocked Reactions")
34+
35+
# consistency subscore
36+
cons_sub=$(get_score $1 "Sub Total" | grep -m 1 -o "[0-9][0-9\.]*" | head -n 1)
37+
38+
# total score
39+
tot_score=$(get_score $1 "Total Score" | grep -m 1 -o "[0-9][0-9\.]*" | head -n 1)
40+
41+
42+
echo -e "$ID\t$s_con\t$m_bal\t$c_bal\t$m_conn\t$ubd_flx\t$sbc\t$blocked\t$cons_sub\t$tot_score"

0 commit comments

Comments
 (0)