Exemplo n.º 1
0
  /** Read a file that has all proteins in fasta format */
  void readProteinFile() {
    if (verbose) Timer.showStdErr("Reading proteins from file '" + proteinFile + "'...");
    proteinByTrId = new HashMap<String, String>();

    if (proteinFile.endsWith("txt") || proteinFile.endsWith("txt.gz")) readProteinFileTxt();
    else if (proteinFile.endsWith(SnpEffPredictorFactoryGenBank.EXTENSION_GENBANK))
      readProteinFileGenBank();
    else if (proteinFile.endsWith(SnpEffPredictorFactoryEmbl.EXTENSION_EMBL)) readProteinFileEmbl();
    else readProteinFileFasta();

    if (verbose) Timer.showStdErr("done (" + proteinByTrId.size() + " Proteins).");
  }
Exemplo n.º 2
0
  /** Check proteins using all possible codon tables */
  void checkCodonTables() {
    if (verbose) Timer.showStdErr("Comparing Proteins...");

    createTrByChromo(); // Create lists of transcripts by chromosome

    // For each chromosome...
    for (Chromosome chromo : genome) {
      String chr = chromo.getId();

      // Check against each codon table
      for (CodonTable codonTable : CodonTables.getInstance()) {
        setCodonTable(chromo, codonTable);
        proteinCompare(chr, false, false);
      }
    }

    if (verbose) Timer.showStdErr("done");
  }
Exemplo n.º 3
0
  /** Run command */
  @Override
  public boolean run() {
    if (verbose) Timer.showStdErr("Checking database using protein sequences");

    loadConfig(); // Load config
    readProteinFile(); // Read proteins
    loadDb(); // Load database
    checkProteins(); // Compare proteins

    return true;
  }
Exemplo n.º 4
0
  /** Check proteins */
  void checkProteins() {
    if (verbose) Timer.showStdErr("Comparing Proteins...");

    if (codonTables) {
      // Compare proteins using ALL codon tables
      checkCodonTables();
    } else {
      // Compare proteins
      proteinCompare(null, true, true);
    }
  }
Exemplo n.º 5
0
  /**
   * Read data from input stream
   *
   * @return true on success
   */
  @SuppressWarnings("unchecked")
  public boolean load(DataInputStream in) {
    try {
      chromosome = in.readUTF();
      size = in.readInt();
      if (verbose)
        Timer.showStdErr(
            "\tReading index for chromosome '" + chromosome + "' (index size: " + size + " )");

      // Sanity cgheck
      if (size < 0) return false;

      // Allocate arrays
      left = new int[size];
      right = new int[size];
      mid = new int[size];

      intersectFilePosStart = new long[size][];
      intersectFilePosEnd = new long[size][];
      intersect = new List[size];

      // Read array data
      for (int i = 0; i < size; i++) {
        left[i] = in.readInt();
        right[i] = in.readInt();
        mid[i] = in.readInt();

        int len = in.readInt();
        if (len > 0) {
          // Allocate
          intersectFilePosStart[i] = new long[len];
          intersectFilePosEnd[i] = new long[len];

          // Read values
          for (int j = 0; j < len; j++) {
            intersectFilePosStart[i][j] = in.readLong();
            intersectFilePosEnd[i][j] = in.readLong();
          }
        } else {
          intersectFilePosStart[i] = intersectFilePosEnd[i] = null;
        }
      }
    } catch (EOFException e) {
      return false;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    return true;
  }