Skip to content

Commit

Permalink
Merge pull request #36 from monarch-initiative/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pnrobinson authored Jun 24, 2024
2 parents eaf07ab + c91c5d5 commit b544a1a
Show file tree
Hide file tree
Showing 24 changed files with 1,493 additions and 79 deletions.
4 changes: 2 additions & 2 deletions docs/cases/PMID_19458539.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pmid = PMID:19458539
title = Defective myotilin homodimerization caused by a novel mutation in MYOT exon 9 in the first Japanese limb girdle muscular dystrophy 1A patient
[diagnosis]
disease_id = OMIM:
disease_label =
disease_id = OMIM:609200
disease_label = Myopathy, myofibrillar, 3
[text]
The 57-year-old female patient presented with gait disturbance. She started experiencing difficulty in standing up and climbing the stairs by age 41 years. Her condition gradually progressed, and by age 50 years, she could not walk long distances and could not stand up or climb stairs without support. Her deceased father and elder sister had a similar condition. Her sister was previously diagnosed as having sporadic inclusion body myositis, but further information could not be obtained. On examination, the patient had proximal dominant muscle weakness, especially in neck flexors, iliopsoas, hamstring, and quadriceps muscles (3/5 by manual muscle test), but no facial muscle weakness. She also showed a waddling gait and decreased deep tendon reflexes. Serum creatine kinase was mildly elevated (385 IU/L; normal, <200 IU/L).
17 changes: 17 additions & 0 deletions docs/cases/PMID_25163805.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,20 @@ title = Further delineation of Loeys-Dietz syndrome type 4 in a family with mild
disease_id = OMIM:614816
disease_label = Loeys-Dietz syndrome 4
[text]
The proposita (Figure 1A) was a 57-year-old woman with family history remarkable for CTD in her two 39- and 34-year-old daughters.
She was born from unrelated Italian parents after an uneventful pregnancy and delivery. Her perinatal and psychomotor development was normal.
Two pregnancies resulted in the birth of two daughters. In the first pregnancy she reported premature membrane rupture at 34 weeks, and
in the second a threatened abortion. The spontaneous menopause was at 50 years. Clinical history presented widespread signs of CTD.
Since the childhood sub/luxations of the shoulders, wrists, knees and ankles were occurring. She suffered from acute articular rheumatism,
diagnosed at 9 years, and right relapsing inguinal hernia, surgically treated at 9, 25, and 40 years. Since her twenties, she referred
chronic generalized articular pain, mainly affecting her back, treated with NSAIDs. Magnetic resonance imaging (MRI), performed at 42 years,
revealed dural ectasia, lumbar discal hernias (L5-S1) and hypoplasia of the twelfth ribs (Figure 1B). Clinical history also included
crural hernia, surgically treated at 25 and 40 years, hiatal hernia with gastroesophageal reflux, chronic headache, gingival fragility,
and easy bruising. Ectopia lentis was excluded by ophthalmologic evaluation. ECG and echocardiography, performed at 49 years for tachycardia,
discovered paroxysmal supraventricular tachycardia and MVP with minimal regurgitation and normal systolic function (EF 65%).
Following this analysis she underwent cryoablation therapy. At this age the aortic root diameter was normal. On examination at 56 years,
she presented with normal stature (1,63 m), light blue sclerae, high arched palate, micrognathia, elongated philtrum, hypoplasic uvula,
doughy and hyperextensible skin over the neck, the forearm, and the elbows, old aging aspect, striae distensae over the hips,
joint hypermobility according to Beighton score (9/9), and scoliosis (Figure 1A). A brain, thoracic and abdominal MRA revealed
tortuosity and ectasia of carotid, vertebral, and cerebral arteries, and marked tortuosity of two segmental pulmonary arteries (Figure 1B).
No other vascular abnormalities were detected.
11 changes: 11 additions & 0 deletions docs/cases/PMID_28569194.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[source]
pmid = PMID:28569194
title = Severe child form of primary hyperoxaluria type 2 - a case report revealing consequence of GRHPR deficiency on metabolism
[diagnosis]
disease_id = OMIM:260000
disease_label = Hyperoxaluria, primary, type II
[text]
A 10-month-old girl with a history of tonsilopharyngitis, bilateral inborn hip dysplasia with improvement, dispenzarised by an orthopaedist, was referred to hospital because of a one-day febrilities and positive urinary finding of ketone bodies, proteins, leukocyturia and haematuria. She was born after a normal pregnancy at full term with an uncomplicated perinatal and neonatal course. There was no history of gross haematuria or colicky abdominal pain, and she had received no medication except for antipyretics. The family history was negative with respect to renal and metabolic disease, including urolithiasis and nephrocalcinosis, however, genetic counselling revealed that the parents have common ancestors in the fourth generation.
On physical examination the child appeared mildly dehydrated with increased body temperature of 37.6 °C. A laboratory examination found moderate anaemia (haemoglobin 93.0 g/l), leucocytosis (15x109/l) and moderately elevated CRP (42.6 mg/l). Serum electrolyte, urea and creatinine levels were normal. The calcium/creatinine ratio and 24 h calcium excretion was within the reference range. Blood gas analysis was normal with no evidence of metabolic acidosis. Ultrasonography of the abdomen raised suspicion of ureterolithiasis l.sin. Cystourethrography was indicated, showing concrement sized 2 cm x 0.8 cm in the distal part of the left ureter with mild dilatation of the renal pelvis and ureter (Fig. 1).
At the age of 11 months, an ureterolithotomy was performed at the University Children Hospital Bratislava. A chemical analysis of the extracted stone was performed, and the stone was characterised as a composite of virtually pure calcium oxalate. The following course was without any complications.

2 changes: 0 additions & 2 deletions docs/cases/PMID_30400883.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ title = A novel SLC6A8 mutation associated with intellectual disabilities in a C
[diagnosis]
disease_id = OMIM:300352
disease_label = Cerebral creatine deficiency syndrome 1
[text]

[text]
The proband was the second boy of healthy nonconsanguineous parents (pedigree in Fig. 1a). He was born at 39 weeks of
gestation from an uneventful pregnancy and delivered by Caesarean section (weight, 3600 g; length, 50 cm; head circumference, 36 cm).
Expand Down
1 change: 0 additions & 1 deletion docs/cases/PMID_30643655.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ disease_id = OMIM:613115
disease_label = Neuropathy, hereditary sensory and autonomic, type IIB
[text]
Family 2: A 15-year-old boy (F2: IV: 1) presented with a history of frequent falls, unsteadiness, and pain insensitivity from an early age of 4 years [Figure 1(a)]. During the 5-year follow-up, he was hospitalized multiple times due to skin ulcers and osteomyelitis affecting his feet and toes. There was mild spasticity in the lower limbs with minimal pyramidal weakness (MRC4). Tendon reflexes were exaggerated with negative extensor response.

Touch, pinprick, temperature and vibration revealed mild impairment in the distal part of the lower extremities for all the affected’s from family 1 while it was normal for family 2. In both families, applying strong pressure to the Achilles tendon or touching the exposed bony areas was not followed by an adequate pain reflex. Neurophysiological findings were normal or mildly abnormal in family 1 in the early stages but follow-up studies revealed sensory axonal polyneuropathy predominantly in the lower limbs while it was normal for family 2. Sympathetic skin response and beat to beat variation were also found to be normal for family 2 but abnormal in family 1 indicating involvement of the autonomic nervous system. Cerebral MRI as well as other hematological and biochemical investigations was normal
4 changes: 2 additions & 2 deletions docs/cases/PMID_31213928.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pmid = PMID:31213928
title = A novel case report of spinal muscular atrophy with progressive myoclonic epilepsy from Iran
[diagnosis]
disease_id = OMIM:
disease_label =
disease_id = OMIM:159950
disease_label = Spinal muscular atrophy with progressive myoclonic epilepsy
[text]
A 15-year old female patient was attended to neurology clinic for recent onset tremor, seizure, and
weakness in limbs. She was the first offspring of a family with relative parents; she was born from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static void main(String[] args){
.addSubcommand("download", new DownloadCommand())
.addSubcommand("prompt", new PromptCommand())
.addSubcommand("mine", new TextMineCommand())
.addSubcommand("batchmine", new TextMineCommand())
.addSubcommand("batchmine", new BatchMineCommand())
.addSubcommand("testdrive", new TestDriveCommand())
.addSubcommand("translate", new GptTranslateCommand())
;
cline.setToggleBooleanFlags(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import org.monarchinitiative.phenopacket2prompt.mining.FenominalParser;
import org.monarchinitiative.phenopacket2prompt.model.PpktIndividual;
import org.monarchinitiative.phenopacket2prompt.output.CorrectResult;
import org.monarchinitiative.phenopacket2prompt.output.PpktCopy;
import org.monarchinitiative.phenopacket2prompt.output.PromptGenerator;
import picocli.CommandLine;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;

@CommandLine.Command(name = "batchmine", aliases = {"B2"},
@CommandLine.Command(name = "batchmine",
mixinStandardHelpOptions = true,
description = "Batch Text mine, Translate, and Output phenopacket and prompt")
public class BatchMineCommand implements Callable<Integer> {
Expand All @@ -25,7 +23,7 @@ public class BatchMineCommand implements Callable<Integer> {
public String input = "docs/cases/"; // provide path for testing

@CommandLine.Option(names = { "-o", "--output"}, description = "Path to output file dir(default: ${DEFAULT-VALUE})")
private String output = "mined_out";
private String output = Utility.TEXT_MINED_DIR;

@CommandLine.Option(names = {"-e", "--exact"}, description = "Use exact matching algorithm")
private boolean useExactMatching = false;
Expand All @@ -49,27 +47,11 @@ public Integer call() throws Exception {
if (! hpoJsonFile.isFile()) {
System.out.printf("[ERROR] Could not find hp.json file at %s\nRun download command first\n", hpoJsonFile.getAbsolutePath());
}
File translationsFile = new File(translationsPath);
if (! translationsFile.isFile()) {
System.err.printf("Could not find translations file at %s. Try download command", translationsPath);
return 1;
}
Utility utility = new Utility(translationsFile);
List<PpktIndividual> individualList = getIndividualsFromTextMining(inDirectory,hpoJsonFile);
PromptGenerator spanish = utility.spanish();
Utility.outputPromptsInternationalMining(individualList,"es", spanish);
// Dutch
PromptGenerator dutch = utility.dutch();
Utility.outputPromptsInternationalMining(individualList,"nl", dutch);
// GERMAN
PromptGenerator german = utility.german();
Utility.outputPromptsInternationalMining(individualList,"de", german);
// ITALIAN
PromptGenerator italian = utility.italian();
Utility.outputPromptsInternationalMining(individualList,"it", italian);

Utility.createDir(output);
List<CorrectResult> correctResultList = Utility.outputPromptsEnglishFromIndividuals(individualList, output);
// output file with correct diagnosis list
List<CorrectResult> correctResultList =Utility.outputPromptsEnglishFromIndividuals(individualList);
Utility.outputCorrectTextmined(correctResultList);
return 0;
}
Expand All @@ -83,7 +65,9 @@ public Integer call() throws Exception {
protected List<PpktIndividual> getIndividualsFromTextMining(File inDirectory, File hpoJsonFile) {
FenominalParser parser = new FenominalParser(hpoJsonFile, useExactMatching);
List<CaseBundle> caseBundleList = Utility.getAllCaseBundlesFromDirectory(inDirectory, parser);
return caseBundleList.stream().map(CaseBundle::individual).toList();
return caseBundleList.stream().
map(CaseBundle::individual).
toList();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,16 @@
import org.monarchinitiative.phenol.base.PhenolRuntimeException;
import org.monarchinitiative.phenol.io.OntologyLoader;
import org.monarchinitiative.phenol.ontology.data.Ontology;
import org.monarchinitiative.phenopacket2prompt.international.HpInternational;
import org.monarchinitiative.phenopacket2prompt.international.HpInternationalOboParser;
import org.monarchinitiative.phenopacket2prompt.mining.CaseBundle;
import org.monarchinitiative.phenopacket2prompt.mining.FenominalParser;
import org.monarchinitiative.phenopacket2prompt.model.PhenopacketDisease;
import org.monarchinitiative.phenopacket2prompt.model.PpktIndividual;
import org.monarchinitiative.phenopacket2prompt.output.CorrectResult;
import org.monarchinitiative.phenopacket2prompt.output.PpktCopy;
import org.monarchinitiative.phenopacket2prompt.output.PromptGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;

@CommandLine.Command(name = "batch", aliases = {"B"},
Expand All @@ -45,7 +32,7 @@ public class GbtTranslateBatchCommand implements Callable<Integer> {

@CommandLine.Option(names = {"-o", "--outdir"},
description = "path to outdir")
private String outdirname = "prompts";
private String outdirname = Utility.PROMPT_DIR;

@CommandLine.Option(names = {"-d", "--dir"}, description = "Path to directory with JSON phenopacket files", required = true)
private String ppktDir;
Expand All @@ -69,14 +56,16 @@ public Integer call() throws Exception {
return 1;
}
Utility utility = new Utility(translationsFile);
// parse something

List<File> ppktFiles = Utility.getAllPhenopacketJsonFiles(ppktDir);
Utility.createDir(outdirname);
List<CorrectResult> correctResultList = Utility.outputPromptsEnglish(ppktFiles, hpo);
List<CorrectResult> correctResultList = Utility.outputPromptsEnglish(ppktFiles);
// output all non-English languages here
// SPANISH
PromptGenerator spanish = utility.spanish();
Utility.outputPromptsInternational(ppktFiles,"es", spanish);

// Dutch
PromptGenerator dutch = utility.dutch();
Utility.outputPromptsInternational(ppktFiles,"nl", dutch);
Expand All @@ -86,6 +75,10 @@ public Integer call() throws Exception {
// ITALIAN
PromptGenerator italian = utility.italian();
Utility.outputPromptsInternational(ppktFiles,"it", italian);

PromptGenerator turkish = utility.turkish();
Utility.outputPromptsInternational(ppktFiles,"tr", turkish);

// output original phenopackets
PpktCopy pcopy = new PpktCopy(new File(outdirname));
for (var file : ppktFiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class GptTranslateCommand implements Callable<Integer> {
private String languageCode;


@CommandLine.Option(names = {"--testdrive"},
description = "Create a file with example translations in each of our languages")
private boolean testDrive = false;



@Override
public Integer call() throws Exception {
File hpJsonFile = new File(hpoJsonPath);
Expand Down Expand Up @@ -78,6 +84,10 @@ public Integer call() throws Exception {
PromptGenerator italian = PromptGenerator.italian(internationalMap.get("it"));
prompt = italian.createPrompt(individual);
}
case "tr" -> {
PromptGenerator turkish = PromptGenerator.turkish(internationalMap.get("tr"));
prompt = turkish.createPrompt(individual);
}
default -> prompt = "did not recognize language code " + languageCode;
}

Expand Down
Loading

0 comments on commit b544a1a

Please sign in to comment.