{"id":22155911,"url":"https://github.com/citiususc/sparkbwa","last_synced_at":"2025-07-26T07:32:29.010Z","repository":{"id":68812770,"uuid":"54981242","full_name":"citiususc/SparkBWA","owner":"citiususc","description":"SparkBWA is a new tool that exploits the capabilities of a Big Data technology as Apache Spark to boost the performance of one of the most widely adopted sequence aligner, the Burrows-Wheeler Aligner (BWA). ","archived":false,"fork":false,"pushed_at":"2019-09-05T07:50:03.000Z","size":2585,"stargazers_count":69,"open_issues_count":6,"forks_count":26,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-16T11:35:33.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/citiususc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-03-29T14:10:36.000Z","updated_at":"2024-04-11T08:18:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe5a6dd8-77e7-4d3a-a6ec-1f7e01cb25f7","html_url":"https://github.com/citiususc/SparkBWA","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/citiususc%2FSparkBWA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2FSparkBWA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2FSparkBWA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2FSparkBWA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/citiususc","download_url":"https://codeload.github.com/citiususc/SparkBWA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227660733,"owners_count":17800411,"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":[],"created_at":"2024-12-02T02:33:03.206Z","updated_at":"2024-12-02T02:33:03.964Z","avatar_url":"https://github.com/citiususc.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What's SparkBWA about? #\n\n**SparkBWA** is a tool that integrates the Burrows-Wheeler Aligner--[BWA][1] on a [Apache Spark][4] framework running on the top of [Hadoop][2]. The current version of SparkBWA (v0.2, October 2016) supports the following BWA algorithms:\n\n* **BWA-MEM**\n* **BWA-backtrack**\n* **BWA-SW**\n\nAll of them work with single-reads and paired-end reads.\n\nIf you use **SparkBWA**, please cite this article:\n\n\u003e José M. Abuin, Juan C. Pichel, Tomás F. Pena and Jorge Amigo. [\"SparkBWA: Speeding Up the Alignment of High-Throughput DNA Sequencing Data\"][5]. PLoS ONE 11(5), pp. 1-21, 2016.\n\nA version for Hadoop is available [here](https://github.com/citiususc/BigBWA).\n\n# Structure #\nSince version 0.2 the project keeps a standard Maven structure. The source code is in the *src/main* folder. Inside it, we can find two subfolders:\n\n* **java** - Here is where the Java code is stored.\n* **native** - Here the BWA native code (C) and the glue logic for JNI is stored.\n\n# Getting started #\n\n## Requirements\nRequirements to build **SparkBWA** are the same than the ones to build BWA, with the only exception that the *JAVA_HOME* environment variable should be defined. If not, you can define it in the */src/main/native/Makefile.common* file. \n\nIt is also needed to include the flag *-fPIC* in the *Makefile* of the considered BWA version. To do this, the user just need to add this option to the end of the *CFLAGS* variable in the BWA Makefile. Considering bwa-0.7.15, the original Makefile contains:\n\n\tCFLAGS=\t\t-g -Wall -Wno-unused-function -O2\n\nand after the change it should be:\n\n\tCFLAGS=\t\t-g -Wall -Wno-unused-function -O2 -fPIC\n\nAdditionaly, and as **SparkBWA** is built with Maven since version 0.2, also have it in the user computer is needed.\n\n## Building\nThe default way to build **SparkBWA** is:\n\n\tgit clone https://github.com/citiususc/SparkBWA.git\n\tcd SparkBWA\n\tmvn package\n\nThis will create the *target* folder, which will contain the *jar* file needed to run **SparkBWA**:\n\n* **SparkBWA-0.2.jar** - jar file to launch with Spark.\n\n## Configuring Spark\nSince version 0.2 there is no need of configuring any Spark parameter. The only requirement is that the YARN containers need to have at least 10GB of memory available (for the human genome case).\n\n## Running SparkBWA ##\n**SparkBWA** requires a working Hadoop cluster. Users should take into account that at least 10 GB of memory per map/YARN container are required (each map loads into memory the bwa index - refrence genome). Also, note that **SparkBWA** uses disk space in the */tmp* directory or in the configured Hadoop or Spark temporary folder.\n\nHere it is an example of how to execute **SparkBWA** using the BWA-MEM algorithm with paired-end reads. The example assumes that our index is stored in all the cluster nodes at */Data/HumanBase/* . The index can be obtained from BWA using \"bwa index\".\n\nFirst, we get the input FASTQ reads from the [1000 Genomes Project][3] ftp:\n\n\twget ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/NA12750/sequence_read/ERR000589_1.filt.fastq.gz\n\twget ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/NA12750/sequence_read/ERR000589_2.filt.fastq.gz\n\t\nNext, the downloaded files should be uncompressed:\n\n\tgzip -d ERR000589_1.filt.fastq.gz\n\tgzip -d ERR000589_2.filt.fastq.gz\n\t\nand uploaded to HDFS:\n\n\thdfs dfs -copyFromLocal ERR000589_1.filt.fastq ERR000589_1.filt.fastq\n\thdfs dfs -copyFromLocal ERR000589_2.filt.fastq ERR000589_2.filt.fastq\n\t\nFinally, we can execute **SparkBWA** on the cluster. Again, we assume that Spark is stored at *spark_dir*:\n\n\tspark_dir/bin/spark-submit --class com.github.sparkbwa.SparkBWA --master yarn-cluster\n\t--driver-memory 1500m --executor-memory 10g --executor-cores 1 --verbose\n\t--num-executors 32 SparkBWA-0.2.jar -m -r -p --index /Data/HumanBase/hg38 -n 32 \n\t-w \"-R @RG\\tID:foo\\tLB:bar\\tPL:illumina\\tPU:illumina\\tSM:ERR000589\"\n\tERR000589_1.filt.fastq ERR000589_2.filt.fastq Output_ERR000589\n\nOptions used:\n\n* **-m** - Sequence alignment algorithm.\n* **-p** - Use paired-end reads.\n* **-w \"args\"** - Can be used to pass arguments directly to BWA (ex. \"-t 4\" to\n  specify the amount of threads to use per instance of BWA).\n* **--index index_prefix** - Index prefix is specified. The index must be available in all the cluster nodes at the same location.\n* The last three arguments are the input and output HDFS files.\n\nAfter the execution, in order to move the output to the local filesystem use:\n\n\thdfs dfs -copyToLocal Output_ERR000589/* ./\n\t\nIn case of not using a reducer, the output will be split into several pieces (files). If we want to put it together we can use \"samtools merge\".\n\nIf you want to check all the available options, execute the command:\n\n\tspark_dir/bin/spark-submit --class com.github.sparkbwa.SparkBWA SparkBWA-0.2.jar -h\n\nThe result is:\n\n    SparkBWA performs genomic alignment using bwa in a Hadoop/YARN cluster\n     usage: spark-submit --class com.github.sparkbwa.SparkBWA SparkBWA-0.2.jar\n           [-a | -b | -m]  [-f | -k] [-h] [-i \u003cIndex prefix\u003e]   [-n \u003cNumber of\n           partitions\u003e] [-p | -s] [-r]  [-w \u003c\"BWA arguments\"\u003e]\n           \u003cFASTQ file 1\u003e [FASTQ file 2] \u003cSAM file output\u003e\n    Help options: \n      -h, --help                                       Shows this help\n    \n    Input FASTQ reads options: \n      -p, --paired                                     Paired reads will be used as input FASTQ reads\n      -s, --single                                     Single reads will be used as input FASTQ reads\n    \n    Sorting options: \n      -f, --hdfs                                       The HDFS is used to perform the input FASTQ reads sort\n      -k, --spark                                      the Spark engine is used to perform the input FASTQ reads sort\n    \n    BWA algorithm options: \n      -a, --aln                                        The ALN algorithm will be used\n      -b, --bwasw                                      The bwasw algorithm will be used\n      -m, --mem                                        The MEM algorithm will be used\n    \n    Index options: \n      -i, --index \u003cIndex prefix\u003e                       Prefix for the index created by bwa to use - setIndexPath(string)\n    \n    Spark options: \n      -n, --partitions \u003cNumber of partitions\u003e          Number of partitions to divide input - setPartitionNumber(int)\n    \n    Reducer options: \n      -r, --reducer                                    The program is going to merge all the final results in a reducer phase\n    \n    BWA arguments options: \n      -w, --bwa \u003c\"BWA arguments\"\u003e                      Arguments passed directly to BWA\n\n## Accuracy\nSparkBWA should be as accurate as running BWA normally. Below are GCAT\nalignment benchmarks which proves this.\n\n**MEM**\n* [Single-reads (400 bp)](http://www.bioplanet.com/gcat/reports/7771-ilmcxyuzdb/alignment/400bp-se-large-indel/sparkbwa-mem)\n* [Pair-ended reads (100 bp)](http://www.bioplanet.com/gcat/reports/7770-ecfkcezhcs/alignment/100bp-pe-small-indel/sparkbwa-mem/compare-23-18)\n* [Pair-ended reads (150 bp)](http://www.bioplanet.com/gcat/reports/7782-dhjurqbogc/alignment/150bp-pe-large-indel/sparkbwa-mem/compare-67-79)\n\n**BWA-backtrack**\n* [Single-reads (100 bp)](http://www.bioplanet.com/gcat/reports/7783-mzrshfceqp/alignment/100bp-se-small-indel/sparkbwa-samse/compare-26-35)\n* [Pair-ended reads (250 bp)](http://www.bioplanet.com/gcat/reports/7784-rxjsfbmmmj/alignment/250bp-pe-large-indel/sparkbwa-sampe/compare-69-81)\n\n**BWA-SW**\n* [Single-reads (400 bp)](http://www.bioplanet.com/gcat/reports/7785-gdbodiqrmn/alignment/400bp-se-large-indel/sparkbwa-bwasw/compare-49-61)\n* [Pair-ended reads (250 bp)](http://www.bioplanet.com/gcat/reports/7786-hteifmsqpm/alignment/250bp-pe-small-indel/sparkbwa-bwasw/compare-68-80)\n\n\n## Frequently asked questions (FAQs)\n\n1. [I can not build the tool because *jni_md.h* or *jni.h* is missing.](#building1)\n\n#### \u003ca name=\"building1\"\u003e\u003c/a\u003e1. I can not build the tool because *jni_md.h* or *jni.h* is missing.\nYou need to set correctly your *JAVA_HOME* environment variable or you can set it in Makefile.common.\n\n[1]: https://github.com/lh3/bwa\n[2]: https://hadoop.apache.org/\n[3]: http://www.1000genomes.org/\n[4]: http://spark.apache.org/\n[5]: http://dx.doi.org/10.1371/journal.pone.0155461\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitiususc%2Fsparkbwa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitiususc%2Fsparkbwa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitiususc%2Fsparkbwa/lists"}