-
Notifications
You must be signed in to change notification settings - Fork 11
/
flybase_loader.pl
3536 lines (3347 loc) · 146 KB
/
flybase_loader.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Project: MeTTaLog - A MeTTa to Prolog Transpiler/Interpreter
* Description: This file is part of the source code for a transpiler designed to convert
* MeTTa language programs into Prolog, utilizing the SWI-Prolog compiler for
* optimizing and transforming function/logic programs. It handles different
* logical constructs and performs conversions between functions and predicates.
*
* Author: Douglas R. Miles
* Contact: [email protected] / [email protected]
* License: LGPL
* Repository: https://github.com/trueagi-io/metta-wam
* https://github.com/logicmoo/hyperon-wam
* Created Date: 8/23/2023
* Last Modified: $LastChangedDate$ # You will replace this with Git automation
*
* Usage: This file is a part of the transpiler that transforms MeTTa programs into Prolog. For details
* on how to contribute or use this project, please refer to the repository README or the project documentation.
*
* Contribution: Contributions are welcome! For contributing guidelines, please check the CONTRIBUTING.md
* file in the repository.
*
* Notes:
* - Ensure you have SWI-Prolog installed and properly configured to use this transpiler.
* - This project is under active development, and we welcome feedback and contributions.
*
* Acknowledgments: Special thanks to all contributors and the open source community for their support and contributions.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
%*********************************************************************************************
% PROGRAM FUNCTION: converts FlyBase biological data from various file formats (TSV, JSON, OBO, etc.)
% into Prolog facts and MeTTa/datalog representations while handling data type conversions and
% maintaining statistics about loaded content.
%*********************************************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% IMPORTANT: DO NOT DELETE COMMENTED-OUT CODE AS IT MAY BE UN-COMMENTED AND USED
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/* mined
; Total Atoms (Atomspace size): .................................................. 56,354,849
; ConceptNodes: ............................................................. 9,472,616
; Bytes Per Atom (Average): ....................................................... 140
; Bytes Per ConceptNode (Average): ................................................ 120
; Relational Memory: ............................................................ 7.39G
; ConceptNode Memory: ........................................................... 1.07G
; Atoms per minute: ......................................................... 3,491,880
; Total Physical Memory Used: ................................................... 9.08G
; Runtime (days:hh:mm:ss): ................................................. 0:00:16:08
; Total Atoms (Atomspace size): .................................................. 38,812,356
; ConceptNodes: ............................................................. 9,380,821
; Total Memory Used: ............................................................ 8.26G
; Runtime (days:hh:mm:ss): ................................................. 0:00:19:15
; Total Atoms (Atomspace size): .................................................. 38,822,366
; ConceptNodes: ............................................................. 9,824,355
; Random samples: ................................................................. 805
; Total Memory Used: ............................................................ 8.18G
; Runtime (days:hh:mm:ss): ................................................. 0:00:08:28
*/
%! recount_total_loaded_symbols is det.
%
% Resets and updates the counter for the total number of loaded symbols
% in the system. This predicate uses a flag-based mechanism to manage the count.
%
% The `total_loaded_symbols` flag is first reset to `0`. The current count of
% fully loaded atoms is retrieved using `full_atom_count/1`, and this value is
% stored back in the `total_loaded_symbols` flag.
%
% @details
% This predicate ensures that the system maintains an accurate record of the
% loaded symbols by fetching the current state from `full_atom_count/1`.
%
% @example
% % Recount and update the total number of loaded symbols:
% ?- recount_total_loaded_symbols.
%
% % Check the updated count of total loaded symbols:
% ?- flag(total_loaded_symbols, Current, Current).
% Current = <updated_count>.
%
recount_total_loaded_symbols :-
% Reset the `total_loaded_symbols` flag to zero.
flag(total_loaded_symbols, _, 0),
% Retrieve the current count of fully loaded atoms.
full_atom_count(Was),
% Update the `total_loaded_symbols` flag with the retrieved count.
flag(total_loaded_symbols, _, Was).
%! load_flybase is det.
%
% Loads FlyBase data and converts it from CSV to Prolog format.
%
% Depending on the Prolog environment (e.g., Scryer Prolog), the predicate
% invokes the appropriate sequence of operations to load the data and prepare it
% for use. This includes recounting total loaded symbols, cleaning up arities,
% and generating statistics on the FlyBase data.
%
% @details
% - If the system is identified as Scryer Prolog (using `is_scryer/0`),
% only the `load_flybase_files/0` operation is performed.
% - In other environments, it processes FlyBase data by enabling the
% `mettafiles` option, recompiling necessary components (`make`), recounting
% symbols, loading files, cleaning up arities, and finally gathering statistics.
%
% @example
% % Load FlyBase data:
% ?- load_flybase.
%
% % Check if data has been properly loaded and processed.
%
load_flybase :-
% Check if the system is Scryer Prolog.
is_scryer, !,
% Load FlyBase files directly in Scryer.
load_flybase_files.
load_flybase :-
% Enable `mettafiles` option as false and perform FlyBase data processing.
with_option(mettafiles, false,
( make,
recount_total_loaded_symbols,
!,
load_flybase_files,
!,
cleanup_arities,
!,
fb_stats)).
%! load_flybase_dirs is det.
%
% Loads FlyBase data from specific directories.
%
% This predicate specifies multiple directories where FlyBase data may be located
% and loads the data from these paths. It uses wildcards to match multiple files.
%
% @details
% The directories include:
% - Current release DAS precomputed files (`./data/ftp.flybase.net/releases/current/das_precomputed/*`).
% - Other precomputed files (`./precomputed_files/*`).
% - Specific files containing "sv" in their paths (`./data/ftp.flybase.net/releases/current/./*sv`).
%
% @example
% % Load FlyBase data from specified directories:
% ?- load_flybase_dirs.
%
load_flybase_dirs :-
% Load FlyBase data from current DAS precomputed directory.
load_flybase('./data/ftp.flybase.net/releases/current/das_precomputed/*'),
% Load FlyBase data from precomputed files directory.
load_flybase('./precomputed_files/*'),
% Load FlyBase data from directories containing "sv".
load_flybase('./data/ftp.flybase.net/releases/current/./*sv'), !.
file_search_path(fb_current,'/wam/data/FB_current/').
/*
find . -type f -exec wc -l {} \; | awk -F'/' '{
dir=".";
size=$1;
file=$NF;
for(i=2; i<NF; i++) dir=(dir "/" $i);
print size, dir, file
}' | sort -k3,3 -k1,1n | awk '{
number = sprintf("%\047d", $1);
gsub(/,/, "_", number);
printf " load_data(%16s, fb_current(%s%s/%s%s)),\n", number, "\"", $3, $4, "\""
}' | sed -e "s/\"/'/g" -e 's|20.....|*|g'
*/
% Informs the system that the clauses of column_names/2 might not be together in the source file.
:- discontiguous column_names/2.
%! load_data_fb_data is det.
%
% Loads FlyBase data from multiple specified sources and formats.
%
% This predicate sequentially invokes the `load_data/2` predicate for various
% FlyBase data files. These files are categorized by type (e.g., `chado-xml`,
% `dmel_r6.56`, `precomputed_files`) and format (e.g., `.dtd`, `.xml`, `.tsv`,
% `.fasta`, `.obo`, `.json`). Each `load_data/2` invocation is parameterized
% with a numeric identifier and the file path, indicating the estimated size
% or order of loading.
%
% @details
% - The predicate is comprehensive, covering a wide range of data, including
% annotations, ontologies, genetic interactions, gene expression data, and
% more.
% - It uses a uniform structure for loading, ensuring consistent handling of
% all file types and sources.
% - The final `!` ensures the loading process concludes deterministically.
%
% @example
% % Load all FlyBase data:
% ?- load_data_fb_data.
%
% % Verify that the data has been loaded successfully and is accessible
% % in the Prolog environment.
%
load_data_fb_data:-
load_data( 64, fb_current('./chado-xml/chado_FBim.dtd')),
load_data( 76, fb_current('./chado-xml/chado_FBst.dtd')),
load_data( 84, fb_current('./chado-xml/chado_FBch.dtd')),
load_data( 94, fb_current('./chado-xml/chado_FBba.dtd')),
load_data( 98, fb_current('./chado-xml/chado_FBco.dtd')),
load_data( 102, fb_current('./chado-xml/chado_FBtc.dtd')),
load_data( 104, fb_current('./chado-xml/chado_FBte.dtd')),
load_data( 104, fb_current('./chado-xml/chado_FBto.dtd')),
load_data( 116, fb_current('./chado-xml/chado_FBsn.dtd')),
load_data( 118, fb_current('./chado-xml/chado_FBtr.dtd')),
load_data( 128, fb_current('./chado-xml/chado_FBig.dtd')),
load_data( 132, fb_current('./chado-xml/chado_FBgg.dtd')),
load_data( 136, fb_current('./chado-xml/chado_FBab.dtd')),
load_data( 136, fb_current('./chado-xml/chado_FBpp.dtd')),
load_data( 144, fb_current('./chado-xml/chado_FBcl.dtd')),
load_data( 154, fb_current('./chado-xml/chado_FBtp.dtd')),
load_data( 156, fb_current('./chado-xml/chado_FBlc.dtd')),
load_data( 156, fb_current('./chado-xml/chado_FBti.dtd')),
load_data( 158, fb_current('./chado-xml/chado_FBsf.dtd')),
load_data( 160, fb_current('./chado-xml/chado_FBal.dtd')),
load_data( 162, fb_current('./chado-xml/chado_FBrf.dtd')),
load_data( 172, fb_current('./chado-xml/chado_FBhh.dtd')),
load_data( 234, fb_current('./chado-xml/chado_FBgn.dtd')),
load_data( 466_642, fb_current('./chado-xml/chado_FBim.xml')),
load_data( 504_174, fb_current('./chado-xml/chado_FBba.xml')),
load_data( 664_653, fb_current('./chado-xml/chado_FBsn.xml')),
load_data( 673_011, fb_current('./chado-xml/chado_FBtc.xml')),
load_data( 703_891, fb_current('./chado-xml/chado_FBco.xml')),
load_data( 2_609_997, fb_current('./chado-xml/chado_FBch.xml')),
load_data( 7_339_713, fb_current('./chado-xml/chado_FBte.xml')),
load_data( 14_830_637, fb_current('./chado-xml/chado_FBgg.xml')),
load_data( 20_919_950, fb_current('./chado-xml/chado_FBst.xml')),
load_data( 26_767_347, fb_current('./chado-xml/chado_FBig.xml')),
load_data( 26_818_296, fb_current('./chado-xml/chado_FBab.xml')),
load_data( 37_216_220, fb_current('./chado-xml/chado_FBpp.xml')),
load_data( 55_429_842, fb_current('./chado-xml/chado_FBhh.xml')),
load_data( 82_559_962, fb_current('./chado-xml/chado_FBto.xml')),
load_data( 95_417_605, fb_current('./chado-xml/chado_FBtr.xml')),
load_data( 139_237_689, fb_current('./chado-xml/chado_FBti.xml')),
load_data( 168_912_941, fb_current('./chado-xml/chado_FBrf.xml')),
load_data( 259_648_210, fb_current('./chado-xml/chado_FBal.xml')),
load_data( 274_962_987, fb_current('./chado-xml/chado_FBtp.xml')),
load_data( 392_245_861, fb_current('./chado-xml/chado_FBsf.xml')),
load_data( 588_536_952, fb_current('./chado-xml/chado_FBcl.xml')),
load_data( 1_287_499_618, fb_current('./chado-xml/chado_FBlc.xml')),
load_data( 5_155_405_685, fb_current('./chado-xml/chado_FBog.xml')),
load_data( 5_354_257_324, fb_current('./chado-xml/chado_FBgn.xml')),
load_data( 132_884, fb_current('./dmel_r6.56/chado-xml/chado_dmel_scaffolds.xml')),
load_data( 568_549, fb_current('./dmel_r6.56/chado-xml/chado_dmel_intergenic.xml')),
load_data( 586_821, fb_current('./dmel_r6.56/chado-xml/chado_dmel_repeat_regions.xml')),
load_data( 2_893_700, fb_current('./dmel_r6.56/chado-xml/chado_dmel_syntenic.xml')),
load_data( 30_716_865, fb_current('./dmel_r6.56/chado-xml/chado_dmel_misc_features.xml')),
load_data( 108_816_559, fb_current('./dmel_r6.56/chado-xml/chado_dmel_predicted.xml')),
load_data( 522_030_598, fb_current('./dmel_r6.56/chado-xml/chado_dmel_gene_models.xml')),
load_data( 1_335_239_246, fb_current('./dmel_r6.56/chado-xml/chado_dmel_aligned.xml')),
load_data( 1_870, fb_current('./dmel_r6.56/dna/dmel-raw_scaffolds-r6.56.tar')),
load_data( 667, fb_current('./dmel_r6.56/fasta/dmel-all-tRNA-r6.56.fasta')),
load_data( 1_676, fb_current('./dmel_r6.56/fasta/dmel-all-miRNA-r6.56.fasta')),
load_data( 1_709, fb_current('./dmel_r6.56/fasta/dmel-all-miscRNA-r6.56.fasta')),
load_data( 4_137, fb_current('./dmel_r6.56/fasta/dmel-all-pseudogene-r6.56.fasta')),
load_data( 46_464, fb_current('./dmel_r6.56/fasta/dmel-all-ncRNA-r6.56.fasta')),
load_data( 112_847, fb_current('./dmel_r6.56/fasta/dmel-all-transposon-r6.56.fasta')),
load_data( 165_310, fb_current('./dmel_r6.56/fasta/dmel-all-five_prime_UTR-r6.56.fasta')),
load_data( 273_148, fb_current('./dmel_r6.56/fasta/dmel-all-three_prime_UTR-r6.56.fasta')),
load_data( 300_869, fb_current('./dmel_r6.56/fasta/dmel-all-translation-r6.56.fasta')),
load_data( 563_767, fb_current('./dmel_r6.56/fasta/dmel-all-intergenic-r6.56.fasta')),
load_data( 709_312, fb_current('./dmel_r6.56/fasta/dmel-all-exon-r6.56.fasta')),
load_data( 811_702, fb_current('./dmel_r6.56/fasta/dmel-all-CDS-r6.56.fasta')),
load_data( 1_158_900, fb_current('./dmel_r6.56/fasta/dmel-all-transcript-r6.56.fasta')),
load_data( 1_190_673, fb_current('./dmel_r6.56/fasta/dmel-all-synteny-r6.56.fasta')),
load_data( 1_312_171, fb_current('./dmel_r6.56/fasta/dmel-all-gene-r6.56.fasta')),
load_data( 1_586_746, fb_current('./dmel_r6.56/fasta/dmel-all-intron-r6.56.fasta')),
load_data( 1_799_389, fb_current('./dmel_r6.56/fasta/dmel-all-chromosome-r6.56.fasta')),
load_data( 2_205_176, fb_current('./dmel_r6.56/fasta/dmel-all-gene_extended2000-r6.56.fasta')),
load_data( 6_577_953, fb_current('./dmel_r6.56/fasta/dmel-all-predicted-r6.56.fasta')),
load_data( 7_128_567, fb_current('./dmel_r6.56/fasta/dmel-all-clones-r6.56.fasta')),
load_data( 10_205_467, fb_current('./dmel_r6.56/fasta/dmel-all-sequence_features-r6.56.fasta')),
load_data( 75_894_094, fb_current('./dmel_r6.56/fasta/dmel-all-aligned-r6.56.fasta')),
load_data( 33_369_054, fb_current('./dmel_r6.56/gff/dmel-all-r6.56.gff')),
load_data( 549_131, fb_current('./dmel_r6.56/gtf/dmel-all-r6.56.gtf')),
load_data( 293_958, fb_current('./precomputed_files/alleles/fbal_to_fbgn_fb_*.tsv')),
load_data( 367_019, fb_current('./precomputed_files/alleles/allele_genetic_interactions_fb_*.tsv')),
load_data( 384_970, fb_current('./precomputed_files/alleles/genotype_phenotype_data_fb_*.tsv')),
load_data( 50_407, fb_current('./precomputed_files/clones/genomic_clone_data_fb_*.tsv')),
load_data( 722_577, fb_current('./precomputed_files/clones/cDNA_clone_data_fb_*.tsv')),
load_data( 18_864, fb_current('./precomputed_files/collaborators/gp_information.fb')),
load_data( 28_237, fb_current('./precomputed_files/collaborators/fbgn_uniprot_fb_*.tsv')),
load_data( 2_291_091, fb_current('./precomputed_files/collaborators/pmid_fbgn_uniprot_fb_*.tsv')),
load_data( 177, fb_current('./precomputed_files/genes/fbgn_gleanr_fb_*.tsv')),
load_data( 477, fb_current('./precomputed_files/genes/gene_functional_complementation_fb_*.tsv')),
load_data( 1_022, fb_current('./precomputed_files/genes/pathway_group_data_fb_*.tsv')),
load_data( 1_804, fb_current('./precomputed_files/genes/gene_groups_HGNC_fb_*.tsv')),
load_data( 3_971, fb_current('./precomputed_files/genes/Dmel_enzyme_data_fb_*.tsv')),
load_data( 11_307, fb_current('./precomputed_files/genes/gene_group_data_fb_*.tsv')),
load_data( 12_497, fb_current('./precomputed_files/genes/fbgn_exons2affy1_overlaps.tsv')),
load_data( 13_746, fb_current('./precomputed_files/genes/fbgn_exons2affy2_overlaps.tsv')),
load_data( 13_750, fb_current('./precomputed_files/genes/best_gene_summary_fb_*.tsv')),
load_data( 13_994, fb_current('./precomputed_files/genes/gene_snapshots_fb_*.tsv')),
load_data( 14_303, fb_current('./precomputed_files/genes/FlyCellAtlas_slimmed_gene_expression_fb_*.tsv')),
load_data( 17_770, fb_current('./precomputed_files/genes/gene_rpkm_matrix_fb_*.tsv')),
load_data( 17_877, fb_current('./precomputed_files/genes/fbgn_annotation_ID_fb_*.tsv')),
load_data( 17_877, fb_current('./precomputed_files/genes/fbgn_annotation_ID.tsv')),
load_data( 20_469, fb_current('./precomputed_files/genes/gene_genetic_interactions_fb_*.tsv')),
load_data( 22_461, fb_current('./precomputed_files/genes/dmel_unique_protein_isoforms_fb_*.tsv')),
load_data( 34_826, fb_current('./precomputed_files/genes/gene_map_table_fb_*.tsv')),
load_data( 35_708, fb_current('./precomputed_files/genes/fbgn_fbtr_fbpp_expanded_fb_*.tsv')),
load_data( 35_708, fb_current('./precomputed_files/genes/fbgn_fbtr_fbpp_fb_*.tsv')),
load_data( 38_524, fb_current('./precomputed_files/genes/dmel_gene_sequence_ontology_annotations_fb_*.tsv')),
load_data( 40_044, fb_current('./precomputed_files/genes/automated_gene_summaries_fb_*.tsv')),
load_data( 40_044, fb_current('./precomputed_files/genes/automated_gene_summaries.tsv')),
load_data( 52_694, fb_current('./precomputed_files/genes/physical_interactions_mitab_fb_*.tsv')),
load_data( 211_391, fb_current('./precomputed_files/genes/ncRNA_genes_fb_*.json')),
load_data( 946_090, fb_current('./precomputed_files/genes/fbgn_NAseq_Uniprot_fb_*.tsv')),
load_data( 2_188_277, fb_current('./precomputed_files/genes/gene_rpkm_report_fb_*.tsv')),
load_data( 2_966_086, fb_current('./precomputed_files/genes/high-throughput_gene_expression_fb_*.tsv')),
load_data( 14_765_500, fb_current('./precomputed_files/genes/scRNA-Seq_gene_expression_fb_*.tsv')),
load_data( 134_598, fb_current('./precomputed_files/go/gene_association.fb')),
load_data( 27_686, fb_current('./precomputed_files/human_disease/disease_model_annotations_fb_*.tsv')),
load_data( 2_632, fb_current('./precomputed_files/insertions/construct_maps.zip')),
load_data( 46_116, fb_current('./precomputed_files/insertions/fu_gal4_table_fb_*.json')),
load_data( 218_236, fb_current('./precomputed_files/insertions/insertion_mapping_fb_*.tsv')),
load_data( 602, fb_current('./precomputed_files/map_conversion/cyto-genetic-seq.tsv')),
load_data( 607, fb_current('./precomputed_files/map_conversion/cytotable.txt')),
load_data( 5_040, fb_current('./precomputed_files/map_conversion/genome-cyto-seq.txt')),
load_data( 23_576_029, fb_current('./precomputed_files/metadata/dataset_metadata_fb_*.tsv')),
load_data( 607, fb_current('./precomputed_files/ontologies/flybase_stock_vocabulary.obo')),
load_data( 1_351, fb_current('./precomputed_files/ontologies/image.obo')),
load_data( 2_038, fb_current('./precomputed_files/ontologies/fly_development.obo')),
load_data( 10_348, fb_current('./precomputed_files/ontologies/flybase_controlled_vocabulary.obo')),
load_data( 12_691, fb_current('./precomputed_files/ontologies/psi-mi.obo')),
load_data( 14_673, fb_current('./precomputed_files/ontologies/gene_group_FB*.obo')),
load_data( 24_773, fb_current('./precomputed_files/ontologies/so-simple.obo')),
load_data( 24_940, fb_current('./precomputed_files/ontologies/slice.chebi.obo')),
load_data( 157_356, fb_current('./precomputed_files/ontologies/doid.obo')),
load_data( 263_738, fb_current('./precomputed_files/ontologies/fly_anatomy.obo')),
load_data( 547_441, fb_current('./precomputed_files/ontologies/go-basic.obo')),
load_data( 3_468_781, fb_current('./precomputed_files/ontologies/chebi_fb_*.obo')),
load_data( 35_114, fb_current('./precomputed_files/orthologs/dmel_human_orthologs_disease_fb_*.tsv')),
load_data( 223_061, fb_current('./precomputed_files/orthologs/dmel_paralogs_fb_*.tsv')),
load_data( 100_685, fb_current('./precomputed_files/references/fbrf_pmid_pmcid_doi_fb_*.tsv')),
load_data( 5_075_301, fb_current('./precomputed_files/references/entity_publication_fb_*.tsv')),
load_data( 59_754, fb_current('./precomputed_files/species/organism_list_fb_*.tsv')),
load_data( 178_104, fb_current('./precomputed_files/stocks/stocks_FB*.tsv')),
load_data( 807_717, fb_current('./precomputed_files/synonyms/fb_synonym_fb_*.tsv')),
load_data( 924, fb_current('./precomputed_files/transposons/transposon_sequence_set.gff')),
load_data( 13_574, fb_current('./precomputed_files/transposons/transposon_sequence_set.fa')),
!.
%:- ensure_loaded(obo_loader).
%
%! create_flybase_qlf is det.
%
% Creates a compiled FlyBase file in QLF format using SWI-Prolog.
%
% This predicate invokes the `swipl` shell command with the goal of
% compiling the `whole_flybase` file into QLF format. This allows for
% efficient loading and querying in SWI-Prolog.
%
% @example
% % Compile FlyBase into QLF format:
% ?- create_flybase_qlf.
%
create_flybase_qlf :-
shell('swipl -g "qcompile(whole_flybase)').
%! create_flybase_pl(+FtpDir) is det.
%
% Creates a FlyBase Prolog database file.
%
% If the argument `FtpDir` is provided, it is ignored, and the base predicate
% `create_flybase_pl/0` is invoked. This is a placeholder to maintain API
% consistency but does not currently use the argument.
%
% @arg FtpDir The directory containing FlyBase data (currently unused).
%
% @example
% % Create a FlyBase Prolog database:
% ?- create_flybase_pl(_FtpDir).
%
create_flybase_pl(_FtpDir) :-
create_flybase_pl.
%! create_flybase_pl is det.
%
% Processes and saves FlyBase data into a Prolog database file.
%
% This predicate executes the full sequence of FlyBase data processing,
% including:
% - Preparing the environment with `all_data_once/0`.
% - Loading the full FlyBase dataset with `load_flybase_full/0`.
% - Completing the process with `all_data_done/0`.
%
% This workflow ensures that the entire FlyBase dataset is processed and saved.
%
% @example
% % Process and save FlyBase data into a Prolog file:
% ?- create_flybase_pl.
%
create_flybase_pl :-
all_data_once,
% all_metta_once, % Uncomment if metta processing is required.
load_flybase_full,
all_data_done.
% all_metta_done, % Uncomment if metta processing is required.
% shell('mv whole_metta.pl whole_flybase.pl'). % Uncomment if renaming is needed.
%! create_flybase_pl_tiny is det.
%
% Processes and saves a reduced FlyBase dataset into a Prolog database file.
%
% This predicate executes a similar workflow to `create_flybase_pl/0`, but it
% processes a smaller, reduced FlyBase dataset using `load_flybase_tiny/0`. The
% output is saved as `tiny_flybase.pl`.
%
% @example
% % Process and save a tiny FlyBase dataset into a Prolog file:
% ?- create_flybase_pl_tiny.
%
create_flybase_pl_tiny :-
all_data_once,
% all_metta_once, % Uncomment if metta processing is required.
load_flybase_tiny,
all_data_done,
% all_metta_done, % Uncomment if metta processing is required.
shell('mv whole_metta.pl tiny_flybase.pl').
%! save_to_pl is det.
%
% Saves the FlyBase data to a Prolog file.
%
% This predicate writes all FlyBase predicates and their definitions to a file
% named `flybase_metta.pl`. It iterates over all predicates matching `fb_pred(F, A)`
% and uses `listing/1` to output their definitions.
%
% @example
% % Save FlyBase data to a Prolog file:
% ?- save_to_pl.
%
save_to_pl :-
% Open the file for writing.
tell('flybase_metta.pl'),
% List all predicates matching `fb_pred(F, A)` and write them to the file.
forall(fb_pred(F, A), listing(F/A)),
% Close the file.
told.
%! real_assert(+OBO) is det.
%
% Asserts or processes the given object (`OBO`) in the appropriate context.
%
% This predicate handles assertion in different scenarios:
% - If the system is in conversion mode (`is_converting/0`) and not currently
% loading a file, it throws an exception to avoid direct assertion.
% - Otherwise, it attempts to process the object through `real_assert1/1`
% and `real_assert2/1` for handling output or internal storage.
%
% @arg OBO The object to be asserted or processed.
%
% @example
% % Assert or process an object:
% ?- real_assert(my_object).
%
real_assert(OBO) :-
% If in conversion mode but not loading a file, throw an exception.
is_converting,\+ is_loading_file(_File), !,throw(real_assert(OBO)).
real_assert(OBO) :-
% Process the object using `real_assert1/1` and `real_assert2/1`.
ignore(real_assert1(OBO)),real_assert2(OBO).
% commented code for debugging or alternate behaviors:
% real_assert(OBO):- is_converting, !, print_src(OBO).
%! real_assert1(+OBO) is det.
%
% Writes the source representation of the object (`OBO`) to the `all_metta_to/1` stream.
%
% @arg OBO The object whose source is to be written.
%
real_assert1(OBO) :- all_metta_to(Out),!,with_output_to(Out, print_src(OBO)).
%! real_assert2(+OBO) is det.
%
% Handles the secondary assertion of the object (`OBO`) for various contexts.
% - Writes the canonical representation to the `all_data_to/1` stream.
% - Throws an exception if in conversion mode and unhandled.
% - Invokes `pfcAdd_Now/1` to add the object.
%
% @arg OBO The object to process.
%
real_assert2(OBO) :-
% Write the canonical representation to the `all_data_to/1` stream.
all_data_to(Out),!,write_canonical(Out, OBO),!,writeln(Out, '.').
real_assert2(OBO) :-
% Throw an exception if in conversion mode and unhandled.
is_converting,!,throw(real_assert2(OBO)).
% commented code for alternative behaviors:
% real_assert2(OBO):- call(OBO),!.
real_assert2(OBO) :-
% Add the object using `pfcAdd_Now/1`.
pfcAdd_Now(OBO).
%! print_src(+OBO) is det.
%
% Prints the source representation of the given object (`OBO`).
% - Decomposes the object into its compound representation and prints each part.
%
% @arg OBO The object to be printed in its source form.
%
print_src(OBO) :- format('~N'),uncompound(OBO, Src),!,write_srcH(Src).
%! write_srcH(+Src) is det.
%
% Writes the compound representation of the source (`Src`) in a structured format.
%
% @arg Src The source to be written.
%
write_srcH([F | Args]) :- write('( '),write_src(F),maplist(write_srcE, Args),writeln(' )').
%! write_srcE(+Arg) is det.
%
% Writes a single argument (`Arg`) in the source representation.
%
% @arg Arg The argument to be written.
%
write_srcE(Arg) :-
write(' '),
write_src(Arg).
%! is_loading_file(-File) is nondet.
%
% Checks if a file is currently being loaded or saved.
%
% @arg File The name of the file currently being processed.
%
is_loading_file(File) :- nb_current(loading_file, File),File \== [],!.
is_loading_file(File) :- nb_current(saving_file, File),File \== [].
%! all_data_once is det.
%
% Initializes and prepares the environment for data operations if not already loading a file.
% - Opens the `whole_metta` file for saving.
% - Sets up the output streams with UTF-8 encoding and disables discontiguous style checks.
% - Lists all data predicates using `all_data_preds/0`.
%
all_data_once :-
% If already loading a file, do nothing.
is_loading_file(_File),
!.
all_data_once :-
% Set the saving file as `whole_metta`.
nb_setval(saving_file, 'whole_metta'),
% Prepare the output stream and write initial configurations.
all_data_to(Out),
writeln(Out, ':- encoding(utf8).'),
writeln(Out, ':- style_check(-discontiguous).'),
flush_output(Out),
!,
all_data_preds.
%! all_data_preds is det.
%
% Lists all data-related predicates to the current output stream.
%
all_data_preds :- all_data_to(Out),with_output_to(Out, all_data_preds0),!.
all_data_preds.
%! all_data_preds0 is det.
%
% Outputs specific predicate listings for data management and tracking.
%
all_data_preds0 :-
listing_c(table_n_type/3),
listing_c(load_state/2),
listing_c(is_loaded_from_file_count/2),
listing_c(fb_pred/2),
listing_c(fb_arg_type/1),
listing_c(fb_arg_table_n/3),
listing_c(fb_arg/1),
listing_c(done_reading/1),
!.
% declare that is_all_data_to/2 may change during execution
:- dynamic(is_all_data_to/2).
%! all_data_to(-Out) is det.
%
% Determines or prepares the output stream (`Out`) for writing data.
%
% This predicate ensures that data is directed to the appropriate output stream,
% depending on the current state of the program. It handles cases such as switching
% between files, closing previous streams, and creating new ones. The stream is
% managed based on the association between the `is_all_data_to/2` and `is_loading_file/1`
% predicates, which track the current output state.
%
% @arg Out The output stream to be used. It can be an existing stream or a new
% stream created based on the current file being loaded.
all_data_to(Out) :-
% Case 1: Use an existing output stream if the current loading file matches the file
% associated with the output stream.
once((is_all_data_to(File1, Out1), is_loading_file(File2))),
File1 == File2, !,
Out = Out1.
all_data_to(Out) :-
% Case 2: Switch to a new output file if the loading file has changed.
is_all_data_to(File1, Out1),
is_loading_file(File2), !,
% Close the old output stream.
close(Out1),
% Construct the new temporary file name and open it for writing.
atom_concat(File2, '.metta.datalog.tmp', File2Data),
open(File2Data, write, Out2, [alias(all_data), encoding(utf8), lock(write)]),
% Update the `is_all_data_to/2` fact to reflect the new file and stream.
retract(is_all_data_to(File1, Out1)),
assert(is_all_data_to(File2, Out2)),
% Log the switch between files for debugging purposes.
fbug(all_data_to_switch(File1, File2)), !,
Out = Out2.
all_data_to(Out) :-
% Case 3: Reuse an existing output stream if one is available.
is_all_data_to(_File1, Out), !.
all_data_to(Out) :-
% Case 4: Create a new output stream if no current stream exists and the system
% is in a converting state.
is_converting,
is_loading_file(File2), !,
% Construct the new temporary file name and open it for writing.
atom_concat(File2, '.metta.datalog.tmp', File2Data),
open(File2Data, write, Out2),
% Store the new output stream for future reference.
assert(is_all_data_to(File2, Out2)),
% Log the creation of the new stream for debugging purposes.
fbug(all_data_to(File2)), !,
Out = Out2.
%! all_data_done is det.
%
% Finalizes all pending data operations by completing output stream management,
% deleting temporary states, and ensuring clean termination of the process.
%
% This predicate handles the final steps in data processing by:
% - Running all predicates required to finalize the output data (`all_data_preds/0`).
% - Deleting the temporary state associated with `saving_file` using `nb_delete/1`.
% - Completing any remaining tasks in the "Metta" workflow with `all_metta_done/0`.
% - Closing and cleaning up all active output streams that are tracked by
% `is_all_data_to/2`.
%
% This ensures that all resources are properly closed, leaving no dangling streams
% or incomplete states.
all_data_done :-
% Execute all predicates required to finalize the output data.
all_data_preds,
% Delete the non-backtrackable state associated with 'saving_file'.
nb_delete(saving_file),
% Finalize any additional tasks related to the "Metta" workflow.
all_metta_done,
% Close all output streams tracked by `is_all_data_to/2`.
forall(
retract(is_all_data_to(_, Out)),
% Use catch_ignore/1 to suppress any exceptions that might occur during close/1.
catch_ignore(close(Out))
).
% This group of directives ensures that the `all_data_done/0` predicate is executed
% when the system halts, but only if the condition `is_converting/0` holds true.
%
:- if(is_converting).
:- at_halt(all_data_done).
:- endif.
%! listing_c(+Input) is det.
%
% Outputs a Prolog listing for a predicate specified by its functor and arity.
%
% This predicate generates a listing of all clauses for the predicate specified
% by its functor and arity (`Input`) in a format suitable for reloading or debugging.
% It also handles multifile and dynamic declarations and logs any errors that
% occur during the listing process.
%
% @arg Input The predicate specification in the form of `Functor/Arity`. `Functor`
% is the predicate's name, and `Arity` is the number of arguments.
%
% Behavior:
% - Outputs the `:- multifile/1` declaration for the predicate to indicate that
% it may be spread across multiple files.
% - Outputs the `:- dynamic/1` declaration to indicate that the predicate can
% be modified at runtime.
% - Lists all the clauses of the predicate by iterating through its solutions
% and formatting them as Prolog terms.
% - If an error occurs during clause listing, it logs the issue with `fbug/1`.
listing_c(F/A) :-
% Print the `:- multifile/1` declaration for the predicate.
format('~N~q.~n', [:- multifile(F/A)]),
% Print the `:- dynamic/1` declaration for the predicate.
format('~q.~n', [:- dynamic(F/A)]),
% Create a functor P with the specified functor (F) and arity (A).
functor(P, F, A),
% Attempt to list all clauses of the predicate P. If an error occurs,
% log it using `fbug/1`.
catch(
% Iterate through all clauses of P and format them for output.
forall(P, format('~q.~n', [P])),
% Capture any exception that occurs during listing.
E,
% Log the error using `fbug/1`, specifying the problematic predicate.
fbug(caused(F/A, E))
).
% 'dynamic' is used to indicate the predicate may be modified at runtime.
:- dynamic(is_all_metta_to/2).
%! all_metta_to(-Out) is det.
%
% Handles the output stream management for processing metta data files.
% Ensures the correct output stream (`Out`) is used or switched as necessary
% based on the current loading file.
%
% This predicate manages temporary `.metta.tmp` files for output, ensuring they
% are properly closed and reopened when switching between files. It also handles
% asserting and retracting dynamic facts to keep track of active streams.
%
% @arg Out The output stream that will be used for metta data.
%
% @example
% % Use the output stream associated with the current file being processed:
% ?- all_metta_to(Out).
% Out = <stream_reference>.
%
all_metta_to(Out) :-
% If the currently loaded file (`File2`) matches the file associated with the tracked
% metta output stream (`File1`), reuse the existing output stream (`Out1`) by unifying it
% with `Out`. This avoids opening a new stream unnecessarily.
once((is_all_metta_to(File1, Out1),is_loading_file(File2))),File1 == File2, !,Out = Out1.
all_metta_to(Out) :-
is_all_metta_to(File1, Out1),
is_loading_file(File2), !,
close(Out1), % Close the previous stream.
atom_concat(File2, '.metta.tmp', File2Data),
open(File2Data, write, Out2, [alias(all_metta), encoding(utf8), lock(write)]),
% Update dynamic facts to track the new stream.
retract(is_all_metta_to(File1, Out1)),
assert(is_all_metta_to(File2, Out2)),
% Log the switch for debugging purposes.
fbug(all_metta_to_switch(File1, File2)), !,
Out = Out2.
all_metta_to(Out) :- is_all_metta_to(_File1, Out), !.
all_metta_to(Out) :-
is_loading_file(File2), !,
atom_concat(File2, '.metta.tmp', File2Data),
open(File2Data, write, Out2),
% Track the newly created stream.
assert(is_all_metta_to(File2, Out2)),
% Log the new stream for debugging purposes.
fbug(all_metta_to(File2)), !,
Out = Out2.
%! all_metta_done is det.
%
% Closes all open output streams associated with metta processing and cleans up
% related dynamic facts.
%
% This predicate ensures that any output stream being tracked via the `is_all_metta_to/2`
% dynamic fact is safely closed. The `catch_ignore/1` wrapper is used to handle any
% exceptions that might occur during the `close/1` operation without interrupting the process.
%
% This is typically called as part of a cleanup routine to release resources.
all_metta_done:-
% Iterates over all tracked metta output streams (`is_all_metta_to/2` facts),
% retracts each fact, and safely closes the associated output stream (`Out`).
% The `catch_ignore/1` is used to handle any exceptions during the `close/1` operation
% to ensure the process continues uninterrupted, even if an error occurs.
forall(retract(is_all_metta_to(_,Out)), catch_ignore(close(Out))).
%! loaded_from_file_count(-Count) is det.
%
% Retrieves the current count of files loaded.
% The `flag/3` predicate is used to read the value of the `loaded_from_file_count` flag
% without modifying it.
%
% @arg Count The current count of files loaded.
%
% @example
% % Get the current count of loaded files:
% ?- loaded_from_file_count(Count).
% Count = 42.
loaded_from_file_count(X) :-
flag(loaded_from_file_count, X, X).
%! incr_file_count(-NewCount) is det.
%
% Increments the count of files loaded and updates the count of total loaded symbols
% and atoms. This ensures all relevant counters are updated simultaneously.
%
% The `flag/3` predicate is used to atomically increment the counters:
% - `loaded_from_file_count`: Number of files loaded.
% - `total_loaded_symbols`: Total number of loaded symbols.
% - `total_loaded_atoms`: Total number of loaded atoms.
%
% @arg NewCount The updated count of files loaded.
%
% @example
% % Increment the file count and retrieve the new count:
% ?- incr_file_count(NewCount).
% NewCount = 43.
incr_file_count(X) :-
flag(loaded_from_file_count, X, X + 1),
flag(total_loaded_symbols, TA, TA + 1),
flag(total_loaded_atoms, TA, TA + 1).
%! should_cache is nondet.
%
% Determines if caching should occur based on the current count of loaded files.
% This predicate fails unless the loaded file count is less than or equal to the
% maximum disk cache size (`max_disk_cache`).
%
% The maximum cache size defaults to 1000 if not explicitly provided.
%
% @example
% % Check if caching should happen:
% ?- should_cache.
% false. % Always fails because of the initial `fail/0`.
should_cache :-
% Ensure this predicate always fails.
fail,
% Retrieve the current count of loaded files.
loaded_from_file_count(X),
% Check the maximum allowed disk cache size.
option_else(max_disk_cache, Num, 1000),
X =< Num.
%! reached_file_max is nondet.
%
% Determines if the maximum allowed file count (`max_per_file`) has been reached.
% This predicate fails unless `loaded_from_file_count` exceeds the value specified
% in the `max_per_file` option, provided it is neither infinite (`inf`) nor zero.
%
% @example
% % Check if the maximum file count is reached:
% ?- reached_file_max.
% false.
reached_file_max :-
% Retrieve the maximum allowed file count.
option_value(max_per_file, Y),
% Ensure it is finite and non-zero.
Y \== inf, Y \== 0,
% Compare the current file count.
loaded_from_file_count(X),
X >= Y.
%! should_fix_args is nondet.
%
% Determines if arguments should be fixed based on the current sampling condition.
% This predicate always fails unless explicitly altered.
%
% @example
% % Check if arguments need fixing:
% ?- should_fix_args.
% false.
should_fix_args :-
% Ensure the predicate fails.
fail,
% Check if sampling should not occur.
\+ should_sample.
%! should_sample is nondet.
%
% Determines if sampling should be performed based on various conditions.
% The predicate can succeed if specific options or conditions for sampling are met.
%
% @example
% % Check if sampling is allowed:
% ?- should_sample.
% false. % Due to the first cut-fail combination.
should_sample :-
!,
% Ensure the predicate fails.
fail.
should_sample :-
% Check if data should be displayed.
should_show_data(_),
!.
should_sample :-
% Retrieve the sampling rate or use a default.
once(option_value(samples_per_million, Fifty); Fifty = 50),
% Retrieve the current count of loaded files.
loaded_from_file_count(X),
% Calculate the remainder and check conditions.
Y is X mod 1_000_000, !, Y >= 0, Y =< Fifty, !.
%! should_show_data(+X) is nondet.
%
% Determines if data should be displayed based on the current loaded file count (`X`).
% The predicate succeeds if specific conditions on `X` are met, such as being within
% a certain range or divisible by a specified value.
%
% @arg X The count of loaded files.
%
% @example
% % Check if data should be displayed for a given count:
% ?- should_show_data(12).
% true.
should_show_data(X) :-
% Retrieve the current file count.
loaded_from_file_count(X),
% Ensure this clause succeeds.
!,
% Check if the file count falls within the desired range.
once((X =< 13, X >= 10); (X > 0, (0 is X rem 1_000_000))),
% Log an empty line to the error stream.
format(user_error, '~N', []),
% Log an empty line to the output stream.
format(user_output, '~N', []),
% Ensure this clause succeeds.
!,heartbeat.
should_show_data(X) :-
% Retrieve the current loading file.
nb_current(loading_file, F),
% Ensure the loading file is not empty.
F \== [],
% Check if the file has an `.obo` extension.
symbol_concat(_, '.obo', F),
% Retrieve the current file count.
loaded_from_file_count(X),
% Calculate the remainder for modulo operation.
Y is X mod 100_000,
% Check if the remainder falls within the desired range.
Y =< 15, Y >= 10.
%:- current_prolog_flag(libswipl,_)->use_module(library(logicmoo_utils)); true.
/*
declare -a StringArray=(\
"fbgn_fbtr_fbpp_expanded_*.tsv.gz" \
"physical_interactions_mitab*.tsv.gz" \
"dmel_gene_sequence_ontology_annotations*.tsv.gz" \
"gene_map_table_*.tsv.gz" \
"ncRNA_genes_fb_*.json.gz" \
"gene_association.fb.gz" \
"gene_genetic_interactions_*.tsv.gz" \
"allele_genetic_interactions_*.tsv.gz" \
"allele_phenotypic_data_*.tsv.gz" \
"disease_model_annotations*.tsv.gz" \
"dmel_human_orthologs_disease*.tsv.gz" \
"fbrf_pmid_pmcid_doi*.tsv.gz")
*/
%! load_flybase_files is det.
%
% Loads FlyBase files from a specified FTP directory.
%
% This predicate retrieves the directory path using `ftp_data/1` and then
% changes the working directory to this path using `with_cwd/2` to load the files
% through `load_flybase_files_ftp/0`.
%
% @example
% % Load FlyBase files:
% ?- load_flybase_files.
% true.
load_flybase_files :-
% Retrieve the FTP directory path.
ftp_data(Dir),
% Change the working directory and load the files.
with_cwd(Dir, load_flybase_files_ftp).
%! load_flybase_das_11 is det.
%
% Loads and processes the 11 main data sources (DAS) from FlyBase, including