$ samtools flagstat barcode06_0_calls.sorted.bam 2499617 + 0 in total (QC-passed reads + QC-failed reads) 2124344 + 0 primary 246248 + 0 secondary 129025 + 0 supplementary 0 + 0 duplicates 0 + 0 primary duplicates 1197500 + 0 mapped (47.91% : N/A) 822227 + 0 primary mapped (38.70% : N/A) 0 + 0 paired in sequencing 0 + 0 read1 0 + 0 read2 0 + 0 properly paired (N/A : N/A) 0 + 0 with itself and mate mapped 0 + 0 singletons (N/A : N/A) 0 + 0 with mate mapped to a different chr 0 + 0 with mate mapped to a different chr (mapQ>=5)
Running remora dataset prepare still gives an error like below (found it here, I lost mine LOL), querying chatgpt shows that there is no MD tag in the bam file.
1 2 3 4 5 6 7 8 9 10 11 12 13
Indexing BAM by parent readid: 3383 Reads [00:00, 145643.63 Reads/s] [11:52:01.676] Extracting read IDs from POD5 [11:52:01.696] Found 3,383 valid BAM records. Found signal in POD5 for 100.00% of BAM records. [11:52:01.697] Making reference-anchored training data [11:52:01.697] Opening dataset for output [11:52:02.158] Processing reads Extracting chunks: 100%|█████████████| 3383/3383 [00:00<00:00, 64772.53 Reads/s] [11:52:19.245] Unsuccessful read/chunk reasons: 3,383 : No reference sequence (missing MD tag) [11:52:19.680] Extracted 0 chunks from 3,383 reads. [11:52:19.680] Label distribution: [11:52:19.680] Shuffling dataset [11:52:19.681] Done
So I decide to dorado basecaller to generate MD tag directly.
1
dorado basecaller fast barcode06_0.pod5 --emit-moves --reference /data/biolab-nvme-pool1/zhaoxy/polyT_proj/bonito/HG38_ref.mmi > barcode06_0_calls.bam
Where the .mmi file is generated by
1
minimap2 -d reference.mmi reference.fasta
Results like below.
1 2 3 4 5 6 7 8 9 10 11 12 13
Indexing BAM by parent readid: 988718 Reads [00:08, 111136.05 Reads/s] [21:11:53.894] Extracting read IDs from POD5 [21:11:54.867] Found 960,686 valid BAM records. Found signal in POD5 for 100.00% of BAM records. [21:11:54.923] Making reference-anchored training data [21:11:54.924] Opening dataset for output [21:11:55.806] Processing reads Extracting chunks: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 959963/959963 [02:38<00:00, 6048.10 Reads/s][21:14:35.217] Unsuccessful read/chunk reasons: 900,695 : Unmapped read 59 : Sequence too long [21:14:36.123] Extracted 375,538 chunks from 960,686 reads. [21:14:36.125] Label distribution: control:375,538 [21:14:36.125] Shuffling dataset [21:14:44.266] Done
[22:24:42.546] Start training DEBUG [22:24:42.587:Process-1:MainThread:data_chunks.py:2596] Dataset worker 0 using super batch offsets 235206, 3642521 DEBUG [22:24:42.601:Process-2:MainThread:data_chunks.py:2596] Dataset worker 1 using super batch offsets 132909, 2131482 DEBUG [22:26:24.227:MainProcess:MainThread:train_model.py:546] Saving best model after 1 epochs with val_acc 0.667724609375 DEBUG [22:28:05.155:MainProcess:MainThread:train_model.py:546] Saving best model after 2 epochs with val_acc 0.6732177734375 DEBUG [22:31:29.841:MainProcess:MainThread:train_model.py:546] Saving best model after 4 epochs with val_acc 0.6737060546875 DEBUG [22:33:11.024:MainProcess:MainThread:train_model.py:546] Saving best model after 5 epochs with val_acc 0.677978515625 DEBUG [22:36:40.797:MainProcess:MainThread:train_model.py:546] Saving best model after 7 epochs with val_acc 0.67822265625 DEBUG [22:40:18.411:MainProcess:MainThread:train_model.py:546] Saving best model after 9 epochs with val_acc 0.6785888671875 DEBUG [22:42:06.939:MainProcess:MainThread:train_model.py:546] Saving best model after 10 epochs with val_acc 0.678955078125 DEBUG [22:47:37.572:MainProcess:MainThread:train_model.py:546] Saving best model after 13 epochs with val_acc 0.6790771484375 DEBUG [23:01:59.566:MainProcess:MainThread:train_model.py:546] Saving best model after 20 epochs with val_acc 0.6798095703125 DEBUG [23:04:08.326:MainProcess:MainThread:train_model.py:546] Saving best model after 21 epochs with val_acc 0.6807861328125 DEBUG [23:21:54.837:MainProcess:MainThread:train_model.py:546] Saving best model after 29 epochs with val_acc 0.68115234375 [23:45:27.898] No validation accuracy improvement after 10 epochs. Training stopped early. [23:45:27.898] Saving final model checkpoint [23:45:28.154] Done