Skip to content

Commit

Permalink
fix bug for false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
sdyy1990 committed Nov 3, 2017
1 parent d71cb7c commit 1749fc4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -13,6 +13,7 @@ To compile the SeqOthello tool chain, decompress the source code and execute the
```
./build.sh
```
Then you can find the compile resutls in the ```build/bin``` folder.

##Build
To build the SeqOthello structure, please first prepare the Jellyfish-generated Kmer files. For test purpose,
Expand All @@ -34,6 +35,11 @@ For all prompted input questions, just press Enter to use the default value for
```
And the generated SeqOthello file can be found in _out_ folder.

###Prepare the kmers in parallel
Each line of the generated scripts contains a command to prepare the files. The commands in each of the generated scripts can be executed in parallel. For example, with GNU Parallel, you can run

``` cat ConvertToBinary.sh | parallel ```

##Query

Containment Query
Expand All @@ -45,7 +51,7 @@ Coverage Query
```build/bin/Query --map-folder=out/ --transcript=test.fa --detail --output=queryresult --lthread=16 > querylog```

##OnlineQuery
use the following command to start a server on the machine, (e.g, on TCP port 3322). The service will run as a deamon.
Use the following command to start a server on the machine, (e.g., on TCP port 3322). The service will run as a deamon.

```build/bin/Query --map-folder=out/ --start-server-port 3322```

Expand Down
12 changes: 10 additions & 2 deletions seqothlib/L2Node.cpp
Expand Up @@ -154,6 +154,7 @@ bool L2EncodedValueListNode::smartQuery(const keyType *k, vector<uint32_t> &ret,
if (encodetype == L2NodeTypes::VALUE_INDEX_ENCODED) {
ret.clear();
if (IOLengthInBytes*index >= lines.size()) return true;
if (index==0) return true;
vector<uint32_t> decode;
valuelistDecode(&lines[IOLengthInBytes*index], decode, IOLengthInBytes);
if (decode.size()==0) return true;
Expand Down Expand Up @@ -203,8 +204,10 @@ void L2EncodedValueListNode::add(keyType &k, vector<uint32_t> & valuelist) { //
throw invalid_argument("can not add value list L2EncodedValueListNode");
keys.push_back(k);
vector<uint8_t> buff(IOLengthInBytes);
if (lines.size() == 0)
if (lines.size() == 0) {
lines.resize(IOLengthInBytes);
entrycnt++;
}
uint32_t curr = lines.size();
lines.resize(lines.size() + IOLengthInBytes);
valuelistEncode(&lines[curr], valuelist, true);
Expand All @@ -218,13 +221,18 @@ void L2EncodedValueListNode::addMAPP(keyType &k, vector<uint8_t> &mapp) {
if (encodetype!= L2NodeTypes::MAPP)
throw invalid_argument("can not add bitmap to L2EncodedValueListNode");
keys.push_back(k);
values.push_back(keycnt);
//TODO :: Need to pre-pend a record for false positives!
keycnt++;
entrycnt++;
if (lines.size() == 0) {
lines.resize(mapp.size());
entrycnt++;
}
if (mapp.size() != IOLengthInBytes) {
throw invalid_argument("can not add bitmap to L2ShortValuelist type");
}
lines.insert(lines.end(), mapp.begin(), mapp.end());
values.push_back(keycnt);
}

void L2ShortValueListNode::writeDataToGzipFile(string gzfname) {
Expand Down
4 changes: 1 addition & 3 deletions src/query.cc
Expand Up @@ -50,7 +50,6 @@ void getL1Result(SeqOthello * seqoth, const vector<string> & seq, const vector<i
printf("%s: L1 finished. Got %lu kmers. \n", get_thid().c_str(), TID.size());
};
void getL2Result(uint32_t high, const vector<L2Node *> &pvNodes, const vector<shared_ptr<vector<uint64_t>>> & vpvkmer, const vector<shared_ptr<vector<uint32_t>>> &vTID, unordered_map<int, vector<int>> *pans) {

int myid = workers.fetch_add(1);
unsigned int totkmer = 0;
for (auto const & p:vpvkmer)
Expand Down Expand Up @@ -89,14 +88,13 @@ void getL2Result(uint32_t high, const vector<L2Node *> &pvNodes, const vector<sh
/*
printf("Update pans %d:", TID[i]);
ConstantLengthKmerHelper<uint64_t, uint16_t> helper(D_KMERLENGTH,0);
ConstantLengthKmerHelper<uint64_t, uint16_t> helper(20,0);
printf( "%12llx:", kmers[i]);
char buf[30];
memset(buf,0,sizeof(buf));
uint64_t k = kmers[i];
helper.convertstring(buf,&k);
printf( "%s ", buf);
for (int v = 0 ; v < high; v++)
printf("%d ", pans->at(TID[i]).at(v));
printf("\n");
Expand Down

0 comments on commit 1749fc4

Please sign in to comment.