Search in sources :

Example 1 with PcawgSampleBean

use of org.icgc.dcc.song.importer.model.PcawgSampleBean in project SONG by overture-stack.

the class PcawgSampleSheetStrategy method getNormal.

/**
 * Note: This function is very pessimistic and constrains the search significantly to avoid duplicates or any
 * other unexpected collisions
 */
public PcawgSampleBean getNormal(@NonNull String icgc_donor_id, @NonNull String dcc_project_code, @NonNull String submitter_sample_id, @NonNull String library_strategy) {
    val list = donorMap.get(icgc_donor_id).stream().filter(x -> x.getDcc_project_code().equals(dcc_project_code)).filter(x -> x.getLibrary_strategy().equals(library_strategy)).filter(x -> x.getDcc_specimen_type().toLowerCase().contains(NORMAL) && !x.getSubmitter_sample_id().equals(submitter_sample_id)).collect(toList());
    checkState(!list.isEmpty(), "No normal submitter sample id found for the query: icgc_donor_id=%s, dcc_procject_code=%s, " + "submitter_sample_id=%s, library_strategy=%s", icgc_donor_id, dcc_project_code, submitter_sample_id, library_strategy);
    checkState(list.size() == 1, "There is more than 1 result (%s) for the query: " + "icgc_donor_id=%s, dcc_procject_code=%s, submitter_sample_id=%s, library_strategy=%s", list.size(), icgc_donor_id, dcc_project_code, submitter_sample_id, library_strategy);
    return list.get(0);
}
Also used : lombok.val(lombok.val) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) PcawgSampleBean(org.icgc.dcc.song.importer.model.PcawgSampleBean) NonNull(lombok.NonNull) Map(java.util.Map) RequiredArgsConstructor(lombok.RequiredArgsConstructor) lombok.val(lombok.val) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Preconditions.checkState(com.google.common.base.Preconditions.checkState) PRIVATE(lombok.AccessLevel.PRIVATE)

Example 2 with PcawgSampleBean

use of org.icgc.dcc.song.importer.model.PcawgSampleBean in project SONG by overture-stack.

the class PcawgSampleSheetFetcher method fetch.

@SneakyThrows
public List<PcawgSampleBean> fetch() {
    val file = downloadFile();
    MappingIterator<PcawgSampleBean> it = objectReader.readValues(file);
    return it.readAll();
}
Also used : lombok.val(lombok.val) PcawgSampleBean(org.icgc.dcc.song.importer.model.PcawgSampleBean) SneakyThrows(lombok.SneakyThrows)

Aggregations

lombok.val (lombok.val)2 PcawgSampleBean (org.icgc.dcc.song.importer.model.PcawgSampleBean)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 List (java.util.List)1 Map (java.util.Map)1 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)1 Collectors.toList (java.util.stream.Collectors.toList)1 PRIVATE (lombok.AccessLevel.PRIVATE)1 NonNull (lombok.NonNull)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 SneakyThrows (lombok.SneakyThrows)1