Skip to content

Commit

Permalink
started CoopSW8_001 but not finished
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendes committed May 23, 2024
1 parent 9aa29b7 commit a07ec53
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/0024_GRNCoopSW8_001/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 0024_GRNCoopSW8_001

a gene regulatory network of 100 genes connected according to a small-world topology, from the AGN suite

## tests

- 1D, 100 units, network, GRN
- cps file reads well
- network file reads well
- named output file

- checks the regulated_by_1 rate law was created
- checks that there are exactly 3 species
- checks that noise worked
- checks no compartments created
- checks that there are three synthesis reactions
67 changes: 67 additions & 0 deletions tests/0024_GRNCoopSW8_001/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

# work out our folder name
test=${PWD##*/} # to assign to a variable
test=${test:-/} # to correct for the case where PWD=/

# run sbmodelr
../../sbmodelr -g G --cn 2 uni --grn-a -1 --grn-h 8 --grn-V 2 -n ../sources/CoopSW8_001.dot -o CoopSW8_001.cps --ignore-compartments ../sources/GeneExpressionUnit.cps 100 > output

fail=0

# compare output and target
difference=$(diff output target_stdout)
if [[ $difference ]]; then
printf 'FAIL %s\n' "${test}"
fail=1
fi

# create model summary
../model_report.py CoopSW8_001.cps >/dev/null
if ! [[ $? = 0 ]]; then
printf 'FAIL %s\n' "${test}"
exit -1
fi

# check that there is one rate law for regulation by 2
if ! grep -Pq "^regulated_by_2\s+V \* \( \( 1 \+ \( 1 \+ a1 \) \* M1 \^ h1 \) \/ \( 1 \+ M1 \^ h1 \) \) \* \( \( 1 \+ \( 1 \+ a2 \) \* M2 \^ h2 \) \/ \( 1 \+ M2 \^ h2 \) \)" CoopSW8_001.summary.txt; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 2"
fi

# check that there are 100 species
n=$(grep -Pc "^G_\d+\s+reactions\s+\d+\.\d+" CoopSW8_001.summary.txt)
if ((n != 100)); then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 4"
fi

exit $fail

# check that min and max of initial concentrations are different (meaning noise worked!)
n=$(grep -Po "^G_[123]\s+reactions\s+([0-9]+\.[0-9]+\s)" repressilator.summary.txt | awk '(NR==1){Min=$3;Max=$3};(NR>=2){if(Min>$3) Min=$3;if(Max<$3) Max=$3} END {if(Min<Max) {print 0} else {print 1}}')
if ((n != 0)) ; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 8"
fi

# check that no new compartments were created
n=$(grep -Pc "^cell_[123]\s+fixed" repressilator.summary.txt)
if ((n != 0)) ; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 16"
fi

# checks that there are three synthesis reactions
n=$(grep -Pc "synthesis (G_[123])\s+-> \1\;\s+G_[123]\s+regulated_by_1" repressilator.summary.txt)
if ((n != 3)) ; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 32"
fi

if [ "$fail" = 0 ] ; then
printf 'PASS %s\n' "${test}"
rm repressilator.summary.txt output *.cps
fi

exit $fail
9 changes: 9 additions & 0 deletions tests/0024_GRNCoopSW8_001/target_stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Processing ../sources/GeneExpressionUnit.cps
Reactions: 2
Species: 1 (Reactions: 1, Fixed: 0, Assignment: 0, ODE: 0)
Compartments: 1 (Fixed: 1, Assignment: 0, ODE: 0)
Global quantities: 0 (Fixed: 0, Assignment: 0, ODE: 0)
Events: 0 (Only time-dependent: 0, variable-dependent: 0)
Network: directed (Nodes: 100, Edges: 200)
created new model CoopSW8_001.cps with a set of 100 replicas of ../sources/GeneExpressionUnit.cps

0 comments on commit a07ec53

Please sign in to comment.