Пример #1
0
    public String[] getSamples() {

      if (this.tribbleFeatureSource.isIndexed()) {
        // Load the index for meta information.  Its already loaded, but not public in the htsjdk
        // class.
        Index idx = loadIndex(this.locator.getPath());
        if (idx != null) {
          Map<String, String> map = idx.getProperties();
          if (map != null && map.containsKey("samples")) {
            return Globals.commaPattern.split(map.get("samples"));
          }
        }
      }

      // Try to fetch features from codec.  This is to support a deprecated option to
      // specify sample names in the .mut or .maf file header.

      MUTCodec codec = new MUTCodec(locator.getPath(), null);
      return codec.getSamples();
    }
Пример #2
0
  public static Sorter getSorter(File inputFile, File outputFile) {

    String shortFN = inputFile.getName().toLowerCase();
    if (shortFN.endsWith(".txt")) {
      shortFN = shortFN.substring(0, shortFN.length() - 4);
    }
    if (shortFN.endsWith(".cn")
        || shortFN.endsWith(".xcn")
        || shortFN.endsWith(".snp")
        || shortFN.endsWith(".igv")) {
      return new CNSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".sam")) {
      return new SAMSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".aligned")
        || shortFN.endsWith(".bed")
        || shortFN.endsWith(".bedgraph")
        || shortFN.endsWith(".bdg")) {
      return new BedSorter(inputFile, outputFile);
    } else if (GFFFeatureSource.isGFF(shortFN)) {
      return new GFFSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".vcf")) {
      return new VCFSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".psl") || shortFN.endsWith(".pslx")) {
      return new BedSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".eqtl")) {
      return new EQTLSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".snp")) {
      return new GenericSorter(inputFile, outputFile, 1, 2);
    } else if (GWASParser.isGWASFile(shortFN)) {
      return new GWASSorter(inputFile, outputFile);
    } else if (MUTCodec.isMutationAnnotationFile(
        new ResourceLocator(inputFile.getAbsolutePath()))) {
      return new MUTSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".interaction")) {
      return new InteractionSorter(inputFile, outputFile);
    } else if (shortFN.endsWith(".bam")) {
      return new BAMSorter(inputFile, outputFile);
    } else {
      log.error("Unknown file type or sorting not supported for: " + inputFile.getName());
      return null;
    }
  }