コード例 #1
0
  public static Map<String, VCFHeader> getVCFHeadersFromRodPrefix(
      GenomeAnalysisEngine toolkit, String prefix) {
    Map<String, VCFHeader> data = new HashMap<String, VCFHeader>();

    // iterate to get all of the sample names
    List<ReferenceOrderedDataSource> dataSources = toolkit.getRodDataSources();
    for (ReferenceOrderedDataSource source : dataSources) {
      // ignore the rod if lacks the prefix
      if (!source.getName().startsWith(prefix)) continue;

      if (source.getHeader() != null && source.getHeader() instanceof VCFHeader)
        data.put(source.getName(), (VCFHeader) source.getHeader());
    }

    return data;
  }
コード例 #2
0
  public static Map<String, VCFHeader> getVCFHeadersFromRods(
      GenomeAnalysisEngine toolkit, Collection<String> rodNames) {
    Map<String, VCFHeader> data = new HashMap<String, VCFHeader>();

    // iterate to get all of the sample names
    List<ReferenceOrderedDataSource> dataSources = toolkit.getRodDataSources();
    for (ReferenceOrderedDataSource source : dataSources) {
      // ignore the rod if it's not in our list
      if (rodNames != null && !rodNames.contains(source.getName())) continue;

      if (source.getHeader() != null && source.getHeader() instanceof VCFHeader)
        data.put(source.getName(), (VCFHeader) source.getHeader());
    }

    return data;
  }
コード例 #3
0
  /**
   * Gets the header fields from all VCF rods input by the user
   *
   * @param toolkit GATK engine
   * @param rodNames names of rods to use, or null if we should use all possible ones
   * @return a set of all fields
   */
  public static Set<VCFHeaderLine> getHeaderFields(
      GenomeAnalysisEngine toolkit, Collection<String> rodNames) {

    // keep a map of sample name to occurrences encountered
    TreeSet<VCFHeaderLine> fields = new TreeSet<VCFHeaderLine>();

    // iterate to get all of the sample names
    List<ReferenceOrderedDataSource> dataSources = toolkit.getRodDataSources();
    for (ReferenceOrderedDataSource source : dataSources) {
      // ignore the rod if it's not in our list
      if (rodNames != null && !rodNames.contains(source.getName())) continue;

      if (source.getRecordType().equals(VariantContext.class)) {
        VCFHeader header = (VCFHeader) source.getHeader();
        if (header != null) fields.addAll(header.getMetaDataInSortedOrder());
      }
    }

    return fields;
  }