-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding beta version of a tool for searching the patient molecular
repository
- Loading branch information
u0028003
committed
Apr 10, 2023
1 parent
e8dec78
commit 5b3d3ea
Showing
23 changed files
with
2,407 additions
and
630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package edu.utah.seq.pmr; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
import util.gen.IO; | ||
|
||
public class AvatarClinicalInfo { | ||
|
||
private HashMap<String, String> patient = new HashMap<String, String>(); | ||
private HashMap<String, String> root = new HashMap<String, String>(); | ||
private HashMap<String, String> tumorDna = new HashMap<String, String>(); | ||
private HashMap<String, String> tumorRna = new HashMap<String, String>(); | ||
private ArrayList<HashMap<String, String>> normalDna = new ArrayList<HashMap<String, String>>(); | ||
|
||
public static final String TUMOR_DNA_NAME = "TumorDNA"; | ||
public static final String TUMOR_RNA_NAME = "TumorRNA"; | ||
public static final String NORMAL_DNA_NAME = "NormalDNA"; | ||
public static final String PATIENT_NAME = "Patient"; | ||
|
||
|
||
public AvatarClinicalInfo (File json) { | ||
String jString = IO.loadFile(json, " ", true); | ||
JSONObject mainJsonObject = new JSONObject(jString); | ||
Iterator it = mainJsonObject.keys(); | ||
while (it.hasNext()) { | ||
String key = (String)it.next(); | ||
if (key.equals(PATIENT_NAME)) loadHashMap(patient, mainJsonObject.getJSONObject(key)); | ||
else if (key.equals(TUMOR_DNA_NAME)) loadHashMap(tumorDna, mainJsonObject.getJSONObject(key)); | ||
else if (key.equals(TUMOR_RNA_NAME)) loadHashMap(tumorRna, mainJsonObject.getJSONObject(key)); | ||
else if (key.equals(NORMAL_DNA_NAME)) { | ||
JSONArray allNorm = mainJsonObject.getJSONArray(key); | ||
int num = allNorm.length(); | ||
for (int i=0; i< num; i++) { | ||
JSONObject no = allNorm.getJSONObject(i); | ||
HashMap<String, String> normal = new HashMap<String, String>(); | ||
loadHashMap(normal, no); | ||
normalDna.add(normal); | ||
} | ||
} | ||
else { | ||
root.put(key, mainJsonObject.get(key).toString()); | ||
} | ||
} | ||
|
||
} | ||
|
||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("Patient:\t"+ patient+"\n"); | ||
sb.append("Root:\t"+ root+"\n"); | ||
sb.append("TumorDNA:\t"+ tumorDna+"\n"); | ||
sb.append("TumorRNA:\t"+ tumorRna+"\n"); | ||
for (HashMap<String, String> n: normalDna) { | ||
sb.append("NormalDNA:\t"+ n+"\n"); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
|
||
|
||
private void loadHashMap(HashMap<String, String> hm, JSONObject j) { | ||
Iterator it = j.keys(); | ||
while (it.hasNext()) { | ||
String key = (String)it.next(); | ||
hm.put(key, j.getString(key)); | ||
} | ||
} | ||
|
||
public HashMap<String, String> getPatient() { | ||
return patient; | ||
} | ||
|
||
public HashMap<String, String> getRoot() { | ||
return root; | ||
} | ||
|
||
public HashMap<String, String> getTumorDna() { | ||
return tumorDna; | ||
} | ||
|
||
public HashMap<String, String> getTumorRna() { | ||
return tumorRna; | ||
} | ||
|
||
public ArrayList<HashMap<String, String>> getNormalDna() { | ||
return normalDna; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package edu.utah.seq.pmr; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
|
||
import edu.utah.seq.vcf.json.TempusJsonSummary; | ||
|
||
public class Dataset { | ||
|
||
private String source; //Avatar, Tempus, Caris | ||
private String datasetId; //A032049_SL419345_SL419548_SL420681, TL-20-B70ACE, TN21-123058_2022-01-27 | ||
private ArrayList<String> partialPaths = new ArrayList<String>(); | ||
private ArrayList<File> clinicalInfoFiles = null; | ||
private AvatarClinicalInfo avatarClinicalInfo = null; //only for Avatar datasets | ||
private TempusJsonSummary tempusJsonReportInfo = null; //only for Tempus datasets | ||
private LinkedHashMap<String, String> carisClinicalInfo = null; //only for Caris datasets | ||
|
||
public Dataset(String source, String datasetId) { | ||
this.source = source; | ||
this.datasetId = datasetId; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public String getDatasetId() { | ||
return datasetId; | ||
} | ||
|
||
public ArrayList<String> getPartialPaths() { | ||
return partialPaths; | ||
} | ||
|
||
public ArrayList<File> getClinicalInfoFiles() { | ||
return clinicalInfoFiles; | ||
} | ||
|
||
public void setClinicalInfoFile(File clinicalInfo) { | ||
if (clinicalInfoFiles == null) clinicalInfoFiles = new ArrayList<File>(); | ||
clinicalInfoFiles.add(clinicalInfo); | ||
} | ||
|
||
public AvatarClinicalInfo getAvatarClinicalInfo() { | ||
return avatarClinicalInfo; | ||
} | ||
|
||
public void setAvatarClinicalInfo(AvatarClinicalInfo avatarClinicalInfo) { | ||
this.avatarClinicalInfo = avatarClinicalInfo; | ||
} | ||
|
||
public TempusJsonSummary getTempusJsonReportInfo() { | ||
return tempusJsonReportInfo; | ||
} | ||
|
||
public void setTempusJsonReportInfo(TempusJsonSummary tempusJsonReportInfo) { | ||
this.tempusJsonReportInfo = tempusJsonReportInfo; | ||
} | ||
|
||
public void setCarisXmlReportInfo(LinkedHashMap<String, String> linkedHashMap) { | ||
carisClinicalInfo = linkedHashMap; | ||
|
||
} | ||
|
||
public LinkedHashMap<String, String> getCarisClinicalInfo() { | ||
return carisClinicalInfo; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package edu.utah.seq.pmr; | ||
import java.util.HashMap; | ||
|
||
public class Patient { | ||
|
||
//fields | ||
private String coreId = null; | ||
private HashMap<String, Dataset> idDataSets = new HashMap<String, Dataset>(); | ||
|
||
public Patient(String coreId) { | ||
this.coreId = coreId; | ||
} | ||
|
||
public void addDataFile(String[] keys) { | ||
//Patients AA2mF6Vy Avatar A032049_SL419345_SL419548_SL420681 ClinicalReport A032049_SL419345_SL419548_SL420681_IDTv1_SAR_F.json | ||
// 0 1 2 3 4 5+ | ||
String source = keys[2]; | ||
String datasetId = keys[3]; | ||
Dataset d = idDataSets.get(datasetId); | ||
if (d == null) { | ||
d = new Dataset(source, datasetId); | ||
idDataSets.put(datasetId, d); | ||
} | ||
StringBuilder sb = new StringBuilder(keys[4]); | ||
for (int i=5; i< keys.length; i++) { | ||
sb.append("/"); | ||
sb.append(keys[i]); | ||
} | ||
d.getPartialPaths().add(sb.toString()); | ||
} | ||
|
||
public String getCoreId() { | ||
return coreId; | ||
} | ||
|
||
public HashMap<String, Dataset> getIdDataSets() { | ||
return idDataSets; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.