Tabnine Logo
StudyEntry.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.opencb.biodata.models.variant.StudyEntry
constructor

Best Java code snippets using org.opencb.biodata.models.variant.StudyEntry.<init> (Showing top 20 results out of 315)

origin: org.opencb.biodata/biodata-models

public Map<String, StudyEntry> getStudiesMap() {
  if (impl.getStudies() != null) {
    if (studyEntries == null) {
      studyEntries = new HashMap<>(impl.getStudies().size());
    }
    if (studyEntries.size() != impl.getStudies().size()) {
      for (org.opencb.biodata.models.variant.avro.StudyEntry studyEntry : impl.getStudies()) {
        studyEntries.putIfAbsent(studyEntry.getStudyId(), new StudyEntry(studyEntry));
      }
    }
    return Collections.unmodifiableMap(studyEntries);
  }
  return null;
}
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: org.opencb.biodata/biodata-formats

    .map(a -> new AlternateCoordinate(chromosome, null, null, null, a, null))
    .collect(Collectors.toList());
StudyEntry entry = new StudyEntry(metadata.getId(), secondaryAlternatesMap, Arrays.asList(format.split(":")));
VariantFileMetadata fileMetadata = new VariantFileMetadata(metadata.getFiles().get(0));
entry.setFileId(fileMetadata.getId());
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: 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: opencb/opencga

public void writeVariant(MongoDBVariantStageConverterTask converterTask, MongoDBVariantStageLoader loader, String variantStr) {
  Variant variant = new Variant(variantStr);
  variant.setNames(Collections.emptyList());
  StudyEntry studyEntry = new StudyEntry("1", "1");
  studyEntry.setFormat(Collections.emptyList());
  variant.addStudyEntry(studyEntry);
  variantMap.put(variant.getChromosome(), variant);
  loader.write(converterTask.apply(Collections.singletonList(variant)));
}
origin: opencb/opencga

    variant.getReference(),
    variant.getAlternate());
StudyEntry studyEntry = new StudyEntry();
studyEntry.setFormat(archiveVariant.getStudies().get(0).getFormat());
studyEntry.setSortedSamplesPosition(new LinkedHashMap<>());
origin: org.opencb.biodata/biodata-models

variant.setSv(sv);
if (hasStudyId()) {
  StudyEntry studyEntry = new StudyEntry(studyId);
  if (fileId != null) {
    FileEntry fileEntry = new FileEntry(fileId, call, attributes);
origin: opencb/opencga

public static Variant getVariant(String var) {
  Variant v = new Variant(var);
  StudyEntry sb = new StudyEntry("1", "1");
  String call = v.getStart() + ":" + v.getReference() + ":" + v.getAlternate() + ":" + 0;
  sb.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>())));
  v.setStudies(Collections.singletonList(sb));
  if (v.getAlternate().contains(",")) {
    String[] alternates = v.getAlternate().split(",");
    v.setAlternate(alternates[0]);
    for (int i = 1; i < alternates.length; i++) {
      v.getStudies().get(0).getSecondaryAlternates().add(new AlternateCoordinate(null, null, null, null, alternates[i], null));
    }
  }
  return v;
}
origin: opencb/opencga

    variant.getAlternate());
StudyEntry studyEntry = new StudyEntry();
studyEntry.setFormat(archiveVariant.getStudies().get(0).getFormat());
studyEntry.setSortedSamplesPosition(new LinkedHashMap<>());
origin: opencb/opencga

StudyEntry se = new StudyEntry();
se.setStudyId(vse.getStudyId());
if (null != vse.getSamplesPosition()) {
origin: opencb/opencga

StudyEntry se = new StudyEntry("1");
se.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>())));
v1.setStudies(Collections.singletonList(se));
se = new StudyEntry("1");
se.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>())));
v2.setStudies(Collections.singletonList(se));
origin: opencb/opencga

StudyEntry st = new StudyEntry(sc.getStudyName(), Collections.emptyList(), Collections.singletonList("GT"));
BiMap<Integer, String> samplesMap = sc.getSampleIds().inverse();
for (Integer sampleId : samples) {
origin: opencb/opencga

studyEntry = new StudyEntry(studyId.toString());
FileEntry fileEntry = new FileEntry(fileId.toString(), null, new HashMap<>());
fileEntry.getAttributes().put("QUAL", "0.01");
origin: opencb/opencga

@Test
public void testConvertBasic() throws Exception {
  List<Pair<Integer, List<String>>> fixedValues = new ArrayList<>();
  fixedValues.add(Pair.of(1, listOf("0/0", "PASS")));
  fixedValues.add(Pair.of(3, listOf("0/1", "PASS")));
  StudyEntry s = converter.convert(fixedValues, Collections.emptyList(), new Variant("1:1000:A:C"), 1);
  StudyEntry expected = new StudyEntry("1", Collections.emptyList(), listOf("GT", "FT"))
      .addSampleData("S1", listOf("0/0", "PASS"))
      .addSampleData("S2", listOf("?/?", "."))
      .addSampleData("S3", listOf("0/1", "PASS"))
      .addSampleData("S4", listOf("?/?", "."))
      .addSampleData("S5", listOf("?/?", "."))
      .addSampleData("S6", listOf("?/?", "."));
  Assert.assertEquals(s.toString(), expected, s);
}
origin: opencb/opencga

private Variant createVariantSecAlt(String varString, String secAlt) {
  Variant secAltVar = new Variant(secAlt);
  Variant variant = new Variant(varString);
  StudyEntry se = new StudyEntry("1");
  AlternateCoordinate ac = new AlternateCoordinate(
      secAltVar.getChromosome(), secAltVar.getStart(), secAltVar.getEnd(),
      secAltVar.getReference(), secAltVar.getAlternate(), secAltVar.getType());
  se.setSecondaryAlternates(Collections.singletonList(ac));
  variant.setStudies(Collections.singletonList(se));
  return variant;
}
origin: opencb/opencga

studyEntry = new StudyEntry(fileId.toString(), studyId.toString());
FileEntry fileEntry = studyEntry.getFile(fileId.toString());
fileEntry.getAttributes().put("QUAL", "0.01");
origin: opencb/opencga

@Test
public void testConvertExtendedFormat() throws Exception {
  sc.getAttributes().put(VariantStorageEngine.Options.EXTRA_GENOTYPE_FIELDS.key(), "AD,DP");
  scm.updateStudyConfiguration(sc, null);
  List<Pair<Integer, List<String>>> fixedValues = new ArrayList<>();
  fixedValues.add(Pair.of(1, listOf("0/0", "1,2", "10")));
  fixedValues.add(Pair.of(3, listOf("0/1", "3,4", "20")));
  StudyEntry s = converter.convert(fixedValues, Collections.emptyList(), new Variant("1:1000:A:C"), 1);
  StudyEntry expected = new StudyEntry("1", Collections.emptyList(), listOf("GT", "AD", "DP"))
      .addSampleData("S1", listOf("0/0", "1,2", "10"))
      .addSampleData("S2", listOf("?/?", ".", "."))
      .addSampleData("S3", listOf("0/1", "3,4", "20"))
      .addSampleData("S4", listOf("?/?", ".", "."))
      .addSampleData("S5", listOf("?/?", ".", "."))
      .addSampleData("S6", listOf("?/?", ".", "."));
  Assert.assertEquals(s.toString(), expected, s);
}
origin: opencb/opencga

StudyEntry expected = new StudyEntry("1", Collections.emptyList(), listOf("GT", "AD", "DP"))
    .addSampleData("S1", listOf("0/0", "1,2", "10"))
    .addSampleData("S2", listOf("1/1", "8,9", "70"))
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.variantStudyEntry<init>

Popular methods of StudyEntry

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

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • BoxLayout (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