{"id":16692917,"url":"https://github.com/martinsos/opal","last_synced_at":"2025-03-21T18:33:46.163Z","repository":{"id":13718657,"uuid":"16412749","full_name":"Martinsos/opal","owner":"Martinsos","description":"SIMD C/C++ library for massive optimal sequence alignment (local/SW, infix, overlap, global)","archived":false,"fork":false,"pushed_at":"2024-01-12T19:43:24.000Z","size":19904,"stargazers_count":37,"open_issues_count":21,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-15T03:35:01.192Z","etag":null,"topics":["alignment","avx","bioinformatics","c-plus-plus","database-search","sequence-alignment","smith-waterman"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Martinsos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-31T16:05:37.000Z","updated_at":"2025-03-12T12:16:09.000Z","dependencies_parsed_at":"2023-01-11T20:21:10.350Z","dependency_job_id":"e0c4808f-8d77-4d7d-807f-c1b626cb780e","html_url":"https://github.com/Martinsos/opal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martinsos%2Fopal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martinsos%2Fopal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martinsos%2Fopal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martinsos%2Fopal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Martinsos","download_url":"https://codeload.github.com/Martinsos/opal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244849837,"owners_count":20520801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alignment","avx","bioinformatics","c-plus-plus","database-search","sequence-alignment","smith-waterman"],"created_at":"2024-10-12T16:28:50.775Z","updated_at":"2025-03-21T18:33:44.830Z","avatar_url":"https://github.com/Martinsos.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opal\n\n*This work has been supported in part by Croatian Science Fundation under the project UIP-11-2013-7353.*\n\nOpal (ex Swimd) is SIMD C/C++ library for massive optimal sequence alignment.\nOpal is implemented mainly by Rognes's \"Faster Smith-Waterman database searches with inter-sequence SIMD parallelisation\". \nMain difference is that Opal offers support for AVX2 and 4 alignment modes instead of just Smith-Waterman.\n\n#### Requirements\nSSE4.1 or higher.\nIf AVX2 is available, Opal will consume two times more sequences and will therefore work two times faster.\nBy compiling code with makefile and running ./test, you can see if you have SSE4.1 or AVX2 and also see if everything is working.\n\n#### Alignment modes\nOpal offers 4 different modes of alignment: 1 local and 3 global modes, explained below.\n* SW: Local alignment (Smith-Waterman). Useful for finding similar regions in not necessarily similar sequences, and also for finding shorter sequence in longer sequence (text searching).\n* NW: Global alignment (Needleman-Wunsch). Useful for detecting if two sequences of similar lengths are similar.\n* HW: Semi-global alignment. Insertions before query start and insertions after query end are not penalized. Useful for finding query in target.\n* OV: Semi-global alignment. Insertions before start of either query or target and insertions after end of either query or target are not penalized. Useful when sequences are partially overlaping or one of sequences is contained in another.\n\n#### Usage\nTo use Opal you just have to include opal.h in your code and compile your code together with opal.cpp using appropriate compiler flag for SSE, for example -msse4.1 (or just use -march which will detect your arhitecture and will also use appropriate SSE flag).  \nOpal is written for C++11 standard, so you should make sure that you compile it according to that. For `gcc`, add flag `-std=c++11`.\n\n```\n...\n#include \"opal.h\"\n...\n```\n\n```\n...\n// Basic parameters\nint alphabetLength = 4;\nint gapOpen = 3;\nint gapExt = 1;\nint scoreMatrix[16] = {\n    2, -1, -3, 0,\n    -1, 4, -5, -1,\n    -3, -5, 1, -10,\n    0, -1, -10, 4\n};\n\n// Query\nint queryLength = 10;\nunsigned char query[10] = {0,1,3,2,1,0,3,0,1,1};\n\n// Database\nint dbLength = 4;\nunsigned char dbSeq1[14] = {1,3,2,3,0,0,1,0,2,2,1,2,3,2};\nunsigned char dbSeq2[12] = {2,1,1,3,2,0,0,2,2,0,2,1};\nunsigned char dbSeq3[13] = {0,0,2,1,0,3,1,1,2,3,2,1,0};\nunsigned char dbSeq4[9] = {2,3,3,3,1,1,2,2,0};\nunsigned char* db[4] = { dbSeq1, dbSeq2, dbSeq3, dbSeq4 };\nint dbSeqsLengths[4] = {14, 12, 13, 9};\n\n// Results for each sequence in database\nOpalSearchResult results[4];\nfor (int i = 0; i \u003c 4; i++) {\n    opalInitSearchResult(results[i]);\n}\n\n// Do calculation!\nint resultCode = opalSearchDatabase(query, queryLength, db, dbLength, dbSeqsLengths,\n                                    gapOpen, gapExt, scoreMatrix, alphabetLength, results,\n                                    OPAL_MODE_SW, OPAL_OVERFLOW_BUCKETS);\n\n// Print scores\nprintf(\"%d %d %d %d\\n\", results[0].score, results[1].score, results[2].score, results[3].score);\n...\n```\n\nFor more examples of usage take a look at **test.cpp** and **opal_aligner.cpp**.\nFor detailed documentation check out **opal.h**.\n\n## Opal aligner\nIn order to compile and use simple aligner that uses Opal run makefile in src:\n\n    cd src\n    make\n\nType `./opal_aligner` for help.\n\nExamples of usage:\n\n    ./opal_aligner ../test_data/query/O74807.fasta ../test_data/db/uniprot_sprot15.fasta\n    ./opal_aligner -p ../test_data/query/O74807.fasta ../test_data/db/uniprot_sprot15.fasta\n    ./opal_aligner -s ../test_data/query/P18080.fasta ../test_data/db/uniprot_sprot12071.fasta\n    ./opal_aligner -s -a NW ../test_data/query/P18080.fasta ../test_data/db/uniprot_sprot12071.fasta\n\n#### Test data\nIn test_data/ there are two directories, query/ and db/.\nIn query/ are fasta files with one sequence each, while in db/ are fasta files with many sequences each.\nAll fasta files were obtained from www.uniprot.org.\nFile in db/ with name uniprot_sprotN.fasta was generated by taking first N sequences from uniprot_sprot.fasta, which can be found at www.uniprot.org/downloads -\u003e UniProtKB/Swiss-Prot.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinsos%2Fopal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinsos%2Fopal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinsos%2Fopal/lists"}