Tabnine Logo
StudyEntry.setSamplesData
Code IndexAdd Tabnine to your IDE (free)

How to use
setSamplesData
method
in
org.opencb.biodata.models.variant.StudyEntry

Best Java code snippets using org.opencb.biodata.models.variant.StudyEntry.setSamplesData (Showing top 19 results out of 315)

origin: org.opencb.biodata/biodata-formats

  entry.setSamplesData(Collections.emptyList());
  entry.setSamplesPosition(Collections.emptyMap());
  return;
entry.setSamplesData(samplesData);
origin: opencb/opencga

private void fillStudyEntryFields(StudyEntry study, LinkedHashMap<String, Integer> samplesPositionToReturn, List<String> extraFields,
      List<List<String>> samplesData, boolean excludeGenotypes) {
  if (study != null) {
    //Set FORMAT
    if (extraFields.isEmpty()) {
      if (excludeGenotypes) {
        study.setFormat(Collections.emptyList());
      } else {
        study.setFormat(Collections.singletonList("GT"));
      }
    } else {
      List<String> format = new ArrayList<>(1 + extraFields.size());
      if (!excludeGenotypes) {
        format.add("GT");
      }
      format.addAll(extraFields);
      study.setFormat(format);
    }
    //Set Samples Position
    study.setSamplesPosition(samplesPositionToReturn);
    //Set Samples Data
    study.setSamplesData(samplesData);
  }
}
origin: opencb/opencga

  @Override
  public List<Document> apply(List<Variant> batch) {
    progressLogger.increment(batch.size(), () -> "up to position " + batch.get(batch.size() - 1));
    return batch.stream().map(variant -> {
      for (StudyEntry studyEntry : variant.getStudies()) {
        studyEntry.setStudyId(studiesIdRemap.getOrDefault(studyEntry.getStudyId(), studyEntry.getStudyId()));
        for (FileEntry file : studyEntry.getFiles()) {
          if (file.getFileId().isEmpty()) {
            file.setFileId("-1");
          } else if (fileIdRemap.containsKey(file.getFileId())) {
            file.setFileId(fileIdRemap.get(file.getFileId()));
          }
        }
        if (studyEntry.getSamplesData() == null) {
          studyEntry.setSamplesData(Collections.emptyList());
        }
      }
      return variant;
    }).map(variantConverter::convertToStorageType).collect(Collectors.toList());
  }
}
origin: org.opencb.biodata/biodata-tools

/**
 * @param n
 * @return studyEntryList
 */
public List<StudyEntry> getStudies(int n) {
  int studyID = 2;
  int fieldID = 3;
  List<StudyEntry> studyEntryList = new ArrayList<>();
  StudyEntry studyEntry = new StudyEntry();
  studyEntry.setStudyId(Integer.toString(studyID));
  studyEntry.setFileId(Integer.toString(fieldID));
  Map<String, String> attributes = genAttributes();
  studyEntry.setAttributes(attributes);
  studyEntry.setFormat(getFormat());
  List<List<String>> sampleList = new ArrayList<>(getFormat().size());
  for (int i = 0; i < n; i++) {
    sampleList.add(getRandomample());
  }
  studyEntry.setSamplesData(sampleList);
  studyEntryList.add(studyEntry);
  return studyEntryList;
}
origin: opencb/opencga

public static Variant addGTAndFilter(Variant var, String gt, String filter) {
  StudyEntry se = var.getStudy("1");
  se.setSamplesPosition(Collections.singletonMap("1", 0));
  se.setFormat(Arrays.asList(GENOTYPE_KEY, GENOTYPE_FILTER_KEY));
  se.setSamplesData(Collections.singletonList(Arrays.asList(gt, filter)));
  return var;
}
origin: opencb/opencga

se.setSamplesData(oLst);
se.setSecondaryAlternates(new ArrayList<>());
for (FileEntry fe : se.getFiles()) {
origin: opencb/opencga

protected StudyEntry newStudyEntry(StudyConfiguration studyConfiguration, List<String> fixedFormat) {
  StudyEntry studyEntry;
  if (studyNameAsStudyId) {
    studyEntry = new StudyEntry(studyConfiguration.getStudyName());
  } else {
    studyEntry = new StudyEntry(String.valueOf(studyConfiguration.getStudyId()));
  }
  if (expectedFormat == null) {
    studyEntry.setFormat(new ArrayList<>(fixedFormat));
  } else {
    studyEntry.setFormat(new ArrayList<>(expectedFormat));
  }
  LinkedHashMap<String, Integer> returnedSamplesPosition;
  if (mutableSamplesPosition) {
    returnedSamplesPosition = new LinkedHashMap<>(getReturnedSamplesPosition(studyConfiguration));
  } else {
    returnedSamplesPosition = getReturnedSamplesPosition(studyConfiguration);
  }
  studyEntry.setSamplesData(new ArrayList<>(returnedSamplesPosition.size()));
  studyEntry.setSortedSamplesPosition(returnedSamplesPosition);
  return studyEntry;
}
origin: opencb/opencga

  public static Variant addGT(Variant var, String gt) {
    StudyEntry se = var.getStudy("1");
    se.addFormat("GT");
    se.getFormatPositions();
    se.setSamplesPosition(Collections.singletonMap("1", 0));
//        se.setFormat(Collections.singletonList("GT"));
    se.setSamplesData(Collections.singletonList(Collections.singletonList(gt)));
    return var;
  }

origin: org.opencb.biodata/biodata-tools

/**
 * Create an empty Variant (position, ref, alt) from a template with basic Study information without samples.
 * @param target Variant to take as a template
 * @return Variant filled with chromosome, start, end, ref, alt, study ID and format set to GT only, BUT no samples.
 */
public Variant createFromTemplate(Variant target) {
  Variant var = new Variant(target.getChromosome(), target.getStart(), target.getEnd(), target.getReference(), target.getAlternate());
  var.setType(target.getType());
  for(StudyEntry tse : target.getStudies()){
    StudyEntry se = new StudyEntry(tse.getStudyId());
    se.setFiles(Collections.singletonList(new FileEntry("", "", new HashMap<>())));
    se.setFormat(Arrays.asList(getGtKey(), getFilterKey()));
    se.setSamplesPosition(new HashMap<>());
    se.setSamplesData(new ArrayList<>());
    var.addStudyEntry(se);
  }
  return var;
}
origin: org.opencb.biodata/biodata-tools

currentStudy.setSamplesData(newSamplesData);
currentStudy.setSortedSamplesPosition(newSamplesPosition);
currentStudy.setFormat(newFormat);
origin: opencb/opencga

studyEntry.setSamplesData(sampleData);
studyEntry.setSamplesPosition(samplePosition);
origin: opencb/opencga

se.setSecondaryAlternates(getAlternateCoordinates(secondaryAlternates));
se.setFormat(studyEntry.getFormat());
se.setSamplesData(new ArrayList<>(fileIds.size()));
origin: opencb/opencga

studyEntry.setFormat(archiveVariant.getStudies().get(0).getFormat());
studyEntry.setSortedSamplesPosition(new LinkedHashMap<>());
studyEntry.setSamplesData(new ArrayList<>());
origin: org.opencb.biodata/biodata-models

  studyEntry.setSamplesData(samplesData);
  variant.addStudyEntry(studyEntry);
} else {
origin: opencb/opencga

studyEntry.setFormat(archiveVariant.getStudies().get(0).getFormat());
studyEntry.setSortedSamplesPosition(new LinkedHashMap<>());
studyEntry.setSamplesData(new ArrayList<>());
mergedVariant.addStudyEntry(studyEntry);
mergedVariant.setType(variant.getType());
origin: opencb/opencga

  newSampleData.add(new ArrayList<>(sd));
se.setSamplesData(newSampleData);
origin: org.opencb.biodata/biodata-tools

if (keyFields.getPhaseSet() != null) {
  StudyEntry studyEntry = new StudyEntry();
  studyEntry.setSamplesData(
      Collections.singletonList(Collections.singletonList(keyFields.getPhaseSet())));
  studyEntry.setFormat(Collections.singletonList("PS"));
    normalizedEntry.setSamplesData(normalizedSamplesData);
    normalizedVariants.add(normalizedVariant);
origin: opencb/opencga

se.setFormat(Arrays.asList(GENOTYPE_KEY, GENOTYPE_FILTER_KEY));
se.setSamplesPosition(asMap("S1", 0));
se.setSamplesData(Collections.singletonList(Arrays.asList("1/2", "LowGQXHetDel")));
se.getSecondaryAlternates().add(new AlternateCoordinate(null, null, 328, "CTT", "CTTTC", INDEL));
addAttribute(v1, FILTER, "LowGQXHetDel");
se.setSamplesPosition(asMap("S1", 0));
se.setFormat(Arrays.asList(GENOTYPE_KEY, GENOTYPE_FILTER_KEY));
se.setSamplesData(Collections.singletonList(Arrays.asList("0/1", "PASS")));
addAttribute(v2, FILTER, "PASS");
origin: org.opencb.biodata/biodata-tools

public Variant convert(VcfSliceProtos.VcfRecord vcfRecord, String chromosome, int slicePosition) {
  int start = getStart(vcfRecord, slicePosition);
  int end = getEnd(vcfRecord, slicePosition);
  Variant variant = new Variant(chromosome, start, end, vcfRecord.getReference(), vcfRecord.getAlternate());
  variant.setType(getVariantType(vcfRecord.getType()));
  variant.setIds(vcfRecord.getIdNonDefaultList());
  variant.resetLength();
  FileEntry fileEntry = new FileEntry();
  fileEntry.setFileId(fileId);
  Map<String, String> attributes = getFileAttributes(vcfRecord);
  fileEntry.setAttributes(attributes);
  fileEntry.setCall(vcfRecord.getCall().isEmpty() ? null : vcfRecord.getCall());
  if (vcfRecord.getType().equals(VariantProto.VariantType.NO_VARIATION)) {
    attributes.put("END", Integer.toString(end));
  }
  StudyEntry studyEntry = new StudyEntry(studyId);
  studyEntry.setFiles(Collections.singletonList(fileEntry));
  studyEntry.setFormat(getFormat(vcfRecord));
  studyEntry.setSamplesData(getSamplesData(vcfRecord, studyEntry.getFormatPositions()));
  studyEntry.setSamplesPosition(retrieveSamplePosition());
  studyEntry.getFormatPositions(); // Initialize the map
  List<VariantProto.AlternateCoordinate> alts = vcfRecord.getSecondaryAlternatesList();
  studyEntry.setSecondaryAlternates(getAlternateCoordinates(alts));
  variant.addStudyEntry(studyEntry);
  studyEntry.getFormatPositions(); // Initialize the map
  return variant;
}
org.opencb.biodata.models.variantStudyEntrysetSamplesData

Popular methods of StudyEntry

  • getSamplesData
  • getFiles
  • <init>
  • getSampleData
  • getFile
  • getStudyId
  • getOrderedSamplesName
  • getSamplesName
  • setFiles
  • setFormat
  • setSamplesPosition
  • getFormat
    Do not modify this list
  • setSamplesPosition,
  • getFormat,
  • getFormatPositions,
  • getStats,
  • setStats,
  • addSampleData,
  • getSamplesPosition,
  • getSecondaryAlternates,
  • setSecondaryAlternates

Popular in Java

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Menu (java.awt)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JButton (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now