Browse Source

Correct diagnostic to diagnosis

master
Maxime Wack 3 months ago
parent
commit
e2e7cead82
8 changed files with 56 additions and 56 deletions
  1. +6
    -6
      README.org
  2. +29
    -29
      functions
  3. +4
    -4
      gitommix-completions
  4. +5
    -5
      tests/HPV.test
  5. +6
    -6
      tests/complex.test
  6. +2
    -2
      tests/simple.test
  7. +2
    -2
      tests/simple_complete.test
  8. +2
    -2
      tests/simple_large.test

+ 6
- 6
README.org View File

@@ -5,8 +5,8 @@ Git ommix creates patient-level repositories to store sample references, version
Large files are only retrieved on demand thanks to *git annex*, decorrelating navigating the history from actually downloading all of it.

Git ommix also stores a representation of the provenance of each of those entities using the PROV ontology.
Git ommix allows querying the repository structure, implementing multiple useful operations. These operations can apply to the whole patient's history or be constrained to one or multiple specific objects (sample/data/result/diagnostic)
- list the objects contributing to the target (the data contributing to a result or to a diagnostic, samples contributing to diagnostics)
Git ommix allows querying the repository structure, implementing multiple useful operations. These operations can apply to the whole patient's history or be constrained to one or multiple specific objects (sample/data/result/diagnosis)
- list the objects contributing to the target (the data contributing to a result or to a diagnosis, samples contributing to diagnosiss)
- get the most recent version of the target
- get the PROV-O prevenance of the target, as turtle triplets or as a visual graph
- display a timeline of diagnoses
@@ -80,7 +80,7 @@ New result files can be a *revision of* previous /<result>/ in the same /<sample

*** Diagnosis

git ommix add diagnostic -p|--patient <patient> --use <result|diagnostic> [--revision_of <diagnostic>] [--invalidate <diagnostic>]
git ommix add diagnosis -p|--patient <patient> --use <result|diagnosis> [--revision_of <diagnosis>] [--invalidate <diagnosis>]

Diagonses live outside of samples and can be used to tie multiple results from diffferent samples into a clinically coherent history
A diagnosis *derives from* (use) a <result> or a previous <diagnosis>
@@ -96,11 +96,11 @@ git ommix list patient

List all the patients known in the local store

*** Sample/Data/Result/Diagnostic
*** Sample/Data/Result/Diagnosis

git ommix list sample|data|result|diagnostic -p|--patient <patient> [ref]
git ommix list sample|data|result|diagnosis -p|--patient <patient> [ref]

List all the sample|data|result|diagnostic objects in <patient>
List all the sample|data|result|diagnosis objects in <patient>
[ref] limits the list to the history of [ref]
[ref] can be expressed as a commit hash or an object name (type:id or id)
Multiple [ref] can be provided


+ 29
- 29
functions View File

@@ -47,13 +47,13 @@ function add

add_result ;;

diagnostic)
diagnosis)
validate_patient

# A diagnostic needs to be at least revision_of another diagnostic, or use results or diagnostics,
[[ "${#USE[@]}" -gt 0 ]] || [[ "$REVISION_OF" ]] || die "Please --use result|diagnostic or --revision_of diagnostic when adding a diagnostic"
# A diagnosis needs to be at least revision_of another diagnosis, or use results or diagnosis,
[[ "${#USE[@]}" -gt 0 ]] || [[ "$REVISION_OF" ]] || die "Please --use result|diagnosis or --revision_of diagnosis when adding a diagnosis"

add_diagnostic ;;
add_diagnosis ;;

*) usage $VERB ;;
esac
@@ -176,20 +176,20 @@ Please check your permissions"
dbg git add "$OBJECT"
}

# Add diagnostic
# Add diagnosis
# Uses :
# - ID
# - PATIENT
# - USE result|diagnostic:<id> | <result|diagnostic_hash>
# - [INVALIDATE diagnostic:<íd> | <diagnostic_hash>]
# - [REVISION_OF diagnostic:<id> | <diagnostic_hash>]
function add_diagnostic
# - USE result|diagnosis:<id> | <result|diagnosis_hash>
# - [INVALIDATE diagnosis:<íd> | <diagnosis_hash>]
# - [REVISION_OF diagnosis:<id> | <diagnosis_hash>]
function add_diagnosis
{
local merges=()

# USE
if [[ "${#USE[@]}" -gt 0 ]]; then
use "(result|diagnostic)"
use "(result|diagnosis)"

# Start merging from the first object used
dbg stash git checkout "${HASH[0]}"
@@ -204,13 +204,13 @@ function add_diagnostic
# Start merging from the revision_of
dbg stash git checkout "$HASH"

# Remove the diagnostic branch if it existed
dbg git branch -D "diagnostic|${NAME/diagnostic:}"
# Remove the diagnosis branch if it existed
dbg git branch -D "diagnosis|${NAME/diagnosis:}"

merges=("$HASH" "${merges[@]}")
fi

dbg git checkout -b "diagnostic|$ID"
dbg git checkout -b "diagnosis|$ID"

# INVALIDATEs
if [[ "${#INVALIDATE[@]}" -gt 0 ]]; then
@@ -219,7 +219,7 @@ function add_diagnostic
local inval

for inval in "${NAME[@]}"; do
dbg git branch -D "diagnostic|${inval/diagnostic:}"
dbg git branch -D "diagnosis|${inval/diagnosis:}"
done
fi

@@ -237,7 +237,7 @@ function list
patient)
list_patient ;;

sample|data|result|diagnostic)
sample|data|result|diagnosis)
validate_patient
validate_hashes
list_object ;;
@@ -270,7 +270,7 @@ function list_object

function list_all
{
git log --format=%s --grep='^\(patient\|sample\|data\|result\|diagnostic\)' "${HASHES[@]}"
git log --format=%s --grep='^\(patient\|sample\|data\|result\|diagnosis\)' "${HASHES[@]}"
}

###############################################################################
@@ -348,8 +348,8 @@ function get_timeline
{
QUERY="CONSTRUCT {?s ?o ?p} WHERE
{?s ?o ?p .
?s a :diagnostic .
?p a :diagnostic}"
?s a :diagnosis .
?p a :diagnosis}"

get_sparql | \
turtle2dottime | \
@@ -365,7 +365,7 @@ function get_object
# Print the last commit
function get_last
{
git branch --list 'diagnostic|*' --list 'sample|*' --format='%(subject)' --contains "${HASHES[@]}"
git branch --list 'diagnosis|*' --list 'sample|*' --format='%(subject)' --contains "${HASHES[@]}"
}

# Print git commit log
@@ -391,7 +391,7 @@ $QUERY" -D - -r turtle -q
function turtle2dottime
{
local HEADS=
for branch in $(git for-each-ref --format='%(refname)' 'refs/heads/diagnostic|*'); do
for branch in $(git for-each-ref --format='%(refname)' 'refs/heads/diagnosis|*'); do
HEADS="$HEADS|$(git log --format=%s -1 $branch)"
done
HEADS="-e s/(^\t\"R(${HEADS:1})\" \[[^]]+)/\1, color = black, style = \"bold, filled\"/"
@@ -410,17 +410,17 @@ function turtle2dottime
-e 's/label="\w+:/label="/' \
-e 's/wasDerivedFrom//' \
-e 's/(label="wasRevisionOf")/label="", weight = 2, style = dashed/' \
-e 's/(^\t"Rdiagnostic:[^"]+" \[[^]]+)/\1, fillcolor = "#FF9999", group = diagnostics/' \
-e 's/(^\t"Rdiagnosis:[^"]+" \[[^]]+)/\1, fillcolor = "#FF9999", group = diagnosis/' \
$HEADS \
$INVALIDATED \
-e 's/(^\t"Rdiagnostic:[^"]+") -> ("Rdiagnostic:[^"]+")/\1:w -> \2:e/' \
-e 's/(^\t"Rdiagnosis:[^"]+") -> ("Rdiagnosis:[^"]+")/\1:w -> \2:e/' \
-e 's/^\tlabel=.*//'
}

function turtle2dot
{
local HEADS=
for branch in $(git for-each-ref --format='%(refname)' 'refs/heads/patient|*' 'refs/heads/sample|*' 'refs/heads/diagnostic|*'); do
for branch in $(git for-each-ref --format='%(refname)' 'refs/heads/patient|*' 'refs/heads/sample|*' 'refs/heads/diagnosis|*'); do
HEADS="$HEADS|$(git log --format=%s -1 $branch)"
done
HEADS="-e s/(^\t\"R(${HEADS:1})\" \[[^]]+)/\1, color = black, style = \"bold, filled\"/"
@@ -451,7 +451,7 @@ function turtle2dot
-e 's/(label="(wasGeneratedBy|used|wasAttributedTo|wasAssociatedWith)")/label="", weight = 0, color=gray/' \
-e 's/(^\t"Rdata:[^"]+" \[[^]]+)/\1, fillcolor = "#9999FF"/' \
-e 's/(^\t"Rresult:[^"]+" \[[^]]+)/\1, fillcolor = "#99FF99"/' \
-e 's/(^\t"Rdiagnostic:[^"]+" \[[^]]+)/\1, fillcolor = "#FF9999", group = diagnostics/' \
-e 's/(^\t"Rdiagnosis:[^"]+" \[[^]]+)/\1, fillcolor = "#FF9999", group = diagnosis/' \
${GRPS[@]} \
$HEADS \
$INVALIDATED \
@@ -459,12 +459,12 @@ function turtle2dot
-e 's/(^\t"Rprovider:[^"]+" \[[^]]+)/\1, shape = house, color = black, fillcolor = "#FED37F"/' \
-e 's/(^\t"Rdata:[^"]+" -> "Rsample:[^]]+)/\1, weight = 5/' \
-e 's/(^\t"Rsample:[^"]+" -> "Rpatient:[^]]+)/\1, weight = 5/' \
-e 's/(^\t"Rdiagnostic:[^"]+" -> "Rresult:[^]]+)/\1, minlen = 3/' \
-e 's/(^\t"Rdiagnosis:[^"]+" -> "Rresult:[^]]+)/\1, minlen = 3/' \
-e 's/(^\t"Rsample:[^"]+") -> ("Rpatient:[^"]+")/\1:n -> \2/' \
-e 's/(^\t"Rdata:[^"]+") -> ("Rsample:[^"]+")/\1:n -> \2:s/' \
-e 's/(^\t"Rresult:[^"]+") -> ("Rdata:[^"]+")/\1:n -> \2:s/' \
-e 's/(^\t"Rdiagnostic:[^"]+") -> ("Rdiagnostic:[^"]+")/\1:n -> \2:s/' \
-e 's/(^\t"Rdiagnostic:[^"]+") -> ("Rresult:[^"]+")/\1 -> \2:s/' \
-e 's/(^\t"Rdiagnosis:[^"]+") -> ("Rdiagnosis:[^"]+")/\1:n -> \2:s/' \
-e 's/(^\t"Rdiagnosis:[^"]+") -> ("Rresult:[^"]+")/\1 -> \2:s/' \
-e 's/^\tlabel=.*//'
}

@@ -745,7 +745,7 @@ Objects:
- sample -p <patient>
- data -p <patient> -s <sample>
- result -p <patient> -s <sample> --use <data>
- diagnostic -p <patient> --use <result|diagnostic>
- diagnosis -p <patient> --use <result|diagnosis>

Options:
--id (-i) (default: randomly generated string)
@@ -771,7 +771,7 @@ Objects:
- sample
- data
- result
- diagnostic
- diagnosis

Optional reference objects can be specified as commit hashes, the full name of the object, or only the name part of the object, matching all the objects with the same name." ;;
get)


+ 4
- 4
gitommix-completions View File

@@ -21,7 +21,7 @@ function _completions
local VERB="${words[1]}"
case $VERB in
list) OPTIONS="all " ;&
add) OPTIONS+="patient sample data result diagnostic" ;;
add) OPTIONS+="patient sample data result diagnosis" ;;
get) OPTIONS="prov graph timeline last sparql log file object" ;;
esac
elif [[ "$cword" -gt 2 ]];then
@@ -35,7 +35,7 @@ function _completions
case $VERB in
add)
case $OBJECT in
diagnostic|result) OPTIONS+="--use " ;&
diagnosis|result) OPTIONS+="--use " ;&
data) OPTIONS+="--revision_of --invalidate " ;&
sample) OPTIONS+="--patient " ;&
patient) OPTIONS+="--id --method --provider --date --message ";;
@@ -68,9 +68,9 @@ function _completions
-s|--sample) OPTIONS="$(git ommix list sample --patient $PATIENT)" ;;
--use) if [[ "$OBJECT" == "result" ]];then
OPTIONS="$(git ommix list data --patient $PATIENT)"
elif [[ "$OBJECT" == "diagnostic" ]];then
elif [[ "$OBJECT" == "diagnosis" ]];then
OPTIONS="$(git ommix list result --patient $PATIENT)
$(git ommix list diagnostic --patient $PATIENT)"
$(git ommix list diagnosis --patient $PATIENT)"
fi ;;
--invalidate|--revision_of) OPTIONS="$(git ommix list $OBJECT --patient $PATIENT)" ;;
esac


+ 5
- 5
tests/HPV.test View File

@@ -23,11 +23,11 @@ git-ommix add patient --id $PATIENT
git-ommix add sample --id Anal_biopsy
git-ommix add data -s Anal_biopsy --id Anal_pathology data_anal_path
git-ommix add result -s Anal_biopsy --use Anal_pathology --method pathology --provider "Badoual <cecile.badoual@aphp.fr>" --id Anal_pathology result_anal_path
git-ommix add diagnostic --use Anal_pathology --id Anal_carcinoma_T2
git-ommix add diagnosis --use Anal_pathology --id Anal_carcinoma_T2

git-ommix add data -s Anal_biopsy --id Anal_NGS data_anal_NGS
git-ommix add result -s Anal_biopsy --use Anal_NGS --method HPV_capture --provider "Veyer <david.veyer@aphp.fr>" --id Anal_NGS result_anal_ngs
git-ommix add diagnostic --use Anal_NGS --id Anal_carcinoma_T2_HPV --revision_of Anal_carcinoma_T2
git-ommix add diagnosis --use Anal_NGS --id Anal_carcinoma_T2_HPV --revision_of Anal_carcinoma_T2

git-ommix add sample --id blood1
git-ommix add data -s blood1 --id blood1 data_blood1
@@ -44,10 +44,10 @@ git-ommix add result -s blood3 --use blood3 --method HPV_capture --provider "Vey
git-ommix add sample --id Bone_biopsy
git-ommix add data -s Bone_biopsy --id Bone_pathology data_bone_path
git-ommix add result -s Bone_biopsy --use Bone_pathology --method pathology --provider "Badoual <cecile.badoual@aphp.fr>" --id Bone_pathology result_bone_path
git-ommix add diagnostic --use Bone_pathology --id Bone_carcinoma_T1
git-ommix add diagnosis --use Bone_pathology --id Bone_carcinoma_T1

git-ommix add data -s Bone_biopsy --id Bone_NGS data_bone_NGS
git-ommix add result -s Bone_biopsy --use Bone_NGS --method HPV_capture --provider "Veyer <david.veyer@aphp.fr>" --id Bone_NGS result_bone_ngs
git-ommix add diagnostic --use Bone_NGS --use Bone_carcinoma_T1 --revision_of Bone_carcinoma_T1 --revision_of Anal_carcinoma_T2_HPV --invalidate Bone_carcinoma_T1 --id Anal_metastasis_T2M1_HPV
git-ommix add diagnosis --use Bone_NGS --use Bone_carcinoma_T1 --revision_of Bone_carcinoma_T1 --revision_of Anal_carcinoma_T2_HPV --invalidate Bone_carcinoma_T1 --id Anal_metastasis_T2M1_HPV

git-ommix add diagnostic --revision_of Anal_metastasis_T2M1_HPV --use blood1 --use blood2 --use blood3 --id HPV_HGAIN_T2N1M1
git-ommix add diagnosis --revision_of Anal_metastasis_T2M1_HPV --use blood1 --use blood2 --use blood3 --id HPV_HGAIN_T2N1M1

+ 6
- 6
tests/complex.test View File

@@ -24,25 +24,25 @@ rm ~/GitOmmix/$PATIENT -rf
../../git-ommix add sample --id b1
../../git-ommix add data -s b1 --id b1 data_b1
../../git-ommix add result -s b1 --use b1 --id b1 result_b1
../../git-ommix add diagnostic --use b1 --id GastricT2
../../git-ommix add diagnosis --use b1 --id GastricT2

../../git-ommix add sample --id b2
../../git-ommix add data -s b2 --id b2 data_b2
../../git-ommix add result -s b2 --use b2 --id b2 result_b2
../../git-ommix add diagnostic --use b2 --id LungT1
../../git-ommix add diagnosis --use b2 --id LungT1

../../git-ommix add sample --id b3
../../git-ommix add data -s b3 --id b3 data_b3
../../git-ommix add result -s b3 --use b3 --id b3 result_b3
../../git-ommix add diagnostic --use b3 --id BoneT1
../../git-ommix add diagnosis --use b3 --id BoneT1

../../git-ommix add sample --id blood
../../git-ommix add data -s blood --id blood data_blood
../../git-ommix add result -s blood --use blood --id blood --method ddPCR result_blood
../../git-ommix add diagnostic --revision_of LungT1 --use blood --id LungT1N1
../../git-ommix add diagnostic --revision_of GastricT2 --use blood --id GastricT2N1
../../git-ommix add diagnosis --revision_of LungT1 --use blood --id LungT1N1
../../git-ommix add diagnosis --revision_of GastricT2 --use blood --id GastricT2N1

echo "Markers compatible with malignant gastric cells circulating DNA" > result_b3
../../git-ommix add result -s b3 --use b3 --id b3_ctDNA result_b3

../../git-ommix add diagnostic --revision_of GastricT2N1 --use b3_ctDNA --use BoneT1 --invalidate BoneT1 --id GastricT2N1M1
../../git-ommix add diagnosis --revision_of GastricT2N1 --use b3_ctDNA --use BoneT1 --invalidate BoneT1 --id GastricT2N1M1

+ 2
- 2
tests/simple.test View File

@@ -34,5 +34,5 @@ echo "A2" > result_a
../../git-ommix add data -s s_a --revision_of d_a --id d_a2 data_a
../../git-ommix add result -s s_a --revision_of r_a --invalidate r_a --use d_a2 --id r_a2 result_a

../../git-ommix add diagnostic --use r_a2 --use r_b --id diag1
../../git-ommix add diagnostic --revision_of diag1 --use r_c --id diag1b
../../git-ommix add diagnosis --use r_a2 --use r_b --id diag1
../../git-ommix add diagnosis --revision_of diag1 --use r_c --id diag1b

+ 2
- 2
tests/simple_complete.test View File

@@ -24,5 +24,5 @@ echo "A2" > result
../../git-ommix add data -s sample --revision_of data --id data2 data
../../git-ommix add result -s sample --revision_of result --invalidate result --use data2 --id result2 result

../../git-ommix add diagnostic --use result --id diag
../../git-ommix add diagnostic --revision_of diag --use result2 --id diag2 --provider "MD <md@hospital>" --method "Clinical_acumen"
../../git-ommix add diagnosis --use result --id diag
../../git-ommix add diagnosis --revision_of diag --use result2 --id diag2 --provider "MD <md@hospital>" --method "Clinical_acumen"

+ 2
- 2
tests/simple_large.test View File

@@ -36,5 +36,5 @@ echo "A2" > result_a
../../git-ommix add data -s s_a --revision_of d_a --id d_a2 data_a
../../git-ommix add result -s s_a --revision_of r_a --invalidate r_a --use d_a2 --id r_a2 result_a

../../git-ommix add diagnostic --use r_a2 --use r_b --id diag1
../../git-ommix add diagnostic --revision_of diag1 --use r_c --id diag1b
../../git-ommix add diagnosis --use r_a2 --use r_b --id diag1
../../git-ommix add diagnosis --revision_of diag1 --use r_c --id diag1b

Loading…
Cancel
Save