gc5k / GEAR

GEAR [GEnetic Analysis Repository], contact chenguobo@gmail.com;
https://github.com/gc5k/GEAR/wiki
18 stars 7 forks source link

BEDReader #2

Closed gc5k closed 3 years ago

gc5k commented 5 years ago

Two reset methods are needed. 1) reset() to the very beginning of the genotype stream 2) rollback(k) k individuals.

zzxiang commented 5 years ago

I think rollback(k) should be rollbackColumns(k) for k columns, right?

zzxiang commented 5 years ago

And what if I call rollbackColumns(3) when I'm at the 1st column?

gc5k commented 5 years ago

And what if I call rollbackColumns(3) when I'm at the 1st column?

rollback will be a low-frequent behavior, so, if it is called, overflow should be avoided before roll K back.

zzxiang commented 5 years ago

So if I call rollbackColumns(3) when I'm at the 2nd column, I should roll back to the 1st column of the same row instead of rolling back to the last column of the last row?

gc5k commented 5 years ago

So if I call rollbackColumns(3) when I'm at the 2nd column, I should roll back to the 1st column of the same row instead of rolling back to the last column of the last row?

then call System.exit(), if it rolls back off the table~

zzxiang commented 5 years ago

So if I call rollbackColumns(3) when I'm at the 2nd column, I should call System.exit() instead of rolling back to the 1st column of the same row?

zzxiang commented 5 years ago

Or do you want the following:

If I call rollbackColumns(3) when I'm at the 2nd column of the 2nd row, I should rollback to the 1st column of the 2nd row without calling System.exit().

If I call rollbackColumns(3) when I'm at the 2nd column of the 1st row, I should call System.exit().

gc5k commented 5 years ago

So if I call rollbackColumns(3) when I'm at the 2nd column, I should call System.exit() instead of rolling back to the 1st column of the same row?

Kill it. Because it is wrong to even think of rolling back "3" when you at "2". It is rolled back when it is fully secured.

zzxiang commented 5 years ago

Understood, just report error and exit whether I'm in the first row.

So if I call rollbackColumns(3) when I'm at the 2nd column, I should call System.exit() instead of rolling back to the 1st column of the same row?

Kill it. Because it is wrong to even think of rolling back "3" when you at "2". It is rolled back when it is fully secured.

zzxiang commented 5 years ago

Another question: bed stores 4 genotypes in a byte, so if I call rollbackColumns(3) when I'm at the 4th column and then call readNextByte(), what does readNextByte() return? The 1st byte or the 2nd byte?

zzxiang commented 5 years ago

Commit bc425e17e7bd54b7ae9bb2e547073d3ebbcce72d added BEDReader.reset.