コード例 #1
0
ファイル: DatabaseLoader.java プロジェクト: uc-bd2k/Pilincs
  private void loadReplicateAnnotations() throws Exception {
    log.info("Populating replicateAnnotations from panorama's Jsons");

    for (AssayType assayType : AssayType.values()) {
      String jsonUrl = connectPanorama.getReplicateJsonUrl(assayType);
      String jsonAsString = UtilsNetwork.readUrl(jsonUrl);
      List<IdNameValue> replicates = UtilsParse.getAnnotationsFromJSON(jsonAsString, "ReplicateId");

      replicateService.parseAndSaveReplicateAnnotations(replicates, assayType, jsonUrl);
    }
  }
コード例 #2
0
ファイル: DatabaseLoader.java プロジェクト: uc-bd2k/Pilincs
  private void loadDataPoints() throws IOException, CommandException {
    log.info("Loading peak areas from panorama gct files");

    List<String> gctDownloadUrls = connectPanorama.gctDownloadUrls(true);

    for (String url : gctDownloadUrls) {

      HashMap<String, List<ParseGCT.AnnotationValue>> metaPeptides = new HashMap<>();
      HashMap<String, List<ParseGCT.AnnotationValue>> metaReplicas = new HashMap<>();
      ArrayList<ParseGCT.PeptideReplicatePeak> peakValues = new ArrayList<>();

      try {
        parser.parseToRepository(url, peakValues, metaPeptides, metaReplicas);
      } catch (Exception e) {

      }

      GctFile gctfile = new GctFile(url);

      int runId = UtilsParse.parseRunId(url);
      String runIdUrl = connectPanorama.getRunIdLink(gctfile);

      gctfile.setRunId(runId);
      gctfile.setRunIdUrl(runIdUrl);

      gctFileRepository.save(gctfile);

      List<String> probeNameIds = new ArrayList<>(metaPeptides.keySet());

      AssayType assayType = UtilsParse.parseArrayTypeFromUrl(url);

      HashMap<String, Integer> peptideIdsForChromatogramsUrl =
          connectPanorama.getPeptideIdsFromJSON(probeNameIds, assayType, runId);

      for (ParseGCT.PeptideReplicatePeak peakFromGct : peakValues) {

        String peptideId = peakFromGct.getPeptideId();
        String replicateId = peakFromGct.getReplicateId();

        PeptideAnnotation peptideAnnotation =
            peptideAnnotationRepository.findFirstByPeptideId(peptideId);
        ReplicateAnnotation replicateAnnotation =
            replicateAnnotationRepository.findFirstByReplicateId(replicateId);

        if (peptideAnnotation == null) {
          log.warn("Peptide annotation is null");
        }

        if (replicateAnnotation == null) {
          log.warn("Replicate annotation is null");
        }

        Double peakAreaValue = peakFromGct.getPeakArea();

        for (ParseGCT.AnnotationValue annotationObject : metaPeptides.get(peptideId)) {
          String annotationName = annotationObject.getAnnotationName();
          String annotationValue = annotationObject.getAnnotationValue();

          if (annotationName.equals("pr_probe_suitability_manual")
              && annotationValue.equals("FALSE")) {
            peakAreaValue = null;
          }
        }

        String chromatogramUrl =
            connectPanorama.getChromatogramUrl(
                assayType, peptideIdsForChromatogramsUrl.get(peptideId), replicateId);

        PeakArea peakArea =
            new PeakArea(
                gctfile, peptideAnnotation, replicateAnnotation, peakAreaValue, chromatogramUrl);

        peakAreaRepository.save(peakArea);
      }
    }
  }