コード例 #1
0
ファイル: MPHFAlgorithm.cpp プロジェクト: zy26/gatb-core
void MPHFAlgorithm<span,Abundance_t,NodeState_t>::execute ()
{
    /** We check whether we can use such a type. */
    if (_buildOrLoad == true)
    {
        /** We need a progress object. */
        tools::dp::IteratorListener* delegate = createIteratorListener(0,"");  LOCAL (delegate);
        setProgress (new ProgressCustom(delegate));

		

		//if MPHF_BOOPHF and verbose 0,  give a null progress to the builder, make it understand the internal progress bar of boophf needs to be removed
		if((typeid(*delegate) == typeid(tools::dp::IteratorListener)))
			setProgress    (0);


        // get number of threads from dispatcher
        unsigned int nbThreads = this->getDispatcher()->getExecutionUnitsNumber();

        /** We build the hash. */
        {   TIME_INFO (getTimeInfo(), "build");
            _abundanceMap->build (*_solidKmers, nbThreads, _progress);
        }

        /** We save the hash object in the dedicated storage group. */
        {   TIME_INFO (getTimeInfo(), "save");
            _dataSize = _abundanceMap->save (_group, _name);
        }

        /** We populate the hash table. */
        populate ();
        
        /** init a clean node state map */
        initNodeStates ();
    }
}
コード例 #2
0
ファイル: index.cpp プロジェクト: acgtun/gpu-perm
int main(int argc, char* argv[]) {
  Option opt;
  GetParameter(argc, argv, opt);

  CReference refGenome;
  CHashTable hashTable;

  TIME_INFO(BuildIndex(opt, &refGenome, &hashTable), "Build index");

  /* release memory*/
  free(refGenome.refSeq);
  free(hashTable.counter);
  free(hashTable.index);

  return 0;
}
コード例 #3
0
ファイル: MPHFAlgorithm.cpp プロジェクト: zy26/gatb-core
MPHFAlgorithm<span,Abundance_t,NodeState_t>::MPHFAlgorithm (
    Group&              group,
    const std::string&  name,
    Iterable<Count>*    solidCounts,
    Iterable<Type>*     solidKmers,
    unsigned int        nbCores,
    bool                buildOrLoad,
    IProperties*        options
)
    :  Algorithm("mphf", nbCores, options), _group(group), _name(name), _buildOrLoad(buildOrLoad),
       _dataSize(0), _nb_abundances_above_precision(0), _solidCounts(0), _solidKmers(0), _abundanceMap(0), _nodeStateMap(0), _adjacencyMap(0), _progress(0)
{
    /** We keep a reference on the solid kmers. */
    setSolidCounts (solidCounts);

    /** We keep a reference on the solid kmers. */
    setSolidKmers (solidKmers);

    /** We build the hash object. */
    setAbundanceMap (new AbundanceMap());
    setNodeStateMap (new NodeStateMap());
    setAdjacencyMap (new AdjacencyMap());

    /** In case of load, we load the mphf and populate right now. */
    if (buildOrLoad == false)
    {
        /** We load the hash object from the dedicated storage group. */
        {   TIME_INFO (getTimeInfo(), "load");
            _abundanceMap->load (_group, _name);
        }

        /** We populate the abundance hash table. */
        populate ();

        /** init a clean node state map */
        initNodeStates ();
    }
}
コード例 #4
0
ファイル: alloc_kernel.cpp プロジェクト: acgtun/gpu-perm
void ReadReads(const Option & opt, const CReference * refGenome,
               const CHashTable * hashTable) {
  FILE * fout = fopen(opt.outputFile.c_str(), "wb");
  CRead * reads, *reads_rev;
  CRegion * region;
  char * strReads;

  MEMORY_ALLOCATE_CHECK(
      reads = (CRead *) malloc(MAX_MAPPING_READS * sizeof(CRead)));
  MEMORY_ALLOCATE_CHECK(
      reads_rev = (CRead *) malloc(MAX_MAPPING_READS * sizeof(CRead)));
  MEMORY_ALLOCATE_CHECK(
      region = (CRegion *) malloc(
          MAX_MAPPING_READS * TOTAL_SHIFT_rev * sizeof(CRegion)));

  /* read reads from the file*/
  INFO("read reads from", opt.readsFile);
  SIZE_T readsLen = ReadWholeFile(opt.readsFile, &strReads);

  char strRead[MAX_LINE_LEN];
  SIZE_T nReadsNum = 0;
  SIZE_T readID = 0;
  map < SIZE_T, SIZE_T > mapPosCount;

  for (SIZE_T i = 0; i < readsLen; i++) {
    SIZE_T len = GetLineFromString(&strReads[i], strRead);
    i += len;
    if (strRead[0] != '>' && len != 0) {
      CHECK_READ_LEN(len, nReadsNum);
      strcpy(reads[nReadsNum].readInStr, strRead);
      reads[nReadsNum].readLen = len;
      nReadsNum++;
    }

    if (nReadsNum == MAX_MAPPING_READS
        || (nReadsNum > 0 && i >= readsLen - 1)) {
      Reverse_Kernel(reads, reads_rev, nReadsNum);
      SIZE_T NUM = TOTAL_SHIFT_rev * nReadsNum;
      TIME_INFO(
          Match_Kernel(refGenome, hashTable, reads, reads_rev, region, NUM),
          "match time");

      for (SIZE_T i = 0; i < NUM; i++) {
        for (SIZE_T j = region[i].lower; j <= region[i].upper; j++) {
          mapPosCount[hashTable->index[j] - i % TOTAL_SHIFT]++;
        }
        if ((i + 1) % TOTAL_SHIFT == 0) {
          for (map<SIZE_T, SIZE_T>::iterator it = mapPosCount.begin();
              it != mapPosCount.end(); it++) {
            if (it->second > 1) {
              fprintf(fout, "read %d: %d %d\n", i / TOTAL_SHIFT_rev, it->first,
                      it->second);
            }
          }
          mapPosCount.clear();
        }
      }
      readID += nReadsNum;
      nReadsNum = 0;
    }
  }

  fclose(fout);
  free(strReads);
  free(reads);
  free(region);
}
コード例 #5
0
ファイル: migrate.c プロジェクト: lastweek/NVM
static void migrate_exit(void)
{
	hrtimer_cancel(&migrate_hrtimer);
	TIME_INFO();
}