Skip to content

Commit

Permalink
Add milliseconds to start_time, convert to UTC.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtRand committed Sep 21, 2022
1 parent 99a1712 commit c45905c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bonito/fast5.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from itertools import chain
from functools import partial
from multiprocessing import Pool
from datetime import datetime, timedelta
from datetime import timedelta, timezone

import numpy as np
import bonito.reader
Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(self, read, filename, meta=False, do_trim=True):

exp_start_dt = parser.parse(self.exp_start_time)
start_time = exp_start_dt + timedelta(seconds=self.start)
self.start_time = start_time.replace(microsecond=0).isoformat()
self.start_time = start_time.astimezone(timezone.utc).isoformat(timespec="milliseconds")

raw = read.handle[read.raw_dataset_name][:]
self.scaled = np.array(self.scaling * (raw + self.offset), dtype=np.float32)
Expand Down
4 changes: 2 additions & 2 deletions bonito/pod5.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from glob import glob
from uuid import UUID
from pathlib import Path
from datetime import timedelta
from datetime import timedelta, timezone

import numpy as np
import bonito.reader
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(self, read, filename, meta=False, do_trim=True):
self.duration = self.num_samples / self.sample_rate

start_time = self.acquisition_start_time + timedelta(seconds=self.start)
self.start_time = start_time.replace(microsecond=0).isoformat()
self.start_time = start_time.astimezone(timezone.utc).isoformat(timespec="milliseconds")

self.raw = read.signal

Expand Down
2 changes: 1 addition & 1 deletion documentation/SAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ bonito basecaller $model $data --reference ref.fasta > aligned.cram
| mx:i: | read mux |
| ch:i: | read channel |
| rn:i: | read number |
| st:Z: | read start time |
| st:Z: | read start time (in UTC) |
| f5:Z: | fast5 file name |
| sm:f: | scaling midpoint/mean/median (pA to ~0-mean/1-sd) |
| sd:f: | scaling dispersion (pA to ~0-mean/1-sd) |
Expand Down

0 comments on commit c45905c

Please sign in to comment.