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


Java ReferenceServiceV1Grpc類代碼示例

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


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

示例1: main

import com.google.genomics.v1.ReferenceServiceV1Grpc; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
  ManagedChannel channel = GenomicsChannel.fromDefaultCreds();

  // Regular RPC example: list all reference set assembly ids.
  ReferenceServiceV1BlockingStub refStub =
      ReferenceServiceV1Grpc.newBlockingStub(channel);
  SearchReferenceSetsRequest request =
      SearchReferenceSetsRequest.newBuilder().build();
  SearchReferenceSetsResponse response = refStub.searchReferenceSets(request);
  for (ReferenceSet rs : response.getReferenceSetsList()) {
    System.out.println(rs.getAssemblyId());
  }

  // Streaming RPC example: request the variants within BRCA1 for the Platinum Genomes variant set.
  StreamingVariantServiceBlockingStub varStub =
      StreamingVariantServiceGrpc.newBlockingStub(channel);
  StreamVariantsRequest varRequest = StreamVariantsRequest.newBuilder()
      .setVariantSetId("3049512673186936334")
      .setReferenceName("chr17")
      .setStart(41196311)
      .setEnd(41277499)
      .build();

  try {
    Iterator<StreamVariantsResponse> iter = varStub.streamVariants(varRequest);
    while (iter.hasNext()) {
      StreamVariantsResponse varResponse = iter.next();
      System.out.println("Response:");
      System.out.println(varResponse.toString());
      System.out.println();
    }
    System.out.println("Done");
  } finally {
    channel.shutdownNow();
  }
}
 
開發者ID:googlegenomics,項目名稱:utils-java,代碼行數:37,代碼來源:Example.java

示例2: getReferences

import com.google.genomics.v1.ReferenceServiceV1Grpc; //導入依賴的package包/類
private static List<ReferenceInfo> getReferences(Channel channel, ReadGroupSet readGroupSet) {
  Set<String> referenceSetIds = Sets.newHashSet();
  if (readGroupSet.getReferenceSetId() != null && !readGroupSet.getReferenceSetId().isEmpty()) {
    LOG.fine("Found reference set from read group set " +
        readGroupSet.getReferenceSetId());
    referenceSetIds.add(readGroupSet.getReferenceSetId());
  }
  if (readGroupSet.getReadGroupsCount() > 0) {
    LOG.fine("Found read groups");
    for (ReadGroup readGroup : readGroupSet.getReadGroupsList()) {
      if (readGroup.getReferenceSetId() != null && !readGroup.getReferenceSetId().isEmpty()) {
        LOG.fine("Found reference set from read group: " +
            readGroup.getReferenceSetId());
        referenceSetIds.add(readGroup.getReferenceSetId());
      }
    }
  }

  ReferenceServiceV1BlockingStub referenceSetStub =
      ReferenceServiceV1Grpc.newBlockingStub(channel);

  List<ReferenceInfo> references = Lists.newArrayList();
  for (String referenceSetId : referenceSetIds) {
    LOG.fine("Getting reference set " + referenceSetId);
    GetReferenceSetRequest getReferenceSetRequest = GetReferenceSetRequest
        .newBuilder().setReferenceSetId(referenceSetId).build();
    ReferenceSet referenceSet =
        referenceSetStub.getReferenceSet(getReferenceSetRequest);
    if (referenceSet == null || referenceSet.getReferenceIdsCount() == 0) {
      continue;
    }
    for (String referenceId : referenceSet.getReferenceIdsList()) {
      LOG.fine("Getting reference  " + referenceId);
      GetReferenceRequest getReferenceRequest = GetReferenceRequest
          .newBuilder().setReferenceId(referenceId).build();
      Reference reference = referenceSetStub.getReference(getReferenceRequest);
      if (reference.getName() != null && !reference.getName().isEmpty()) {
        references.add(new ReferenceInfo(reference, referenceSet));
        LOG.fine("Adding reference  " + reference.getName());
      }
    }
  }
  return references;
}
 
開發者ID:googlegenomics,項目名稱:dataflow-java,代碼行數:45,代碼來源:HeaderInfo.java

示例3: getReferences

import com.google.genomics.v1.ReferenceServiceV1Grpc; //導入依賴的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.getReadGroupsCount() > 0) {
    LOG.info("Found read groups");
    for (ReadGroup readGroup : readGroupSet.getReadGroupsList()) {
      if (!Strings.isNullOrEmpty(readGroup.getReferenceSetId())) {
        LOG.info("Found reference set from read group: " + 
            readGroup.getReferenceSetId());
        referenceSetIds.add(readGroup.getReferenceSetId());
      }
    }
  }
  
  ReferenceServiceV1BlockingStub referenceSetStub = 
      ReferenceServiceV1Grpc.newBlockingStub(getChannel());
      
  Map<String, Reference> references = Maps.newHashMap();
  for (String referenceSetId : referenceSetIds) {
    LOG.info("Getting reference set " + referenceSetId);
    GetReferenceSetRequest getReferenceSetRequest = GetReferenceSetRequest
        .newBuilder().setReferenceSetId(referenceSetId).build();
    ReferenceSet referenceSet = 
        referenceSetStub.getReferenceSet(getReferenceSetRequest);
    if (referenceSet == null || referenceSet.getReferenceIdsCount() == 0) {
      continue;
    }
    for (String referenceId : referenceSet.getReferenceIdsList()) {
      LOG.fine("Getting reference  " + referenceId);
      GetReferenceRequest getReferenceRequest = GetReferenceRequest
          .newBuilder().setReferenceId(referenceId).build();
      Reference reference = referenceSetStub.getReference(getReferenceRequest);
      if (!Strings.isNullOrEmpty(reference.getName())) {
        references.put(reference.getName(), reference);
        LOG.fine("Adding reference  " + reference.getName());
      }
    }
  }
  return references;
}
 
開發者ID:googlegenomics,項目名稱:gatk-tools-java,代碼行數:51,代碼來源:GenomicsDataSource.java


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