{"id":19732254,"url":"https://github.com/lifeomic/spark-vcf","last_synced_at":"2025-09-13T22:19:26.993Z","repository":{"id":43445065,"uuid":"109612223","full_name":"lifeomic/spark-vcf","owner":"lifeomic","description":"Spark VCF data source implementation for Dataframes","archived":false,"fork":false,"pushed_at":"2022-07-15T15:09:33.000Z","size":322,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-05T21:51:10.615Z","etag":null,"topics":["dataframe","genomics","genotype","lifeomic","spark","spark-sql","team-clinical-intelligence","variants","vcf","vcf-files"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/lifeomic.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}},"created_at":"2017-11-05T20:08:41.000Z","updated_at":"2024-01-19T14:04:32.000Z","dependencies_parsed_at":"2022-08-30T08:32:12.229Z","dependency_job_id":null,"html_url":"https://github.com/lifeomic/spark-vcf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeomic%2Fspark-vcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeomic%2Fspark-vcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeomic%2Fspark-vcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeomic%2Fspark-vcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifeomic","download_url":"https://codeload.github.com/lifeomic/spark-vcf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251629192,"owners_count":21618119,"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":["dataframe","genomics","genotype","lifeomic","spark","spark-sql","team-clinical-intelligence","variants","vcf","vcf-files"],"created_at":"2024-11-12T00:25:27.374Z","updated_at":"2025-04-30T02:31:59.154Z","avatar_url":"https://github.com/lifeomic.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spark-vcf\nSpark VCF data source implementation in native spark.\n\n# Introduction\n\nSpark VCF allows you to natively load VCFs into an Apache Spark Dataframe/Dataset. To get started with Spark-VCF, you can \nclone or download this repository, then run `mvn package` and use the jar. We are also now in Maven central.\n\nSince spark-vcf is written specifically for Spark, there is less overhead and performance gains in many areas.\n\n# Installation\n\nSpark-vcf can be packaged from source or added as a dependency to your Maven based project.\n\nTo install spark vcf, add the following to your pom:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.lifeomic\u003c/groupId\u003e\n  \u003cartifactId\u003espark-vcf\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor sbt:\n```\nlibraryDependencies += \"com.lifeomic\" % \"spark-vcf\" % \"0.3.0\"\n```\n\nIf you are using gradle, the dependency is:\n```\ncompile group: 'com.lifeomic', name: 'spark-vcf', version: '0.3.0'\n```\n\n# Getting Started\n\nGetting started with Spark VCF is as simple as:\n\n```scala\nval myVcf = spark.read\n    .format(\"com.lifeomic.variants\")\n    .load(\"src/test/resources/example.vcf\")\n```\n\nThe schema contains the standard vcf columns and has the options to expand INFO and/or FORMAT columns. An example schema \nfrom 1000 genomes is shown below:\n\n```\n |-- chrom: string (nullable = true)\n |-- pos: long (nullable = true)\n |-- start: long (nullable = true)\n |-- stop: long (nullable = true)\n |-- id: string (nullable = true)\n |-- ref: string (nullable = true)\n |-- alt: string (nullable = true)\n |-- qual: string (nullable = true)\n |-- filter: string (nullable = true)\n |-- info: map (nullable = true)\n |    |-- key: string\n |    |-- value: string (valueContainsNull = true)\n |-- gt: string (nullable = true)\n |-- sampleid: string (nullable = true)\n\n```\n\nThere are options that you can use as well for the `Format` and `Info` columns. To return the format fields as a map, \ninstead of separate fields, you can set the `use.format.map` variable to `true`. This can be used to speed up the spark \njob even more, as it doesn't have to read the header file for type and column information.\n\n```scala\nval mappedFormat = spark.read\n    .format(\"com.lifeomic.variants\")\n    .option(\"use.format.map\", \"true\")\n    .load(\"src/test/resources/example.vcf\")\n```\n\nYou can also stringly type the formats as well by setting `use.format.type` to false.\n\nOne more note worth mentioning: while the core of spark-vcf is written as a Spark data source, it is still advisable to use \nthe BGZFEnhancedGzipCodec from Hadoop-BAM for splitting bgzip files, so that Spark can properly partition the files. For example:\n\n```scala\nval sparkConf = new SparkConf()\n        .setAppName(\"testing\")\n        .setMaster(\"local[8]\")\n        .set(\"spark.hadoop.io.compression.codecs\", \"org.seqdoop.hadoop_bam.util.BGZFEnhancedGzipCodec\")\n```\n\n# TODO\n* Provide performance benchmarks compared to other libraries\n* Get Travis CI set up\n\n# License\n\nThe MIT License\n\nCopyright 2017 Lifeomic\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeomic%2Fspark-vcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifeomic%2Fspark-vcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeomic%2Fspark-vcf/lists"}