當前位置: 首頁>>代碼示例>>Java>>正文


Java Reference類代碼示例

本文整理匯總了Java中com.google.api.services.genomics.model.Reference的典型用法代碼示例。如果您正苦於以下問題:Java Reference類的具體用法?Java Reference怎麽用?Java Reference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Reference類屬於com.google.api.services.genomics.model包,在下文中一共展示了Reference類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDummyReferenceMap

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
private Map<String, Reference> createDummyReferenceMap(String[] contig) {
    Map<String,Reference> fake = new LinkedHashMap<>();
    for (String s : contig) {
        Reference r = new Reference();
        String id = "id-"+s;
        r.setName(s);
        r.setId(id);
        r.setLength(100L);
        fake.put(s, r);
    }
    return fake;
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:13,代碼來源:ReferenceAPISourceUnitTest.java

示例2: getReferences

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
/**
 * Collect a list of references mentioned in this Readgroupset and get their meta data.
 * @throws GeneralSecurityException 
 * @throws IOException 
 */
private Map<String, Reference> getReferences(ReadGroupSet readGroupSet) 
    throws IOException, GeneralSecurityException {
  Set<String> referenceSetIds = Sets.newHashSet();
  if (!Strings.isNullOrEmpty(readGroupSet.getReferenceSetId())) {
    LOG.info("Found reference set from read group set: " + 
        readGroupSet.getReferenceSetId());
    referenceSetIds.add(readGroupSet.getReferenceSetId());
  }
  if (readGroupSet.getReadGroups() != null) {
    LOG.info("Found read groups");
    for (ReadGroup readGroup : readGroupSet.getReadGroups()) {
      if (!Strings.isNullOrEmpty(readGroup.getReferenceSetId())) {
        LOG.info("Found reference set from read group: " + 
            readGroup.getReferenceSetId());
        referenceSetIds.add(readGroup.getReferenceSetId());
      }
    }
  }
  
  Map<String, Reference> references = Maps.newHashMap();
  for (String referenceSetId : referenceSetIds) {
    LOG.info("Getting reference set " + referenceSetId);
    ReferenceSet referenceSet = getApi().referencesets().get(referenceSetId).execute();
    if (referenceSet == null || referenceSet.getReferenceIds() == null) {
      continue;
    }
    for (String referenceId : referenceSet.getReferenceIds()) {
      LOG.fine("Getting reference  " + referenceId);
      Reference reference = getApi().references().get(referenceId).execute();
      if (!Strings.isNullOrEmpty(reference.getName())) {
        references.put(reference.getName(), reference);
        LOG.fine("Adding reference  " + reference.getName());
      }
    }
  }
  return references;
}
 
開發者ID:googlegenomics,項目名稱:gatk-tools-java,代碼行數:43,代碼來源:GenomicsDataSource.java

示例3: makeSAMRecord

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
public static final SAMRecord makeSAMRecord(Read read,
                                            ReadGroupSet readGroupSet, List<Reference> references,
                                            boolean forceSetMatePositionToThisPosition) {
  return makeSAMRecord(read, makeSAMFileHeader(readGroupSet, references));
}
 
開發者ID:googlegenomics,項目名稱:utils-java,代碼行數:6,代碼來源:ReadUtils.java

示例4: getResponses

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
@Override Iterable<Reference> getResponses(SearchReferencesResponse response) {
  return response.getReferences();
}
 
開發者ID:googlegenomics,項目名稱:utils-java,代碼行數:4,代碼來源:Paginator.java

示例5: ReadIteratorResource

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
public ReadIteratorResource(ReadGroupSet readGroupSet, List<Reference> references,
    UnmappedReads<Read> unmappedReads, 
    Iterable<Read> iterable) {
  super(readGroupSet, references, unmappedReads, iterable, 
      new GenomicsConverter());
}
 
開發者ID:googlegenomics,項目名稱:gatk-tools-java,代碼行數:7,代碼來源:ReadIteratorResource.java

示例6: getReads

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
@Override
public ReadIteratorResource getReads(String readsetId, 
    String sequenceName, int sequenceStart, int sequenceEnd) 
        throws IOException, GeneralSecurityException {
  LOG.info("Getting readset " + readsetId + ", sequence " + sequenceName + 
      ", start=" + sequenceStart + ", end=" + sequenceEnd);    
  final Genomics stub = getApi();

  try {
    ReadGroupSet readGroupSet = stub.readgroupsets().get(readsetId).execute();
    String datasetId = readGroupSet.getDatasetId();
    LOG.info("Found readset " + readsetId + ", dataset " + datasetId);
    // Fix up PP in Programs
    
     if (readGroupSet.getReadGroups() != null) { 
      for (ReadGroup readGroup : readGroupSet.getReadGroups()) {
        if (readGroup.getPrograms() != null) {
          for (Program PG : readGroup.getPrograms()) {
            if (PG.getPrevProgramId() != null && PG.getPrevProgramId().length() == 0) {
              PG.setPrevProgramId(null);
            }
          }
        }
      }   
    }
    
    final Map<String, Reference> references = getReferences(readGroupSet);
    final Reference reference = references.get(sequenceName);
    if (reference != null) {
        LOG.info("Reference for sequence name " + sequenceName + " is found, length="
            + String.valueOf(reference.getLength()));
    } else {
      LOG.warning("Reference for sequence name " + sequenceName + " not found");
    }
    LOG.info("Searching for reads in sequence " + sequenceName + " " + 
        String.valueOf(sequenceStart) + "-" + String.valueOf(sequenceEnd));
    com.google.cloud.genomics.gatk.common.UnmappedReads<Read> unmappedReads = null;
    if (sequenceName.isEmpty()) {
      unmappedReads = getUnmappedMatesOfMappedReads(readsetId); 
    }
    Paginator.Reads searchReads = Paginator.Reads.create(stub, ShardBoundary.Requirement.OVERLAPS);
    SearchReadsRequest readRequest = new SearchReadsRequest()
      .setReadGroupSetIds(Arrays.asList(readsetId))
      .setReferenceName(sequenceName)
      .setPageSize(2048);
    if (sequenceStart != 0) {
      readRequest.setStart(Long.valueOf(sequenceStart));
    }
    if (sequenceEnd != 0) {
      readRequest.setEnd(Long.valueOf(sequenceEnd));
    }
    Iterable<Read> reads = searchReads.search(readRequest); 
    
    return new ReadIteratorResource(readGroupSet, 
        Lists.newArrayList(references.values()), unmappedReads, reads);
  } catch (GoogleJsonResponseException ex) {
    LOG.warning("Genomics API call failure: " + ex.getMessage());
    if (ex.getDetails() == null) {
      throw ex;
    }
    throw new IOException(ex.getDetails().getMessage());
  }
}
 
開發者ID:googlegenomics,項目名稱:gatk-tools-java,代碼行數:64,代碼來源:GenomicsDataSource.java

示例7: makeSAMFileHeader

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
/**
 * Generates a SAMFileHeader from a ReadGroupSet and Reference metadata
 */
@Override
public SAMFileHeader makeSAMFileHeader(ReadGroupSet readGroupSet,
    List<Reference> references) {
  return ReadUtils.makeSAMFileHeader(readGroupSet, references);
}
 
開發者ID:googlegenomics,項目名稱:gatk-tools-java,代碼行數:9,代碼來源:GenomicsConverter.java

示例8: getReferences

import com.google.api.services.genomics.model.Reference; //導入依賴的package包/類
/**
 * Gets the references for a given referenceSetId using the Genomics API.
 *
 * @param referenceSetId The id of the referenceSet to query.
 * @param auth The OfflineAuth for the API request.
 * @return The list of references in the referenceSet.
 * @throws IOException
 */
public static Iterable<Reference> getReferences(String referenceSetId, OfflineAuth auth)
    throws IOException {
  Genomics genomics = GenomicsFactory.builder().build().fromOfflineAuth(auth);
  return Paginator.References.create(
      genomics).search(new SearchReferencesRequest().setReferenceSetId(referenceSetId));
}
 
開發者ID:googlegenomics,項目名稱:utils-java,代碼行數:15,代碼來源:GenomicsUtils.java


注:本文中的com.google.api.services.genomics.model.Reference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。