Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
  /**
   * Gets the appropriately formatted header for a VCF file describing this GATK run
   *
   * @param engine the GATK engine that holds the walker name, GATK version, and other information
   * @param argumentSources contains information on the argument values provided to the GATK for
   *     converting to a command line string. Should be provided from the data in the parsing
   *     engine. Can be empty in which case the command line will be the empty string.
   * @return VCF header line describing this run of the GATK.
   */
  public static VCFHeaderLine getCommandLineArgumentHeaderLine(
      final GenomeAnalysisEngine engine, final Collection<Object> argumentSources) {
    if (engine == null) throw new IllegalArgumentException("engine cannot be null");
    if (argumentSources == null)
      throw new IllegalArgumentException("argumentSources cannot be null");

    final Map<String, String> attributes = new LinkedHashMap<>();
    attributes.put("ID", engine.getWalkerName());
    attributes.put("Version", CommandLineGATK.getVersionNumber());
    final Date date = new Date();
    attributes.put("Date", date.toString());
    attributes.put("Epoch", Long.toString(date.getTime()));
    attributes.put(
        "CommandLineOptions",
        engine.createApproximateCommandLineArgumentString(argumentSources.toArray()));
    return new VCFSimpleHeaderLine(GATK_COMMAND_LINE_KEY, attributes);
  }