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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
|
;; Pangenome module -- pangenome tools and their dependencies
(define-module (gn packages pangenome)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix gexp)
#:use-module (guix build-system ant)
#:use-module (guix build-system cargo)
#:use-module (guix build-system cmake)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system go)
#:use-module (guix build-system trivial)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages base)
#:use-module (gnu packages bioinformatics)
#:use-module (gnu packages gawk)
#:use-module (gnu packages boost)
#:use-module (gnu packages compression)
#:use-module (gnu packages golang-xyz)
#:use-module (gnu packages golang-maths)
#:use-module (gnu packages image-processing)
#:use-module (gnu packages maths)
#:use-module (gnu packages perl)
#:use-module (gnu packages python-science)
#:use-module (gnu packages cmake)
#:use-module (gnu packages datastructures)
#:use-module (gnu packages jemalloc)
#:use-module (gnu packages linux)
#:use-module (gnu packages mpi)
#:use-module (gnu packages algebra)
#:use-module (gnu packages graph)
#:use-module (gnu packages guile)
#:use-module (gnu packages parallel)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages time)
#:use-module (gnu packages bash)
#:use-module (gnu packages check)
#:use-module (gnu packages c)
#:use-module (gnu packages cpp)
#:use-module (gnu packages curl)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
#:use-module (gnu packages gcc)
#:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages java)
#:use-module (gnu packages llvm)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages protobuf)
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
#:use-module (gnu packages ruby)
#:use-module (gnu packages ruby-xyz)
#:use-module (gnu packages tls)
#:use-module (gnu packages vim)
#:use-module (gnu packages web)
#:use-module (gnu packages zig)
#:use-module (gnu packages bioconductor)
#:use-module (gnu packages cran)
#:use-module (gnu packages statistics)
#:use-module (gnu packages wget)
#:use-module (gn packages bioinformatics)
#:use-module (gn packages pangenome-rust)
#:use-module (gnu packages python-xyz))
;; gfautil has been moved to (gn packages pangenome-rust)
(define-public safestringlib
(let ((commit "39219363f0497d04c710a1e11acdeb6d18d4b2f5")
(revision "0"))
(package
(name "safestringlib")
(version (git-version "1.2.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/intel/safestringlib")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1b5s2b19hybr2r0mxch5x5f0gzy77w1xcfp2js4rprqr8dimppak"))))
(build-system gnu-build-system)
(arguments
(list #:tests? #f ; no test target in CMake build
#:make-flags
#~(list (string-append "CC=" #$(cc-for-target)))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
;; -DSTDC_HEADERS tells safeclib_private.h to include
;; stdlib.h/ctype.h unconditionally (normally set by autoconf).
(add-before 'build 'fix-cflags
(lambda _
(substitute* "makefile"
(("-Wformat-security")
"-Wformat-security -DSTDC_HEADERS"))))
(add-before 'build 'make-obj-dir
(lambda _
(mkdir-p "obj")))
(replace 'build
(lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "make" "libsafestring.a" make-flags)))
(replace 'install
(lambda _
(mkdir-p (string-append #$output "/lib"))
(mkdir-p (string-append #$output "/include"))
(install-file "libsafestring.a"
(string-append #$output "/lib"))
(for-each (lambda (h)
(install-file h (string-append #$output "/include")))
(append
(find-files "include" "\\.h$")
(find-files "safeclib" "^safe_.*\\.h$"))))))))
(properties '((tunable? . #t)))
(home-page "https://github.com/intel/safestringlib")
(synopsis "Intel Safe String Library")
(description
"Safestringlib is derived from the Safe C Library by Cisco Systems.
It provides replacements for dangerous C string and memory functions that
perform bounds checking and return meaningful error codes.")
(license license:expat))))
(define-public bwa-mem2
(package
(name "bwa-mem2")
(version "2.3")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/bwa-mem2/bwa-mem2")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"01dhryf6nbdicrvbdk4mrdypm0l9vqh1qis9qp0pdh8qbxgh060c"))))
(build-system gnu-build-system)
(arguments
(list #:tests? #f ; no test target in Makefile
#:make-flags
#~(list (string-append "CC=" #$(cc-for-target))
(string-append "CXX=" #$(cxx-for-target)))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'use-installed-safestringlib
(lambda _
(let ((ssl #$(this-package-input "safestringlib")))
(substitute* "Makefile"
;; Replace include/lib paths with installed safestringlib.
(("-Iext/safestringlib/include")
(string-append "-I" ssl "/include"))
(("-Lext/safestringlib/ -lsafestring")
(string-append "-L" ssl "/lib -lsafestring"))
(("-Lext/safestringlib -lsafestring")
(string-append "-L" ssl "/lib -lsafestring"))
;; Strip the "cd ext/safestringlib && make clean" from
;; the multi target's cleanup lines.
((" cd ext/safestringlib/ && \\$\\(MAKE\\) clean;")
"")
;; Remove $(SAFE_STR_LIB) from EXE prerequisites.
(("\\$\\(BWA_LIB\\) \\$\\(SAFE_STR_LIB\\) ")
"$(BWA_LIB) ")
;; Remove the $(SAFE_STR_LIB) build rule (two lines).
(("\\$\\(SAFE_STR_LIB\\):\n\tcd ext/safestringlib.*\n")
"")
;; Remove safestringlib from the clean target.
(("\tcd ext/safestringlib/ && \\$\\(MAKE\\) clean\n")
"")))))
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(replace 'install
(lambda _
(mkdir-p (string-append #$output "/bin"))
(for-each (lambda (f)
(install-file f (string-append #$output "/bin")))
(find-files "." "^bwa-mem2" #:directories? #f)))))))
(inputs (list safestringlib zlib))
;; Tests (fmi_test, smem2_test, bwt_seed_strategy_test, sa2ref_test,
;; xeonbsw) require a BWA-MEM2 genome index and reads; no standalone
;; test data is shipped upstream.
(supported-systems '("x86_64-linux"))
(properties '((tunable? . #t)))
(home-page "https://github.com/bwa-mem2/bwa-mem2")
(synopsis "Next generation of the BWA-MEM short read aligner")
(description
"BWA-MEM2 is the next version of the BWA-MEM algorithm in the BWA
software package. It produces alignment identical to BWA-MEM and is
approximately 1.3-3.1x faster depending on the use case, the reference
genome, and the query set. The tool runs on x86 hardware and builds
multiple SIMD-optimized variants (SSE4.1, SSE4.2, AVX, AVX2, AVX512BW)
with a runtime dispatcher.")
(license license:expat)))
(define-public miniprot
(package
(name "miniprot")
(version "0.18")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/lh3/miniprot")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"093pgw9cm2xdh9d3wv2311cd8fxj2k6rk5gw72zjyq9j7g5dshm3"))))
(build-system gnu-build-system)
(arguments
(list #:make-flags
#~(list (string-append "CC=" #$(cc-for-target)))
#:tests? #f ; build sandbox is noexec; can't run compiled binary
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(replace 'install
(lambda _
(mkdir-p (string-append #$output "/bin"))
(mkdir-p (string-append #$output "/share/man/man1"))
(install-file "miniprot"
(string-append #$output "/bin"))
(install-file "miniprot.1"
(string-append #$output "/share/man/man1")))))))
(inputs (list zlib))
(properties '((tunable? . #t)))
(home-page "https://github.com/lh3/miniprot")
(synopsis "Protein-to-genome aligner")
(description
"Miniprot aligns a protein sequence against a genome with affine gap
penalty, splicing and frameshift. It is primarily designed for annotating
protein-coding genes in a new genome using related genomes as references.")
(license license:expat)))
(define-public pangene
(package
(name "pangene")
(version "1.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/lh3/pangene")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"04vwriwa32q6gnrppn98mqvck8pr2s7ld88dlmg09j7881x584nh"))))
(build-system gnu-build-system)
(arguments
(list #:make-flags
#~(list (string-append "CC=" #$(cc-for-target)))
#:tests? #f ; build sandbox is noexec; can't run compiled binary
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(replace 'install
(lambda _
(mkdir-p (string-append #$output "/bin"))
(mkdir-p (string-append #$output "/share/man/man1"))
(install-file "pangene"
(string-append #$output "/bin"))
(install-file "pangene.1"
(string-append #$output "/share/man/man1")))))))
(inputs (list zlib))
(properties '((tunable? . #t)))
(home-page "https://github.com/lh3/pangene")
(synopsis "Construct pangenome gene graphs")
(description
"Pangene constructs a pangenome gene graph from protein-to-genome
alignments. It takes PAF files as input and outputs a graph in GFA format,
suitable for downstream pangenome analysis.")
(license license:expat)))
(define-public wally
(package
(name "wally")
(version "0.7.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/tobiasrausch/wally")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1p0jz8m7src0lfznc8kpa0ra9i2362d35ka69457va957y1klm9v"))))
(build-system gnu-build-system)
(native-inputs (list pkg-config))
(inputs (list boost htslib opencv zlib xz bzip2))
(arguments
(list #:tests? #f ; no test target in Makefile
#:make-flags
#~(list (string-append "CXX=" #$(cxx-for-target))
;; Point to installed htslib; Makefile uses EBROOTHTSLIB as
;; prefix (EasyBuild convention), patched below to append
;; /include and /lib.
(string-append "EBROOTHTSLIB=" #$(this-package-input "htslib"))
;; Non-default value prevents in-tree opencv submodule build.
"OPENCVSRC=/dev/null"
(string-append "prefix=" #$output))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(add-after 'unpack 'fix-makefile
(lambda _
(substitute* "Makefile"
;; EBROOTHTSLIB is used bare as an include/lib prefix;
;; installed htslib has headers in include/ and libs in lib/.
(("-isystem \\$\\{EBROOTHTSLIB\\}")
"-isystem ${EBROOTHTSLIB}/include")
(("-L\\$\\{EBROOTHTSLIB\\}")
"-L${EBROOTHTSLIB}/lib")
;; Remove rpath flags; Guix manages rpaths via ld-wrapper.
((" -Wl,-rpath,\\$\\{EBROOTHTSLIB\\}") "")
((" -Wl,-rpath,\\$\\{OPENCV\\}/lib/") "")
((" -Wl,-rpath,\\$\\{OPENCV\\}/lib64/") "")
;; boost::system became header-only in boost >= 1.69;
;; libboost_system is no longer installed.
((" -lboost_system") "")
;; Remove in-tree opencv PKG_CONFIG_PATH override so the
;; Guix build environment's PKG_CONFIG_PATH finds opencv4.
(("export PKG_CONFIG_PATH=\\$\\{PWD\\}/src/ocv/lib/pkgconfig/:\\$\\{PWD\\}/src/ocv/lib64/pkgconfig/:\\$\\{PKG_CONFIG_PATH\\} && ")
"")))))))
;; No upstream test suite; the tool requires BAM/CRAM input files.
(properties '((tunable? . #t)))
(home-page "https://github.com/tobiasrausch/wally")
(synopsis "Read alignment visualization tool")
(description
"Wally visualizes read alignments stored in BAM/CRAM format. It
produces alignment plots in PNG format and supports region plots, dotplots,
and heatmaps for structural variant and genome assembly analysis.")
(license license:bsd-3)))
(define meryl-utility-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/marbl/meryl-utility")
(commit "99676106a395899543c20d1086927b97bf5f46eb")))
(file-name (git-file-name "meryl-utility" "99676106"))
(sha256 (base32 "1441v5vdxjclfmzdk72yxmscncs25ncr797c4brgjb5kv6yhby21"))))
(define-public meryl
(package
(name "meryl")
(version "1.4.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/marbl/meryl")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1b9mq7lzz2l5fq6gnk3dnc5hs4gb231gvv9fn2wn94x0fd5pmyg8"))))
(build-system gnu-build-system)
(native-inputs (list perl which))
(arguments
(list #:tests? #f ; no test target in Makefile
#:make-flags
#~(list (string-append "CC=" #$(cc-for-target))
(string-append "CXX=" #$(cxx-for-target)))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'unpack-submodules
(lambda _
(copy-recursively #$meryl-utility-src "src/utility")))
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(add-before 'build 'chdir-src
(lambda _ (chdir "src")))
(replace 'install
(lambda _
;; Build puts binaries in ../build/bin/.
(let ((bin (string-append #$output "/bin")))
(mkdir-p bin)
(for-each (lambda (f)
(install-file f bin))
(find-files "../build/bin" "."))))))))
(properties '((tunable? . #t)))
(home-page "https://github.com/marbl/meryl")
(synopsis "Genomic k-mer counter and set operations")
(description
"Meryl is a genomic k-mer counter and sequence utility. It counts
k-mers in genomic sequences and supports set operations (union, intersect,
difference) on k-mer databases.")
(license (list license:gpl2
license:bsd-2
license:bsd-3))))
(define-public kfilt
(let ((commit "ace6888d78156d3bd3a42bd3b8b31dbb57ee6dbe")
(revision "0"))
(package
(name "kfilt")
(version (git-version "0.1.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/davidebolo1993/kfilt")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"02j12bir1v3v2kpld0a628kfdcmn7py6qfqggf7vlvglhk33yqx4"))))
(build-system go-build-system)
(arguments
(list #:import-path "github.com/davidebolo1993/kfilt"
#:install-source? #f))
(inputs (list go-github-com-spf13-cobra
go-github-com-cheggaaa-pb-v3))
(properties '((tunable? . #t)))
(home-page "https://github.com/davidebolo1993/kfilt")
(synopsis "K-mer based sequence filtering tool")
(description
"Kfilt builds k-mer indices from genomic sequences and filters reads
based on k-mer matches. It is used in the cosigt pipeline to filter
unmapped reads using unique k-mers from pangenome graph alleles.")
(license license:expat))))
(define-public cosigt
(let ((commit "a8b8ec2f7b0ec01399a03afc032581bc3bcf4833")
(revision "1"))
(package
(name "cosigt")
(version (git-version "0.1.7" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/pjotrp/cosigt")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0rz2zvkfxi2b35bj019cmdm1vzbvfa1lyqsx7awwx3anr09dych1"))))
(build-system go-build-system)
(arguments
(list #:import-path "github.com/pjotrp/cosigt"
#:install-source? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'install-pipeline
(lambda _
(let ((share (string-append #$output "/share/cosigt")))
(copy-recursively
"src/github.com/pjotrp/cosigt/cosigt_smk"
share))))
(add-after 'install 'install-tests
(lambda _
(let ((test (string-append #$output "/share/cosigt/test")))
(copy-recursively
"src/github.com/pjotrp/cosigt/test"
test)))))))
(inputs (list go-github-com-akamensky-argparse
go-gonum-org-v1-gonum))
(propagated-inputs
(list bedtools
bwa-mem2
gafpack
gfainject
htslib
impg
kfilt
meryl
minimap2
odgi
pggb
samtools
snakemake
util-linux))
(properties '((tunable? . #t)))
(home-page "https://github.com/pjotrp/cosigt")
(synopsis "Cosine similarity-based structural haplotype genotyper")
(description
"Cosigt (COsine SImilarity-based GenoTyper) assigns structural
haplotypes to sequenced samples using pangenome graphs. It includes a
Snakemake pipeline (@file{share/cosigt/}) and a genotyping binary. Pipeline
tools needed at runtime: snakemake, minimap2, samtools, bedtools, bwa-mem2,
odgi, gafpack, gfainject, impg, pggb, meryl, kfilt, wally, miniprot, and
pangene.")
(license license:expat))))
(define-public odgi
(package
(name "odgi")
(version "0.9.0")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/pangenome/odgi/releases"
"/download/v" version
"/odgi-v" version ".tar.gz"))
(sha256
(base32 "0brg0sz45v1wv4ld3p4jwiab10nyp2f691zfwpiva6g6f71q3cbk"))
(snippet
#~(begin
(use-modules (guix build utils))
(substitute* "CMakeLists.txt"
(("-march=native") "")
(("-msse4\\.2") ""))))))
(build-system cmake-build-system)
(arguments
(list
#:tests? #f ; tests are bash scripts (test_binary.sh) and python doctests
; that require test data and a python odgi module import
#:parallel-build? #f ; OOM with parallel build
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'use-gnuinstalldirs-macros
(lambda _
(substitute* "CMakeLists.txt"
(("project\\(odgi\\)" all)
(string-append all "\ninclude(GNUInstallDirs)"))
(("LIBRARY DESTINATION lib")
"LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}")
(("ARCHIVE DESTINATION lib")
"ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}"))))
(add-after 'unpack 'link-to-libodgi
(lambda _
(substitute* "CMakeLists.txt"
(("^ \\$<TARGET_OBJECTS:odgi_objs>.*") "")
(("target_link_libraries\\(odgi " all)
(string-append all "libodgi_shared "))))))))
(native-inputs (list pkg-config))
(inputs
(list jemalloc
libdivsufsort
openmpi
pybind11
python
sdsl-lite))
(properties '((tunable? . #t)))
(home-page "https://github.com/vgteam/odgi")
(synopsis "Optimized Dynamic Genome/Graph Implementation")
(description "odgi provides an efficient and succinct dynamic DNA sequence
graph model, as well as algorithms for pangenome analysis.")
(license license:expat)))
;; seqwish submodule origins (unbundled from recursive? #t)
(define seqwish-bbhash-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/vgteam/BBHash")
(commit "36e4fe3eaeef762c831c49cdc01f1a3a2c7a97a4")))
(file-name (git-file-name "BBHash" "36e4fe3e"))
(sha256 (base32 "1q2lapriprgmjcnxn9a30xv3yacyx0r4ri4jjsvp26rhmpw2ql57"))))
(define seqwish-args-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/Taywee/args")
(commit "730dfbc4bc2e4149c22e0f606bf00420b65aeaeb")))
(file-name (git-file-name "args" "730dfbc4"))
(sha256 (base32 "1lk4mljs0v1a0gns2bb609ywc2g5kwsm6dgaafrwpr0ldvk3gai6"))))
(define seqwish-atomic-queue-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/max0x7ba/atomic_queue")
(commit "7d75e9ed0359650224b29cdf6728c5fe0a19fffb")))
(file-name (git-file-name "atomic_queue" "7d75e9ed"))
(sha256 (base32 "1dh8x0ikfwk0by5avwfv9gvr9ay6jy13yr66rvgw9wwyxmklz848"))))
(define seqwish-atomicbitvector-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/ekg/atomicbitvector")
(commit "ebf6435171a47ad216294645d528c2c9fe030c96")))
(file-name (git-file-name "atomicbitvector" "ebf64351"))
(sha256 (base32 "011n32cb7hdblibcj8hd42r6m4riikamqs3jhb2x32knycm22if5"))))
(define seqwish-flat-hash-map-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/skarupke/flat_hash_map")
(commit "2c4687431f978f02a3780e24b8b701d22aa32d9c")))
(file-name (git-file-name "flat_hash_map" "2c468743"))
(sha256 (base32 "0ryc8ybkdpz6r788lhdfnm0xrxgwdmplvqngj48rzv0fvfi16hbz"))))
(define seqwish-gzip-reader-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/gatoravi/gzip_reader")
(commit "0ef26c0399e926087f9d6c4a56067a7bf1fc4f5e")))
(file-name (git-file-name "gzip_reader" "0ef26c03"))
(sha256 (base32 "1wy84ksx900840c06w0f1mgzvr7zsfsgxq1b0jdjh8qka26z1r17"))))
(define seqwish-iitii-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/ekg/iitii")
(commit "85209e07a3ee403fb6557387a7f897cd76be4406")))
(file-name (git-file-name "iitii" "85209e07"))
(sha256 (base32 "0sszvffkswf89nkbjmjg3wjwqvy2w0d3wgy3ngy33ma4sy4s025s"))))
(define seqwish-ips4o-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/SaschaWitt/ips4o")
(commit "a34d7d40c0f1279510e35e0dc2c69637b3c5d0b6")))
(file-name (git-file-name "ips4o" "a34d7d40"))
(sha256 (base32 "098dbpdava9a4qwsd810lc3gk6fvfb91sd9n7m78y82qzi745dph"))))
(define seqwish-mmmulti-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/ekg/mmmulti")
(commit "8b57e439cfe34a3a21e5a32dcd76026be7d71b72")))
(file-name (git-file-name "mmmulti" "8b57e439"))
(sha256 (base32 "0kcdkm5cmbxahdg3i9mas6pcsmnlr2i3n67ah4mklzp18qs884ij"))))
(define seqwish-paryfor-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/ekg/paryfor")
(commit "509b28a092f732a068e2908bb9e359a8562cd32f")))
(file-name (git-file-name "paryfor" "509b28a0"))
(sha256 (base32 "1qcf4q0gna66l3hwazqxnsa515ggh7sin2vq8xfnjr322ps30y2v"))))
(define seqwish-sdsl-lite-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/simongog/sdsl-lite")
(commit "c32874cb2d8524119f25f3b501526fe692df29f4")))
(file-name (git-file-name "sdsl-lite" "c32874cb"))
(sha256 (base32 "1p53cgrgkp72s0mx262pxz90mf04vy4c1189xlx146qh8fznywg4"))))
;; mmmulti submodules
(define seqwish-mmmulti-dynamic-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/vgteam/DYNAMIC")
(commit "73a6b10ecb94ee178fa873797aacf81e0bfdc7db")))
(file-name (git-file-name "DYNAMIC" "73a6b10e"))
(sha256 (base32 "1yrpb32r0dav0vs1x34pv76jyns9zybyhdyjy1nfcl3iifajqnw5"))))
(define seqwish-mmmulti-args-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/Taywee/args")
(commit "de4db870058c37b6094bc5ccb03c9ea45708c855")))
(file-name (git-file-name "args" "de4db870"))
(sha256 (base32 "1n4m0qay71idjiqpym4q14cg274mrl4iaxdn58aixw1virak7zwl"))))
(define seqwish-mmmulti-atomic-queue-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/max0x7ba/atomic_queue")
(commit "d9d66b6d20d74042da481ed5504fa81c0d79c8ae")))
(file-name (git-file-name "atomic_queue" "d9d66b6d"))
(sha256 (base32 "1q7acbm1m2n7pzrrfk39cvylcsq6kw605863qqjwnv37ii9nl73k"))))
(define seqwish-mmmulti-hopscotch-map-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/Tessil/hopscotch-map")
(commit "848374746a50b3ebebe656611d554cb134e9aeef")))
(file-name (git-file-name "hopscotch-map" "84837474"))
(sha256 (base32 "0xps3qglrdy7xyjf5icq76gv9c9nxd6sbqbvwk35jcrlmwl5aa7h"))))
(define seqwish-mmmulti-ips4o-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/ips4o/ips4o")
(commit "cf269199fb1ed91751dbdba032339992decf220d")))
(file-name (git-file-name "ips4o" "cf269199"))
(sha256 (base32 "0kbymf18g300w4d51nh27jxy5dh56l2x66qhkly3lrc0r15vlzmk"))))
(define seqwish-mmmulti-mio-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/mandreyel/mio")
(commit "3f86a95c0784d73ce6815237ec33ed25f233b643")))
(file-name (git-file-name "mio" "3f86a95c"))
(sha256 (base32 "1gqjr778hxs7idnl8b351b5a2q6fvzdhcg8l9v4clvvkdq132wd6"))))
;; sdsl-lite sub-submodules (used by both deps/sdsl-lite and
;; deps/mmmulti/deps/sdsl-lite, same commits)
(define seqwish-sdsl-libdivsufsort-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/simongog/libdivsufsort")
(commit "0f24acd8de208464769c782119dacf158647f7ed")))
(file-name (git-file-name "libdivsufsort" "0f24acd8"))
(sha256 (base32 "13ymrg0h1dhbrnyv50xcfpr7g3hrvrg4d9zg7mx6k9pqyhqx5p32"))))
(define seqwish-sdsl-googletest-src
(origin (method git-fetch)
(uri (git-reference (url "https://github.com/google/googletest")
(commit "c2d90bddc6a2a562ee7750c14351e9ca16a6a37a")))
(file-name (git-file-name "googletest" "c2d90bdd"))
(sha256 (base32 "1b27igw347znbw7k0j602v5bcackzj9iq1wy691fvg2n1cgvxd52"))))
(define-public seqwish
(package
(name "seqwish")
(version "0.7.11")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/seqwish.git")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "1z64f06vbv19hmc5bi4xf2783ddialbf29z96kwvflf8bcfzvsh9"))
(patches
(search-patches "seqwish-shared-library.patch"))))
(build-system cmake-build-system)
(arguments
(list
#:configure-flags
#~(list "-DSEQWISH_LINK_SHARED_LIBRARY=ON"
"-DCMAKE_C_FLAGS=-mcx16"
"-DCMAKE_CXX_FLAGS=-mcx16")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-submodules
(lambda _
(copy-recursively #$seqwish-bbhash-src "deps/BBHash")
(copy-recursively #$seqwish-args-src "deps/args")
(copy-recursively #$seqwish-atomic-queue-src "deps/atomic_queue")
(copy-recursively #$seqwish-atomicbitvector-src "deps/atomicbitvector")
(copy-recursively #$seqwish-flat-hash-map-src "deps/flat_hash_map")
(copy-recursively #$seqwish-gzip-reader-src "deps/gzip_reader")
(copy-recursively #$seqwish-iitii-src "deps/iitii")
(copy-recursively #$seqwish-ips4o-src "deps/ips4o")
(copy-recursively #$seqwish-mmmulti-src "deps/mmmulti")
(copy-recursively #$seqwish-paryfor-src "deps/paryfor")
(copy-recursively #$seqwish-sdsl-lite-src "deps/sdsl-lite")
;; mmmulti sub-submodules
(copy-recursively #$seqwish-mmmulti-dynamic-src
"deps/mmmulti/deps/DYNAMIC")
(copy-recursively #$seqwish-mmmulti-args-src
"deps/mmmulti/deps/args")
(copy-recursively #$seqwish-mmmulti-atomic-queue-src
"deps/mmmulti/deps/atomic_queue")
(copy-recursively #$seqwish-mmmulti-hopscotch-map-src
"deps/mmmulti/deps/hopscotch-map")
(copy-recursively #$seqwish-mmmulti-ips4o-src
"deps/mmmulti/deps/ips4o")
(copy-recursively #$seqwish-mmmulti-mio-src
"deps/mmmulti/deps/mio")
;; paryfor and sdsl-lite same commits in both seqwish and mmmulti
(copy-recursively #$seqwish-paryfor-src
"deps/mmmulti/deps/paryfor")
(copy-recursively #$seqwish-sdsl-lite-src
"deps/mmmulti/deps/sdsl-lite")
;; sdsl-lite's own sub-submodules
(copy-recursively #$seqwish-sdsl-libdivsufsort-src
"deps/sdsl-lite/external/libdivsufsort")
(copy-recursively #$seqwish-sdsl-googletest-src
"deps/sdsl-lite/external/googletest")
(copy-recursively #$seqwish-sdsl-libdivsufsort-src
"deps/mmmulti/deps/sdsl-lite/external/libdivsufsort")
(copy-recursively #$seqwish-sdsl-googletest-src
"deps/mmmulti/deps/sdsl-lite/external/googletest")))
(add-after 'unpack-submodules 'patch-arch-flags
;; Moved from origin snippet (requires submodules to be present).
(lambda _
(substitute* '("CMakeLists.txt"
"deps/atomic_queue/Makefile"
"deps/mmmulti/deps/DYNAMIC/CMakeLists.txt"
"deps/mmmulti/deps/atomic_queue/Makefile"
"deps/mmmulti/deps/ips4o/CMakeLists.txt")
(("-march=native") "")
(("-mcx16") ""))
(substitute* '("deps/mmmulti/deps/sdsl-lite/CMakeLists.txt"
"deps/sdsl-lite/CMakeLists.txt")
(("-msse4.2 -march=native") ""))))
(add-after 'unpack-submodules 'patch-paryfor-riscv
;; seqwish-paryfor-riscv.patch moved here: patches a submodule file.
(lambda _
(substitute* "deps/paryfor/paryfor.hpp"
(("} // namespace paryfor\n#else\n#error")
(string-append
"} // namespace paryfor\n"
"#elif defined(__riscv) && (__riscv_xlen == 64)\n"
"namespace paryfor {\n"
"namespace atomic_queue {\n"
"constexpr int CACHE_LINE_SIZE = 64;\n"
"static inline void spin_loop_pause() noexcept {\n"
" asm volatile (\"nop\" ::: \"memory\");\n"
"}\n"
"}\n"
"}\n"
"#else\n"
"#error")))))
(add-after 'unpack 'set-version
(lambda _
(mkdir-p "include")
(substitute* "CMakeLists.txt"
(("^execute_process") "#execute_process"))
(with-output-to-file "include/seqwish_git_version.hpp"
(lambda ()
(format #t "#define SEQWISH_GIT_VERSION \"~a\"~%"
#$version)))))
(add-after 'unpack-submodules 'link-with-some-shared-libraries
(lambda* (#:key inputs #:allow-other-keys)
(substitute* '("CMakeLists.txt"
"deps/mmmulti/CMakeLists.txt")
(("\".*libsdsl\\.a\"") "\"-lsdsl\"")
(("\".*libdivsufsort\\.a\"") "\"-ldivsufsort\"")
(("\".*libdivsufsort64\\.a\"") "\"-ldivsufsort64\"")
(("\\$\\{sdsl-lite_INCLUDE\\}")
(search-input-directory inputs "/include/sdsl"))
(("\\$\\{sdsl-lite-divsufsort_INCLUDE\\}")
(dirname
(search-input-file inputs "/include/divsufsort.h"))))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(setenv "PATH" (string-append (getcwd) ":" (getenv "PATH")))
(when tests?
(with-directory-excursion "../source/test"
(invoke "make"))))))))
(inputs
(list jemalloc
libdivsufsort
openmpi
sdsl-lite
zlib))
(native-inputs
(list perl))
(properties '((tunable? . #t)))
(home-page "https://github.com/ekg/seqwish")
(synopsis "Alignment to variation graph inducer")
(description "Seqwish implements a lossless conversion from pairwise
alignments between sequences to a variation graph encoding the sequences and
their alignments.")
(license license:expat)))
(define-public smoothxg
(package
(name "smoothxg")
(version "0.8.2")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/pangenome/smoothxg"
"/releases/download/v" version
"/smoothxg-v" version ".tar.gz"))
(sha256
(base32 "1hqaa6l904zl01rsmw5vzx2kvcncl97i5kln850snywyv33skxp6"))
(snippet
#~(begin
(use-modules (guix build utils))
(substitute* (find-files "." "CMakeLists.txt")
(("spoa_optimize_for_native ON")
"spoa_optimize_for_native OFF")
(("-msse4\\.2") "")
(("-march=native") ""))))))
(build-system cmake-build-system)
(arguments
(list
#:make-flags
#~(list (string-append "CC = " #$(cc-for-target)))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'link-with-some-shared-libraries
(lambda* (#:key inputs #:allow-other-keys)
(substitute* '("CMakeLists.txt"
"deps/mmmulti/CMakeLists.txt"
"deps/odgi/deps/mmmulti/CMakeLists.txt")
(("\".*libsdsl\\.a\"") "\"-lsdsl\"")
(("\".*libdivsufsort\\.a\"") "\"-ldivsufsort\"")
(("\".*libdivsufsort64\\.a\"") "\"-ldivsufsort64\"")
(("\".*libodgi\\.a\"") "\"-lodgi\"")
(("\\$\\{sdsl-lite_INCLUDE\\}")
(search-input-directory inputs "/include/sdsl"))
(("\\$\\{sdsl-lite-divsufsort_INCLUDE\\}")
(dirname
(search-input-file inputs "/include/divsufsort.h")))
(("\\$\\{odgi_INCLUDE\\}")
(search-input-directory inputs "/include/odgi")))))
(add-before 'build 'build-abPOA
(lambda* (#:key make-flags #:allow-other-keys)
;; This helps with portability to other architectures.
(with-directory-excursion
(string-append "../smoothxg-v" #$version "/deps/abPOA")
(substitute* "Makefile"
(("-march=native") "")
(("-march=armv8-a\\+simd") ""))
(apply invoke "make" "libabpoa" make-flags)))))))
(inputs
(list jemalloc
libdivsufsort
odgi
openmpi
pybind11
python
sdsl-lite
zlib
(list zstd "lib")))
(native-inputs
(list pkg-config))
(home-page "https://github.com/ekg/smoothxg")
(synopsis
"Linearize and simplify variation graphs using blocked partial order alignment")
(description "Pangenome graphs built from raw sets of alignments may have
complex local structures generated by common patterns of genome variation.
These local nonlinearities can introduce difficulty in downstream analyses,
visualization, and interpretation of variation graphs.
@command{smoothxg} finds blocks of paths that are collinear within a variation
graph. It applies partial order alignment to each block, yielding an acyclic
variation graph. Then, to yield a smoothed graph, it walks the original paths
to lace these subgraphs together. The resulting graph only contains cyclic or
inverting structures larger than the chosen block size, and is otherwise
manifold linear. In addition to providing a linear structure to the graph,
smoothxg can be used to extract the consensus pangenome graph by applying the
heaviest bundle algorithm to each chain.
To find blocks, smoothxg applies a greedy algorithm that assumes that the graph
nodes are sorted according to their occurence in the graph's embedded paths.
The path-guided stochastic gradient descent based 1D sort implemented in
@command{odgi sort -Y} is designed to provide this kind of sort.")
(properties `((tunable? . #t)))
(license license:expat)))
;; TODO: Unbundle BBHash, parallel-hashmap, zstr
(define-public pggb
(package
(name "pggb")
(version "0.7.4")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/pangenome/pggb")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1mzyr15l40hrjkdzrq49xzbby9a3a70j7glwf74k9z53firp0pf6"))))
(build-system copy-build-system)
(arguments
(list
#:install-plan
#~'(("pggb" "bin/")
("partition-before-pggb" "bin/")
("scripts/" "bin/")
("scripts" "bin/scripts"))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'force-python3
(lambda _
(substitute* (find-files "scripts" "\\.py$")
(("/usr/bin/python") "/usr/bin/python3"))))
(add-after 'install 'wrap-scripts
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(for-each
(lambda (file)
(wrap-script file
`("PATH" ":" prefix
,(map (lambda (input) (string-append input "/bin"))
(list #$(this-package-input "bc")
#$(this-package-input "bedtools")
#$(this-package-input "gfaffix")
#$(this-package-input "htslib")
#$(this-package-input "odgi")
#$(this-package-input "parallel")
#$(this-package-input "pigz")
#$(this-package-input "python")
#$(this-package-input "samtools")
#$(this-package-input "seqwish")
#$(this-package-input "smoothxg")
#$(this-package-input "time")
#$(this-package-input "util-linux")
#$(this-package-input "wfmash"))))))
(list (string-append out "/bin/pggb")
(string-append out "/bin/partition-before-pggb")))))))))
(inputs
(list bc
bedtools
gfaffix
guile-3.0
htslib
odgi
parallel
pigz
python
python-igraph
samtools
seqwish
smoothxg
time
util-linux
;; Pinned to the wfmash-0.14 post-release snapshot used by
;; the workshop (commit 7bf8988); also avoids the ABI skew
;; with the surrounding wfmash-0.14 release.
wfmash-0.14-snapshot))
(home-page "https://doi.org/10.1101/2023.04.05.535718")
(synopsis "PanGenome Graph Builder")
(description "pggb builds pangenome variation graphs from a set of input
sequences using wfmash, seqwish, smoothxg, and gfaffix.")
(license license:expat)))
(define-public wfmash-0.14
(package
(inherit wfmash)
(version "0.14.0")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/waveygang/wfmash/releases/download/v"
version "/wfmash-v" version ".tar.gz"))
(sha256
(base32 "1mk3jschn3hdr45glds65g3hxk7v6nc3plkvxmfbd5pr4kyzlf13"))
(snippet
#~(begin
(use-modules (guix build utils))
(delete-file-recursively "src/common/atomic_queue")
(substitute* "src/align/include/computeAlignments.hpp"
(("\"common/atomic_queue/atomic_queue.h\"")
"<atomic_queue/atomic_queue.h>"))
(substitute* (find-files "." "CMakeLists\\.txt")
(("-march=native ") ""))))))
(arguments
(substitute-keyword-arguments (package-arguments wfmash)
((#:tests? tests? #f) #f) ; inherit from wfmash; same rationale
((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
(delete 'install-scripts)
(replace 'build-check-prerequisites
(lambda _
(let ((wfa2-lib #$(string-append "../wfmash-v"
"0.14.0"
"/src/common/wflign/deps/WFA2-lib")))
(substitute* (string-append wfa2-lib "/Makefile")
(("-march=x86-64-v3") ""))
(substitute* (string-append wfa2-lib "/tests/wfa.utest.sh")
(("\\\\time -v") "time"))
(invoke "make" "-C" wfa2-lib
#$(string-append "CC=" (cc-for-target))))))))))
(inputs
(modify-inputs (package-inputs wfmash)
(prepend jemalloc)
(delete "libdeflate")))))
(define-public wfmash-0.14-snapshot
;; wfmash-0.14 pinned at a post-0.14.0 commit for the workshop.
;; Inherits everything from wfmash-0.14; overrides only the source
;; (now a git snapshot) and the build-check-prerequisites phase that
;; hardcodes the upstream tarball directory name.
(let* ((commit "7bf89888a09d517635c77822e9ea922e7dfc7fb6")
(revision "0")
(snapshot-version (git-version "0.14.0" revision commit))
;; Out-of-source cmake build: cwd is .../build/, source is at
;; ../source/ (gnu-build-system unpacks git-fetch checkouts
;; into a directory literally named "source", regardless of
;; the package's file-name).
(source-dir "source"))
(package
(inherit wfmash-0.14)
(version snapshot-version)
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/waveygang/wfmash")
(commit commit)))
(file-name source-dir)
(sha256
(base32 "0gffr253c571pzr7a8rmj8ir6i0nspbrsmqa727wmsgzc277ms0n"))
(snippet
#~(begin
(use-modules (guix build utils))
(delete-file-recursively "src/common/atomic_queue")
(substitute* "src/align/include/computeAlignments.hpp"
(("\"common/atomic_queue/atomic_queue.h\"")
"<atomic_queue/atomic_queue.h>"))
(substitute* (find-files "." "CMakeLists\\.txt")
(("-march=native ") ""))))))
(arguments
(substitute-keyword-arguments (package-arguments wfmash-0.14)
((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
(replace 'build-check-prerequisites
(lambda _
(let ((wfa2-lib #$(string-append
"../" source-dir
"/src/common/wflign/deps/WFA2-lib")))
(substitute* (string-append wfa2-lib "/Makefile")
(("-march=x86-64-v3") ""))
(substitute* (string-append wfa2-lib "/tests/wfa.utest.sh")
(("\\\\time -v") "time"))
(invoke "make" "-C" wfa2-lib
#$(string-append "CC=" (cc-for-target)))))))))))))
;; wfa2-lib v2.3.6 with cmake build, pkg-config support
(define-public wfa2-lib/cmake
(package
(name "wfa2-lib")
(version "2.3.6")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/smarco/WFA2-lib")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0hfgq09r0ndrsa2jwy9wkg8p7xzgvclbj5ysp73bawwkgwpgfhy4"))))
(build-system cmake-build-system)
(native-inputs
(list pkg-config time))
(arguments
(list
#:configure-flags
#~(list "-DCMAKE_BUILD_TYPE=RelWithDebInfo")))
(home-page "https://github.com/smarco/WFA2-lib")
(synopsis "Wavefront alignment algorithm library")
(description "The wavefront alignment (WFA) algorithm is an exact
gap-affine algorithm that takes advantage of homologous regions between the
sequences to accelerate the alignment process.")
(properties '((tunable? . #t)))
(license license:expat)))
(define vcflib-fastahack-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/fastahack")
(commit "bb332654766c2177d6ec07941fe43facf8483b1d")))
(file-name (git-file-name "fastahack" "bb332654"))
(sha256 (base32 "0rp1blskhzxf7vbh253ibpxbgl9wwgyzf1wbkxndi08d3j4vcss9"))))
(define vcflib-smithwaterman-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/smithwaterman")
(commit "2610e259611ae4cde8f03c72499d28f03f6d38a7")))
(file-name (git-file-name "smithwaterman" "2610e259"))
(sha256 (base32 "0i9d8zrxpiracw3mxzd9siybpy62p06rqz9mc2w93arajgbk45bs"))))
(define vcflib-intervaltree-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/intervaltree")
(commit "aa5937755000f1cd007402d03b6f7ce4427c5d21")))
(file-name (git-file-name "intervaltree" "aa593775"))
(sha256 (base32 "0p9aphy6sc01dg67xzqpnhvjmk21xa380bpfbkz24a23s6krhjwl"))))
(define vcflib-fsom-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/fsom")
(commit "56695e1611d824cda97f08e932d25d08419170cd")))
(file-name (git-file-name "fsom" "56695e16"))
(sha256 (base32 "1ysa209j0wjv763g882jidpxiakd37s96b0avg15cwbfdxzmj7ri"))))
(define vcflib-filevercmp-src
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/filevercmp")
(commit "df20dcc4a2a772de56e804e8fbbcdef1ac068bbe")))
(file-name (git-file-name "filevercmp" "df20dcc4"))
(sha256 (base32 "16gbpc3vax4k51i5xjc5an5qjjddqycfrdkp4qvw9x2kvqbwyxh3"))))
(define-public vcflib
(let ((commit "b118a9bfd99b07da9d40d0bd8b3c2bdc4523b568")
(revision "1"))
(package
(name "vcflib")
(version (git-version "1.0.15" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/vcflib/vcflib")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "07xvma6iln4wsg7qhgvk3yaqy7plhqj5c9z0lib1xjvninc67874"))))
(build-system cmake-build-system)
(inputs
(list htslib
pandoc
perl
python
python-pytest
pybind11
ruby
tabixpp
time
wfa2-lib/cmake
xz
zig-0.15))
(native-inputs
(list pkg-config))
(arguments
(list
#:configure-flags
#~(list "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
#:tests? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-submodules
(lambda _
(copy-recursively #$vcflib-fastahack-src "contrib/fastahack")
(copy-recursively #$vcflib-smithwaterman-src "contrib/smithwaterman")
(copy-recursively #$vcflib-intervaltree-src "contrib/intervaltree")
(copy-recursively #$vcflib-fsom-src "contrib/fsom")
(copy-recursively #$vcflib-filevercmp-src "contrib/filevercmp"))))))
(home-page "https://github.com/vcflib/vcflib/")
(synopsis "Library for parsing and manipulating VCF files")
(description "Vcflib provides methods to manipulate and interpret
sequence variation as it can be described by VCF. It is both an API for parsing
and operating on records of genomic variation as it can be described by the VCF
format, and a collection of command-line utilities for executing complex
manipulations on VCF files.")
(license license:expat))))
(define-public vg
(package
(name "vg")
(version "1.72.0")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/vgteam/vg/releases/download/v"
version "/vg-v" version ".tar.gz"))
(sha256
(base32 "17s5vd4ry8hys6jkramdkspw5w287airfca68gb6fiapcavqaz0w"))
(snippet
#~(begin
(use-modules (guix build utils))
(substitute* (find-files "." "(CMakeLists\\.txt|Makefile)")
(("-march=native") "")
(("-mtune=native") "")
(("-msse4.2") "")
(("-mcx16") ""))))))
(build-system gnu-build-system)
(arguments
(list
#:make-flags
#~(list (string-append "CC=" #$(cc-for-target))
(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
#:phases
#~(modify-phases %standard-phases
(delete 'configure) ; no configure script
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(add-after 'unpack 'patch-source
(lambda* (#:key inputs #:allow-other-keys)
;; Add subdirectory include paths for system packages
(let ((extra-includes
(string-join
(list (search-input-directory inputs "/include/vcflib")
(search-input-directory inputs "/include/fastahack")
(search-input-directory inputs "/include/cairo")
(search-input-directory inputs "/include/raptor2"))
":")))
(setenv "CPLUS_INCLUDE_PATH"
(string-append extra-includes
":" (or (getenv "CPLUS_INCLUDE_PATH") "")))
(setenv "C_INCLUDE_PATH"
(string-append extra-includes
":" (or (getenv "C_INCLUDE_PATH") ""))))
(substitute* "Makefile"
;; PKG_CONFIG_DEPS - use external vcflib and fastahack
(("cairo libzstd")
"cairo htslib libzstd libdw libelf protobuf raptor2 sdsl-lite tabixpp vcflib fastahack libdeflate libwfa2")
;; Skip the part where we link static libraries special
(("-Wl,-B.*") "\n")
(("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libtabixpp\\.a") "$(LIB_DIR)/libtabixpp.a")
((" \\$\\(LIB_DIR\\)/libtabixpp\\.a")
(string-append " " (search-input-file inputs "/lib/libtabixpp.so")))
(("\\$\\(LIB_DIR\\)/pkgconfig/tabixpp\\.pc")
(string-append " " (search-input-file inputs "/lib/pkgconfig/tabixpp.pc")))
(("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libhts\\.a") "$(LIB_DIR)/libhts.a")
((" \\$\\(LIB_DIR\\)/libhts\\.a")
(string-append " " (search-input-file inputs "/lib/libhts.so")))
(("\\$\\(LIB_DIR\\)/pkgconfig/htslib\\.pc")
(string-append " " (search-input-file inputs "/lib/pkgconfig/htslib.pc")))
(("\\$\\(CWD\\)/\\$\\(LIB_DIR\\)/libdeflate\\.a") "$(LIB_DIR)/libdeflate.a")
((" \\$\\(LIB_DIR\\)/libdeflate\\.a")
(string-append " " (search-input-file inputs "/lib/libdeflate.so")))
;; Use external vcflib
((" \\$\\(LIB_DIR\\)/libvcflib.a")
(string-append " " (search-input-file inputs "/lib/libvcflib.so")))
((" \\$\\(BIN_DIR\\)/vcf2tsv")
(string-append " " (search-input-file inputs "/bin/vcf2tsv")))
((" \\$\\(FASTAHACK_DIR\\)/fastahack")
(string-append " " (search-input-file inputs "/bin/fastahack")))
(("\\+= \\$\\(OBJ_DIR\\)/Fasta\\.o") "+=")
;; Add fastahack, smithwaterman, cairo to linker flags
(("-lvcflib") "-lvcflib -lfastahack -lsmithwaterman -lcairo")
((" \\$\\(LIB_DIR\\)/libsnappy.a")
(string-append " " (search-input-file inputs "/lib/libsnappy.so")))
;; Only link against the libraries in the elfutils package.
(("-ldwfl -ldw -ldwelf -lelf -lebl") "-ldw -lelf")
((" \\$\\(LIB_DIR\\)/libelf.a")
(string-append " " (search-input-file inputs "/lib/libelf.so")))
((" \\$\\(LIB_DIR\\)/libdw.a")
(string-append " " (search-input-file inputs "/lib/libdw.so")))
((" \\$\\(LIB_DIR\\)/%divsufsort.a")
(string-append " " (dirname
(search-input-file inputs "/lib/libdivsufsort.so"))
"%divsufsort.so"))
((" \\$\\(LIB_DIR\\)/libdivsufsort.a")
(string-append " " (search-input-file inputs "/lib/libdivsufsort.so")))
((" \\$\\(LIB_DIR\\)/%divsufsort64.a")
(string-append " " (dirname
(search-input-file inputs "/lib/libdivsufsort64.so"))
"%divsufsort64.so"))
((" \\$\\(LIB_DIR\\)/libdivsufsort64.a")
(string-append " " (search-input-file inputs "/lib/libdivsufsort64.so")))
((" \\$\\(LIB_DIR\\)/libjemalloc.a")
(string-append " " (search-input-file inputs "/lib/libjemalloc.a")))
((" \\$\\(INC_DIR\\)/sparsehash")
(string-append " " (search-input-directory inputs "/include/sparsehash")))
((" \\$\\(INC_DIR\\)/raptor2")
(string-append " " (search-input-directory inputs "/include/raptor2")))
((" \\$\\(LIB_DIR\\)/libraptor2.a")
(string-append " " (search-input-file inputs "/lib/libraptor2.so")))
((" \\$\\(BIN_DIR\\)/rapper")
(string-append " " (search-input-file inputs "/bin/rapper"))))
;; Create obj and lib directories. They do not exist in
;; the release tarball.
(mkdir "deps/libbdsg/bdsg/obj")
(mkdir "deps/libbdsg/lib")
;; Do not remove obj and lib directories in the clean target.
(substitute* "deps/libbdsg/Makefile"
(("\\[ ! -e \\$\\(OBJ_DIR\\) \\][^\n]*") "")
(("\\[ ! -e \\$\\(LIB_DIR\\) \\][^\n]*") ""))))
(add-after 'unpack 'link-with-some-shared-libraries
(lambda* (#:key inputs #:allow-other-keys)
(substitute* '("deps/mmmultimap/CMakeLists.txt"
"deps/xg/CMakeLists.txt"
"deps/xg/deps/mmmulti/CMakeLists.txt")
(("\".*libsdsl\\.a\"") "\"-lsdsl\"")
(("\".*libdivsufsort\\.a\"") "\"-ldivsufsort\"")
(("\".*libdivsufsort64\\.a\"") "\"-ldivsufsort64\"")
(("\\$\\{sdsl-lite_INCLUDE\\}")
(search-input-directory inputs "/include/sdsl"))
(("\\$\\{sdsl-lite-divsufsort_INCLUDE\\}")
(dirname
(search-input-file inputs "/include/divsufsort.h"))))))
(add-after 'unpack 'dont-build-shared-vgio
(lambda _
;; vg will link with libvgio and fail the 'validate-runpath phase.
(substitute* "deps/libvgio/CMakeLists.txt"
(("TARGETS vgio vgio_static") "TARGETS vgio_static"))))
(add-after 'unpack 'adjust-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash-tap (assoc-ref inputs "bash-tap")))
(substitute* (find-files "test/t")
(("BASH_TAP_ROOT.*")
(string-append "BASH_TAP_ROOT=" bash-tap "/bin\n"))
((".*bash-tap-bootstrap")
(string-append ". " bash-tap "/bin/bash-tap-bootstrap")))
(substitute* "test/t/02_vg_construct.t"
(("../deps/fastahack/fastahack") (which "fastahack"))
(("../bin/vcf2tsv") (which "vcf2tsv")))
;; Skip failing tests
(substitute* "test/t/02_vg_construct.t"
((".*self-inconsistent.*") "is $(true) \"\" \"\"\n"))
(substitute* "test/t/07_vg_map.t"
(("identity\\) 1 \"") "identity) 1.0 \""))
(substitute* '("test/t/07_vg_map.t"
"test/t/33_vg_mpmap.t")
((".*node id.*") "is $(true) \"\" \"\"\n"))
(substitute* "test/t/48_vg_convert.t"
(("true \"vg.*") "true \"true\"\n"))
(substitute* "test/t/50_vg_giraffe.t"
((".*A long read can.*") "is $(true) \"\" \"\"\n")
((".*A long read has.*") "is $(true) \"\" \"\"\n")
((".*Long read minimizer.*") "is $(true) \"\" \"\"\n"))
;; Don't test the docs, we're not providing npm
(substitute* "Makefile"
((".*test-docs.*") "")))))
(add-after 'build 'build-manpages
(lambda* (#:key make-flags #:allow-other-keys)
;; vg is not in PATH. Replace it with full path.
(substitute* "doc/vgmanmd.py"
(("'vg'") "'./bin/vg'"))
(apply invoke "make" "man" make-flags)))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(install-file "bin/vg" (string-append out "/bin"))
(install-file "lib/libhandlegraph.so" (string-append out "/lib"))
(for-each
(lambda (file)
(install-file file (string-append out "/share/man/man1")))
(find-files "doc/man" "\\.1$"))))))
#:test-target "test"))
(native-inputs
(append
(if (supported-package? ruby-asciidoctor)
(list ruby-asciidoctor)
'())
(list asciidoc
bash-tap
bc
cmake-minimal
ghc-pandoc
jq
perl
pkg-config
python
samtools
util-linux
which
xxd)))
(inputs
(list boost
cairo
curl
elfutils
fastahack
htslib
jansson
jemalloc
libdeflate
libdivsufsort
ncurses
openmpi
openssl
protobuf
raptor2
sdsl-lite
smithwaterman
snappy
sparsehash
tabixpp
vcflib
wfa2-lib/cmake
zlib
(list zstd "lib")))
(home-page "https://www.biostars.org/t/vg/")
(synopsis "Tools for working with genome variation graphs")
(description "Variation graphs provide a succinct encoding of the sequences
of many genomes. A variation graph (in particular as implemented in vg) is
composed of:
@enumerate
@item nodes, which are labeled by sequences and ids
@item edges, which connect two nodes via either of their respective ends
@item paths, describe genomes, sequence alignments, and annotations (such as
gene models and transcripts) as walks through nodes connected by edges
@end enumerate
This model is similar to sequence graphs that have been used in assembly and
multiple sequence alignment.")
(properties `((release-monitoring-url . "https://github.com/vgteam/vg/releases")
(tunable? . #t)))
(license
(list
license:expat
license:bsd-2
license:bsd-3
license:asl2.0
license:gpl3+
license:zlib
license:boost1.0))))
(define-public vg-1.71
;; Older release pinned for the pangenome workshop material; the
;; build customisation is identical to vg above so we inherit it
;; and only override version + source (origin must repeat the
;; snippet because overriding source replaces it whole).
(package
(inherit vg)
(version "1.71.0")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/vgteam/vg/releases/download/v"
version "/vg-v" version ".tar.gz"))
(sha256
(base32 "06ag9gb57wjvmxy4pzvskpkph6i6jvs0vy8rjm1xdk3g76l8vhjb"))
(snippet
#~(begin
(use-modules (guix build utils))
(substitute* (find-files "." "(CMakeLists\\.txt|Makefile)")
(("-march=native") "")
(("-mtune=native") "")
(("-msse4.2") "")
(("-mcx16") ""))))))))
(define-public bandage-ng
(package
(name "bandage-ng")
(version "2026.4.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/asl/BandageNG")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "071inw1dd0m430p1qh7w2zdvz7y586hgvhhahwv99016l601ha3c"))))
(build-system cmake-build-system)
(inputs
(list cli11
lexy
qtbase
qtsvg
qtwayland
(list zstd "lib")))
(native-inputs
(list pkg-config))
(arguments
(list
#:configure-flags
#~(list "-DCMAKE_BUILD_TYPE=Release"
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON")
#:tests? #f ; tests require display
#:modules '((guix build cmake-build-system)
(guix build utils)
(ice-9 textual-ports))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'use-system-deps
(lambda _
;; Use system zlib instead of bundled zlib-ng
(substitute* "thirdparty/CMakeLists.txt"
(("if \\(CMAKE_OSX_ARCHITECTURES\\)")
"if (TRUE)"))
;; Remove FetchContent block and replace with find_package
(use-modules (ice-9 textual-ports))
(let ((text (call-with-input-file "CMakeLists.txt"
get-string-all)))
;; Remove lines between "include(FetchContent)" and
;; "FetchContent_MakeAvailable(zstd)" inclusive
(let ((start (string-contains text "include(FetchContent)"))
(end-marker "FetchContent_MakeAvailable(zstd)"))
(let ((end (+ (string-contains text end-marker)
(string-length end-marker)
1))) ; +1 for newline
(call-with-output-file "CMakeLists.txt"
(lambda (out)
(display (substring text 0 start) out)
(display "find_package(lexy REQUIRED)\n" out)
(display "find_package(CLI11 REQUIRED)\n" out)
(display "find_library(ZSTD_LIB zstd REQUIRED)\nfind_path(ZSTD_INCLUDE_DIR zstd.h REQUIRED)\nadd_library(zstd::libzstd_shared SHARED IMPORTED)\nset_target_properties(zstd::libzstd_shared PROPERTIES IMPORTED_LOCATION ${ZSTD_LIB})\ntarget_include_directories(zstd::libzstd_shared INTERFACE ${ZSTD_INCLUDE_DIR})\n" out)
(display (substring text end) out))))))
(substitute* "CMakeLists.txt"
(("libzstd_static") "zstd::libzstd_shared")
(("\\$\\{zstd_SOURCE_DIR\\}/lib") "")))))))
(home-page "https://github.com/asl/BandageNG")
(synopsis "Visualize de novo assembly graphs")
(description "BandageNG is a program for visualising de novo assembly
graphs. It extends the original Bandage with new features including support
for GFA format, annotations, and improved rendering.")
(license license:gpl3+)))
(define-public fastix
(let ((commit "9f2e721d1afe1d7158d307ef7fc2b9f6c2587ec9")
(revision "1"))
(package
(name "fastix")
(version (git-version "0.1.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/fastix")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1ia4wk22m2c4bmx8p4pzn60va4zb04r022ygfn8k9xmv49a21xqz"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f
#:tests? #f ; test deps not available
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'remove-dev-deps
(lambda _
(substitute* "Cargo.toml"
(("\\[dev-dependencies\\]") "[fake-removed]")
(("assert_cmd.*") "")
(("predicates.*") "")))))))
(inputs (cargo-inputs 'fastix
#:module '(gn packages pangenome-rust)))
(home-page "https://github.com/ekg/fastix")
(synopsis "Prefix-renaming FASTA records")
(description "A command line tool to add prefixes to FASTA headers,
supporting pangenomic applications following the PanSN hierarchical naming
specification.")
(license license:expat))))
(define-public rtg-tools
(package
(name "rtg-tools")
(version "3.13")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/RealTimeGenomics/rtg-tools")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "0smykfqd82zacxhpc16g4vlw4lm4jrakjnkzka811s6p16pcmz5w"))))
(build-system ant-build-system)
(inputs
`(("bash-minimal" ,bash-minimal)
("jdk" ,openjdk11)))
(arguments
(list
#:jdk openjdk11
#:build-target "rtg-tools.jar"
#:make-flags
#~(list (string-append "-Drtg.vcs.commit.revision=" #$version))
#:tests? #f ; tests require internet access and are slow
#:phases
#~(modify-phases %standard-phases
;; RPlot.jar is corrupt/old format and fails jar indexing
(delete 'generate-jar-indices)
(replace 'install
(lambda _
(let* ((out #$output)
(share (string-append out "/share/java/rtg-tools"))
(bin (string-append out "/bin"))
(bash #$(this-package-input "bash-minimal"))
(jdk #$(this-package-input "jdk")))
(mkdir-p share)
(mkdir-p bin)
;; Install the main jar
(install-file "build/rtg-tools.jar" share)
;; Install bundled jar dependencies
(for-each (lambda (jar) (install-file jar share))
(find-files "lib" "\\.jar$"))
;; Install a wrapper script
(call-with-output-file (string-append bin "/rtg")
(lambda (port)
(format port "#!~a/bin/bash
CLASSPATH=\"~a/*\"
exec ~a/bin/java -cp \"$CLASSPATH\" com.rtg.RtgTools \"$@\"
" bash share jdk)))
(chmod (string-append bin "/rtg") #o755)))))))
(home-page "https://github.com/RealTimeGenomics/rtg-tools")
(synopsis "Tools for VCF file manipulation and comparison")
(description "RTG Tools includes utilities for dealing with VCF files and
sequence data including @code{vcfeval} for variant comparison, sequence data
simulators, and format conversion utilities.")
(license license:bsd-2)))
;; tracepoints is a library-only Rust crate (no CLI binary); its
;; functionality is exposed via the cigzip tool below. The crate source
;; is available as rust-tracepoints-0.1.0.66a5511 in pangenome-rust.scm
;; for use as a dependency.
(define-public cigzip
(let ((commit "b7cc0ed6abb6515a8ad231d47ef90a06a3a491e8")
(revision "1"))
(package
(name "cigzip")
(version (git-version "0.1.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/AndreaGuarracino/cigzip")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0kmpwkxk86428z3iva2wx0x0aavqqnx0m2sblpvw5mdd4102xjhx"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f
;; Tests require WFA2 C library built in OUT_DIR via build.rs
#:tests? #f
#:phases
#~(modify-phases %standard-phases
(add-before 'build 'copy-ragc-workspace
(lambda* (#:key inputs #:allow-other-keys)
;; ragc has a workspace Cargo.toml; copy it locally and
;; point dependents to the ragc-core subdir.
(let ((ragc (assoc-ref inputs
"rust-ragc-core-0.1.1.40e5cad-checkout")))
(copy-recursively ragc "ragc-workspace"))))
(add-before 'build 'fix-dependency-sources
(lambda _
;; Rewrite all git deps of cigzip and its vendored
;; transitive deps to use guix-vendor local paths.
(let ((cargo-tomls
(list "Cargo.toml"
"guix-vendor/rust-tpa-0.1.0.49f1801-checkout/Cargo.toml"
"guix-vendor/rust-tracepoints-0.1.0.66a5511-checkout/Cargo.toml")))
(for-each
(lambda (file)
(when (file-exists? file)
(substitute* file
(("git = \"https://github.com/AndreaGuarracino/lib_wfa2\"[^,}]*(, rev = \"[0-9a-f]*\")?")
"path = \"../rust-lib-wfa2-0.1.0.8859b6a-checkout\", version = \"0.1.0\"")
(("git = \"https://github.com/AndreaGuarracino/tracepoints\"[^,}]*(, rev = \"[0-9a-f]*\")?")
"path = \"../rust-tracepoints-0.1.0.66a5511-checkout\", version = \"0.1.0\"")
(("git = \"https://github.com/AndreaGuarracino/tpa\"[^,}]*(, rev = \"[0-9a-f]*\")?")
"path = \"../rust-tpa-0.1.0.49f1801-checkout\", version = \"0.1.0\"")
(("git = \"https://github.com/ekg/ragc\", rev = \"40e5cad\"")
"path = \"ragc-workspace/ragc-core\", version = \"0.1.1\""))))
cargo-tomls)
;; The top-level Cargo.toml uses "ragc-workspace/ragc-core"
;; (relative to package root), but vendored Cargo.tomls
;; have sibling paths via ../
(substitute* "Cargo.toml"
(("path = \"\\.\\./rust-lib-wfa2-0.1.0.8859b6a-checkout\"")
"path = \"guix-vendor/rust-lib-wfa2-0.1.0.8859b6a-checkout\"")
(("path = \"\\.\\./rust-tracepoints-0.1.0.66a5511-checkout\"")
"path = \"guix-vendor/rust-tracepoints-0.1.0.66a5511-checkout\"")
(("path = \"\\.\\./rust-tpa-0.1.0.49f1801-checkout\"")
"path = \"guix-vendor/rust-tpa-0.1.0.49f1801-checkout\"")))))
(add-before 'build 'patch-lib-wfa2-use-system
;; Replace lib_wfa2 build.rs to link against system
;; wfa2-lib-static instead of building from submodule.
(lambda _
(let ((wfa2-build "guix-vendor/rust-lib-wfa2-0.1.0.8859b6a-checkout/build.rs"))
(chmod wfa2-build #o644)
(call-with-output-file wfa2-build
(lambda (port)
(display
(string-append
"fn main() {\n"
" println!(\"cargo:rustc-link-lib=static=wfa\");\n"
" println!(\"cargo:rustc-link-lib=gomp\");\n"
" println!(\"cargo:rustc-link-search=native="
#$(file-append wfa2-lib-static "/lib") "\");\n"
"}\n")
port))))
;; Patch bindings_wfa.rs: cast_signed/cast_unsigned are
;; unstable until Rust 1.87.
(substitute*
"guix-vendor/rust-lib-wfa2-0.1.0.8859b6a-checkout/src/bindings_wfa.rs"
(("u32::cast_signed\\(self\\._bitfield_1\\.get\\(0usize, 24u8\\) as u32\\)")
"((self._bitfield_1.get(0usize, 24u8) as u32) as i32)")
(("u32::cast_signed\\(<")
"((<")
((" \\) as u32\\)")
" ) as u32) as i32)")
(("i32::cast_unsigned\\(val\\)")
"(val as u32)")
(("i32::cast_unsigned\\(_flags2\\)")
"(_flags2 as u32)")))))))
(native-inputs (list pkg-config cmake-minimal clang))
(inputs (cons* htslib
wfa2-lib-static
zlib
libdeflate
(list zstd "lib")
(cargo-inputs 'cigzip
#:module '(gn packages pangenome-rust))))
(home-page "https://github.com/AndreaGuarracino/cigzip")
(synopsis "Compressed alignment representation using tracepoints")
(description "cigzip converts between CIGAR strings and tracepoint
representations for efficient alignment storage, using adaptive tracepoints
that segment based on local alignment complexity.")
(license license:expat))))
(define-public gfalook
(let ((commit "5199d77ecc4980b181177c16b94f6e56c0d06e4c")
(revision "1"))
(package
(name "gfalook")
(version (git-version "0.1.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/pangenome/gfalook")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0138abzw0x2fy94k09vi740am8haby2030mi03cl0gzjnf39q5cq"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f
;; No tests in crate (0 unit tests).
#:tests? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'reduce-image-features
(lambda _
;; Only PNG output is used; disable other image formats to
;; reduce heavy transitive dependency tree.
(substitute* "Cargo.toml"
(("image = \"0\\.25\"")
"image = { version = \"0.25\", default-features = false, features = [\"png\"] }")))))))
(inputs (cargo-inputs 'gfalook
#:module '(gn packages pangenome-rust)))
(home-page "https://github.com/pangenome/gfalook")
(synopsis "GFA visualization tool")
(description "gfalook is a Rust reimplementation of odgi viz,
producing PNG and SVG visualizations of pangenome graphs in GFA format.")
(license license:expat))))
(define-public pafplot
(let ((commit "2785b0ef30d37300afc77fd4b04d1d949c143551")
(revision "1"))
(package
(name "pafplot")
(version (git-version "0.1.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ekg/pafplot")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0aisssmmss4jxgnv04qk5gbnzzbzvakkcdr03swps3f1x22rfqdn"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f))
(inputs (cargo-inputs 'pafplot
#:module '(gn packages pangenome-rust)))
(home-page "https://github.com/ekg/pafplot")
(synopsis "Base-level dotplots from PAF alignments")
(description "pafplot renders whole-genome alignments in PAF format as
raster dotplot images, drawing lines for each match to visualize homology
between sequences.")
(license license:expat))))
(define-public agc
(package
(name "agc")
(version "2.1")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/refresh-bio/agc")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0qxrs52lnbm2296b15k1x7dgffv66chac16s7qalp8x0clyfnjgm"))
(snippet
#~(begin
(use-modules (guix build utils))
(substitute* "makefile"
(("-mavx") "")
(("-m64") ""))))))
(build-system gnu-build-system)
(arguments
(list
#:tests? #f ; no test target
#:make-flags
#~(list (string-append "CC=" #$(cxx-for-target))
"agc")
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'fix-missing-includes
(lambda _
(substitute* (find-files "src" "\\.(h|cpp)$")
(("#include <vector>" all)
(string-append "#include <cstdint>\n" all)))))
(replace 'install
(lambda _
(install-file "agc" (string-append #$output "/bin")))))))
(home-page "https://github.com/refresh-bio/agc")
(synopsis "Assembled Genomes Compressor")
(description
"AGC is a tool designed to compress collections of de-novo assembled
genomes. It achieves high compression ratios using a reference-based approach
and can be used for various types of datasets from short viral genomes to
long human genomes.")
(license license:expat)))
(define-public pangenomes
(package
(name "pangenomes")
(version "1.0")
(source #f)
(build-system trivial-build-system)
(arguments
(list #:modules '((guix build utils))
#:builder
#~(begin
(use-modules (guix build utils))
(mkdir-p (string-append #$output "/bin")))))
(propagated-inputs
(list agc
bandage-ng
bedtools
bwa-mem2
cigzip
cosigt
fastga-rs
gafpack
gfalook
gfaffix
gfainject
gfautil
htslib
impg
kfilt
meryl
minimap2
miniprot
odgi
pafplot
pangene
pggb
samtools
seqwish
smoothxg
vcfbub
vcflib
vg
wally
wfmash-0.14))
(home-page "https://github.com/pangenome")
(synopsis "Pangenome tools collection")
(description "Meta package that provides the main pangenome tools:
wfmash, seqwish, smoothxg, odgi, pggb, impg, gfainject, gafpack, cosigt,
and supporting tools like minimap2, samtools, bedtools, bwa-mem2, meryl,
kfilt, miniprot, pangene, wally, and vcfbub.")
(license license:expat)))
(define mempang-workshop-pangenomes
;; pangenomes propagates the current vg (1.72.0) and wfmash-0.14
;; release; the workshop is pinned to vg 1.71.0 and a wfmash-0.14
;; post-release commit. Drop both here so the workshop can list
;; the pinned versions directly without a profile collision.
(package
(inherit pangenomes)
(propagated-inputs
(modify-inputs (package-propagated-inputs pangenomes)
(delete "vg")
(delete "wfmash")))))
(define-public mempang-workshop
(package
(name "mempang-workshop")
(version "1.0")
(source #f)
(build-system trivial-build-system)
(arguments
(list #:modules '((guix build utils))
#:builder
#~(begin
(use-modules (guix build utils))
(mkdir-p (string-append #$output "/bin")))))
(propagated-inputs
(list mempang-workshop-pangenomes
vg-1.71
wfmash-0.14-snapshot
;; libgcc_s.so.1 for the prebuilt impop_k (Part 6) binaries
;; that ship with the MarsicoFL/memimpopk repo.
(list gcc "lib")
bc
bcftools
coreutils
fastix
gawk
gnuplot
graphviz
grep
gzip
multiqc
mummer
pafplot
parallel
pigz
python
python-igraph
python-pycairo
rtg-tools
r-minimal
sed
r-ape
r-data-table
r-gggenes
r-ggplot2
r-ggtree
r-tidyverse
wget
which
zstd))
(home-page "https://github.com/pangenome")
(synopsis "MEMPANG pangenome workshop tools")
(description "Meta package for the MEMPANG pangenome workshop. Includes
all pangenome tools plus R with plotting packages (ggplot2, gggenes, ape,
ggtree, tidyverse) and supporting utilities (wget, zstd).")
(license license:expat)))
|