{"id":34700395,"url":"https://github.com/lindenb/hts-rdf","last_synced_at":"2026-03-13T22:33:44.173Z","repository":{"id":194344981,"uuid":"688836773","full_name":"lindenb/hts-rdf","owner":"lindenb","description":"Managing  sequencing data with RDF","archived":false,"fork":false,"pushed_at":"2023-09-15T17:29:07.000Z","size":93,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-12T07:52:48.895Z","etag":null,"topics":["bam","bioinformatics","data-management","ontology","rdf","sparql","tutorial","vcf"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/lindenb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-08T07:55:38.000Z","updated_at":"2023-11-21T04:46:20.000Z","dependencies_parsed_at":"2023-09-13T00:28:34.109Z","dependency_job_id":"efb37b0e-f955-4c9e-9704-c0359b5c258a","html_url":"https://github.com/lindenb/hts-rdf","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.06666666666666665,"last_synced_commit":"52e99b39850f81339bfbacaaa70f353a6aec2152"},"previous_names":["lindenb/hts-rdf"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lindenb/hts-rdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindenb%2Fhts-rdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindenb%2Fhts-rdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindenb%2Fhts-rdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindenb%2Fhts-rdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lindenb","download_url":"https://codeload.github.com/lindenb/hts-rdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lindenb%2Fhts-rdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30478165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T20:45:58.186Z","status":"ssl_error","status_checked_at":"2026-03-13T20:45:20.133Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bam","bioinformatics","data-management","ontology","rdf","sparql","tutorial","vcf"],"created_at":"2025-12-24T22:51:17.751Z","updated_at":"2026-03-13T22:33:44.161Z","avatar_url":"https://github.com/lindenb.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hts-rdf\n\nAuthor: Pierre Lindenbaum PhD.\n\n\nHere are a few notes about Managing  sequencing data with RDF. I want to keep track of the samples, BAMs, references, diseases etc..  used in my lab.\n\n  - This document is auto-generated using a [Makefile](Makefile). Do not edit it.\n  - I don't want to use a `SQL` database.\n  - I don't want to join too many tab delimited files.\n  - I want to use a controlled vocabulary to define things like diseases, organims, etc...\n  - This document is NOT a tutorial for `RDF` or `SPARQL`.\n  - I use the `RDF+XML` notation because I 'm used to work with `XML`.\n  - I created a namespace for my lab:  `https://umr1087.univ-nantes.fr/rdf/` and a `XML` entity for this namespace: `\u0026u1087;`.\n  - I tried to reuse existing ontologies (e.g. `foaf:Person` for samples) as much as I can, but sometimes I created my own classes and properties.\n  - I'm not an expert of `SPARQL` or `RDF`\n  - Required tools are (jena)[https://jena.apache.org/download/], `bcftools` (for `VCFs`), `samtools` (for `BAMs`), `awk`.\n\n\n# Building the RDF GRAPH\n\n## Species\n\nI manually wrote [data/species.rdf](data/species.rdf) defining the species used in my lab.\nWe will use `rdf:subClassOf` to find organisms that are a sub-species of a taxon in the NCBI taxonomy tree.\n\n```rdf\n(...)\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/9606\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.uniprot.org/taxonomy/9605\"/\u003e\n\t\u003cdc:title\u003eHomo Sapiens\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/9605\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.uniprot.org/taxonomy/9604\"/\u003e\n\t\u003cdc:title\u003eHomo\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/9604\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.uniprot.org/taxonomy/all\"/\u003e\n\t\u003cdc:title\u003eHominidae\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/63221\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.uniprot.org/taxonomy/9606\"/\u003e\n        \u003cdc:title\u003eHomo sapiens neanderthalensis\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/10912\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.uniprot.org/taxonomy/all\"/\u003e\n\t\u003cdc:title\u003eRotavirus\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\u003cu:Taxon rdf:about=\"http://purl.uniprot.org/taxonomy/all\"\u003e\n\t\u003cdc:title\u003eROOT\u003c/dc:title\u003e\n\u003c/u:Taxon\u003e\n\n\n\u003c/rdf:RDF\u003e\n```\n\n\n![data/species.svg](data/species.svg)\n\n\n## Diseases / Phenotypes\n\nI manually wrote [data/diseases.rdf](data/diseases.rdf) defining the diseases used in my lab.\nWe will use `rdf:subClassOf` to find diseases that are a sub-disease in a disease ontology tree.\n\n```rdf\n(...)\n    \u003cowl:Class rdf:about=\"http://purl.obolibrary.org/obo/DOID_0080599\"\u003e\n        \u003crdfs:label\u003eCoronavirus infectious disease\u003c/rdfs:label\u003e\n    \u003c/owl:Class\u003e\n\n    \u003cowl:Class rdf:about=\"http://purl.obolibrary.org/obo/DOID_0080600\"\u003e\n        \u003crdfs:label\u003eCOVID-19\u003c/rdfs:label\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.obolibrary.org/obo/DOID_0080599\"/\u003e\n    \u003c/owl:Class\u003e\n\n    \u003cowl:Class rdf:about=\"http://purl.obolibrary.org/obo/DOID_0081013\"\u003e\n\t\u003crdfs:subClassOf rdf:resource=\"http://purl.obolibrary.org/obo/DOID_0080600\"/\u003e\n        \u003crdfs:label\u003eSevere COVID-19\u003c/rdfs:label\u003e\n    \u003c/owl:Class\u003e\n\n    \u003cowl:Class rdf:about=\"http://purl.obolibrary.org/obo/DOID_3491\"\u003e\n        \u003crdfs:label\u003eTurner Syndrome\u003c/rdfs:label\u003e\n    \u003c/owl:Class\u003e\n\n\u003c/rdf:RDF\u003e\n```\n\n\n![data/diseases.svg](data/diseases.svg)\n\n\n## References / FASTA / Genomes\n\nI manually wrote [data/references.tsv](data/references.tsv) a tab delimited text file defining each `FASTA` reference genome available on my cluster.\nThe taxon id will be used to retrive the species associated to a `FASTA` file.\n\n```\n#path                 genomeId   ucsc  taxid\ndata/hg19.fasta       grch37     hg19  9606\ndata/hg38.fasta       grch38     hg38  9606\ndata/rotavirus_rf.fa  rotavirus        10912\n```\n\nThe table is transformed into `RDF` using `awk`:\n\n```bash\ntail -n+2 data/references.tsv |\\\n\tawk -F '\\t' '{printf(\"\u003cu:Reference rdf:about=\\\"\u0026u1087;references/%s\\\"\u003e\\n\\t\u003cu:genomeId\u003e%s\u003c/u:genomeId\u003e\\n\\t\u003cu:filename\u003e%s\u003c/u:filename\u003e\\n\",$2,$2,$1);if($4!=\"\") printf(\"\\t\u003cu:taxon rdf:resource=\\\"http://purl.uniprot.org/taxonomy/%s\\\"/\u003e\\n\",$4); printf(\"\u003c/u:Reference\u003e\\n\");}'\n```\n\noutput:\n\n```rdf\n(...)\n\u003cu:Reference rdf:about=\"\u0026u1087;references/grch37\"\u003e\n\t\u003cu:genomeId\u003egrch37\u003c/u:genomeId\u003e\n\t\u003cu:filename\u003edata/hg19.fasta\u003c/u:filename\u003e\n\t\u003cu:taxon rdf:resource=\"http://purl.uniprot.org/taxonomy/9606\"/\u003e\n\u003c/u:Reference\u003e\n\u003cu:Reference rdf:about=\"\u0026u1087;references/grch38\"\u003e\n\t\u003cu:genomeId\u003egrch38\u003c/u:genomeId\u003e\n\t\u003cu:filename\u003edata/hg38.fasta\u003c/u:filename\u003e\n\t\u003cu:taxon rdf:resource=\"http://purl.uniprot.org/taxonomy/9606\"/\u003e\n\u003c/u:Reference\u003e\n\u003cu:Reference rdf:about=\"\u0026u1087;references/rotavirus\"\u003e\n\t\u003cu:genomeId\u003erotavirus\u003c/u:genomeId\u003e\n\t\u003cu:filename\u003edata/rotavirus_rf.fa\u003c/u:filename\u003e\n\t\u003cu:taxon rdf:resource=\"http://purl.uniprot.org/taxonomy/10912\"/\u003e\n\u003c/u:Reference\u003e\n\u003c/rdf:RDF\u003e\n```\n\n## Samples\n\n\nI manually wrote [data/samples.rdf](data/samples.rdf) defining the samples sequenced in my lab.\nThis is where we can define the gender, associate a sample to a diseases and where we can define the familial relations.\nThe Class `foaf:Group` is used to create a group of samples.\n\n```rdf\n(...)\n  \u003cfoaf:Person rdf:about=\"\u0026u1087;samples/S1\"\u003e\n    \u003cfoaf:name\u003eS1\u003c/foaf:name\u003e\n    \u003cfoaf:gender\u003efemale\u003c/foaf:gender\u003e\n    \u003crel:childOf rdf:resource=\"\u0026u1087;samples/S2\"/\u003e\n    \u003crel:childOf rdf:resource=\"\u0026u1087;samples/S3\"/\u003e\n    \u003cu:has-disease rdf:resource=\"http://purl.obolibrary.org/obo/DOID_0080600\"/\u003e\n    \u003cu:has-disease rdf:resource=\"http://purl.obolibrary.org/obo/DOID_3491\"/\u003e\n  \u003c/foaf:Person\u003e\n\n\n  \u003cfoaf:Person rdf:about=\"\u0026u1087;samples/S2\"\u003e\n    \u003cfoaf:name\u003eS2\u003c/foaf:name\u003e\n    \u003cfoaf:gender\u003efemale\u003c/foaf:gender\u003e\n  \u003c/foaf:Person\u003e\n\n\n  \u003cfoaf:Person rdf:about=\"\u0026u1087;samples/S3\"\u003e\n    \u003cfoaf:name\u003eS3\u003c/foaf:name\u003e\n    \u003cfoaf:gender\u003emale\u003c/foaf:gender\u003e\n    \u003cu:has-disease rdf:resource=\"http://purl.obolibrary.org/obo/DOID_0081013\"/\u003e\n  \u003c/foaf:Person\u003e\n\n  \u003cfoaf:Group rdf:about=\"\u0026u1087;groups/family1\"\u003e\n\t\u003cfoaf:name\u003eFam01\u003c/foaf:name\u003e\n\t\u003cfoaf:member rdf:resource=\"\u0026u1087;samples/S1\"/\u003e\n\t\u003cfoaf:member rdf:resource=\"\u0026u1087;samples/S2\"/\u003e\n\t\u003cfoaf:member rdf:resource=\"\u0026u1087;samples/S3\"/\u003e\n\t\u003cfoaf:member rdf:resource=\"\u0026u1087;samples/S5\"/\u003e\n  \u003c/foaf:Group\u003e\n\n\u003c/rdf:RDF\u003e\n```\n\n## VCF BCF\n\n### VCF and genomes\n\nfor each `VCF` files, we need to associate a `VCF` and the reference genome:\n`Chromosome` and `length` are extracted from the references, we calculate the  `md5` checksum and we sort on  `md5`.\n\n```bash\ntail -n+2 data/references.tsv | sort -T TMP -t $'\\t' -k1,1 \u003e TMP/sorted.refs.txt\ncut -f 1 TMP/sorted.refs.txt | while read FA; do echo -ne \"${FA}\\t\" \u0026\u0026 cut -f 1,2 \"${FA}.fai\" | md5sum | cut -d ' ' -f 1; done \u003e TMP/references.md5.tmp.a\njoin -t $'\\t' -1 1 -2 1  TMP/sorted.refs.txt TMP/references.md5.tmp.a | sort -t $'\\t' -k5,5 \u003e TMP/references.md5\nrm -f  TMP/references.md5.tmp.a\n```\n\nFor each `VCF`, the header is extracted, we extract the `chromosome` and `length` of the `contig` lines, we calculate the `md5` checksum and we sort on  `md5`.\n\n```bash\nfind data -type f \\( -name \"*.vcf.gz\" -o -name \"*.bcf\" -o -name \"*.vcf\" \\) | sort \u003e TMP/vcfs.txt\n(cat TMP/vcfs.txt| while read V ; \\\n\t\tdo echo -en \"${V}\\t\" \u0026\u0026 \\\n\t\tbcftools view --header-only \"${V}\"  | awk  -F '[=,\u003c\u003e]' '/^##contig/ {printf(\"%s\\t%s\\n\",$4,$6);}'   | md5sum | cut -d ' ' -f1 ; done) | sort -t $'\\t' -k2,2 \u003e TMP/vcfs.md5.txt\n```\n\nwe join both files on `md5` and we convert to `RDF` using `awk`:\n\n```bash\ncat data/header.rdf.part \u003e TMP/vcf2ref.rdf\njoin -t $'\\t' -1 2 -2 5 TMP/vcfs.md5.txt TMP/references.md5 |\\\n\tawk -F '\\t' '{printf(\"\u003cu:Vcf rdf:about=\\\"file://%s\\\"\u003e\u003cu:filename\u003e%s\u003c/u:filename\u003e\u003cu:reference rdf:resource=\\\"\u0026u1087;references/%s\\\"/\u003e\u003c/u:Vcf\u003e\",$2,$2,$4); }' \u003e\u003e TMP/vcf2ref.rdf\ncat data/footer.rdf.part \u003e\u003e TMP/vcf2ref.rdf\n```\n\n### VCF and samples\n\nto link the  `VCF` files and the  sample, we use  `bcftools query -l` to extract the samples and we convert to `RDF` using `awk`:\n\n```bash\nfind data -type f \\( -name \"*.vcf.gz\" -o -name \"*.bcf\" -o -name \"*.vcf\" \\) | sort \u003e TMP/vcfs.txt\ncat data/header.rdf.part \u003e TMP/vcf2samples.rdf\ncat TMP/vcfs.txt | while read F; do bcftools query -l \"${F}\" | awk -vVCF=\"$F\" 'BEGIN {printf(\"\u003cu:Vcf rdf:about=\\\"file://%s\\\"\u003e\u003cu:filename\u003e%s\u003c/u:filename\u003e\",VCF,VCF); } {printf(\"\u003cu:sample rdf:resource=\\\"\u0026u1087;samples/%s\\\"/\u003e\",$1);} END {printf(\"\u003c/u:Vcf\u003e\");}' \u003e\u003e TMP/vcf2samples.rdf ; done\ncat data/footer.rdf.part \u003e\u003e TMP/vcf2samples.rdf\n```\n\n\n## BAM files\n\n`BAM` file contains the sample names in their read-groups; We use `samtools samples` to extract the samples, the reference and the path of each `BAM` file.\n[data/samtools.samples.to.rdf.awk](data/samtools.samples.to.rdf.awk) is used to convert the output of `samtools samples`  to `RDF`.\n\n\n```bash\nfind ${PWD}/data -type f -name \"*.bam\" |\\\n\tsamtools samples -F TMP/references.txt |\\\n\tsort -T TMP -t $'\\t' -k3,3 |\\\n\tjoin -t $'\\t' -1 3 -2 1 - TMP/sorted.refs.txt \u003e TMP/bams.txt\n\ncat data/header.rdf.part \u003e TMP/bams.rdf\n\nawk -F '\\t' -f data/samtools.samples.to.rdf.awk TMP/bams.txt \u003e\u003e TMP/bams.rdf\n\ncat data/footer.rdf.part \u003e\u003e TMP/bams.rdf\n```\n\nthe output:\n\n```rdf\n(...)\n  \u003cfoaf:Person rdf:about=\"\u0026u1087;samples/S5\"\u003e\n    \u003cfoaf:name\u003eS5\u003c/foaf:name\u003e\n  \u003c/foaf:Person\u003e\n  \u003cu:Bam rdf:about=\"file:///home/lindenb/src/hts-rdf/data/S5.grch38.bam\"\u003e\n    \u003cu:filename\u003e/home/lindenb/src/hts-rdf/data/S5.grch38.bam\u003c/u:filename\u003e\n    \u003cu:sample rdf:resource=\"\u0026u1087;samples/S5\"/\u003e\n    \u003cu:reference rdf:resource=\"\u0026u1087;references/grch38\"/\u003e\n  \u003c/u:Bam\u003e\n(...)\n```\n\n## Combining all the RDF chunks\n\n[jena/rio](https://jena.apache.org/) is used to merge `RDF` files into [knowledge.rdf](knowledge.rdf)\n\n```bash\nriot --formatted=RDFXML TMP/references.rdf data/species.rdf TMP/bams.rdf data/diseases.rdf data/samples.rdf TMP/vcf2ref.rdf TMP/vcf2samples.rdf \u003e knowledge.rdf\n```\n\n\n# Querying the GRAPH\n\n[jena/arq](https://jena.apache.org/) is used to run the `SPARQL` queries.\n\n```bash\narq --data=knowledge.rdf --query=querysparql\n```\n\n## Example\n\n\u003e show me the species that are a sub-taxon of \"Homo\"\n\n\n\nquery [data/query.species.01.sparql](data/query.species.01.sparql) :\n\n```sparql\n(...)\n\nSELECT DISTINCT ?taxonName\nWHERE {\n\t?taxon dc:title ?taxonName .\n\t?taxon a u:Taxon .\n\t?taxon rdfs:subClassOf* ?root .\n\t?root a u:Taxon .\n\t?root dc:title \"Homo\" .\n}\n```\n\nexecute:\n\n```bash\narq --data=knowledge.rdf --query=data/query.species.01.sparql \u003e TMP/species.01.out\n```\n\noutput [TMP/species.01.out](TMP/species.01.out):\n\n| taxonName  |\n|-----|\n| \"Homo sapiens neanderthalensis\"  |\n| \"Homo Sapiens\"  |\n| \"Homo\"  |\n\n\n\n\n## Example\n\n\u003e show the diseases that are a sub disease of **COVID-19**.\n\n\n\nquery [data/query.diseases.01.sparql](data/query.diseases.01.sparql) :\n\n```sparql\n(...)\n\nSELECT DISTINCT ?diseaseName\nWHERE {\n\t?disease rdfs:label ?diseaseName .\n\t?disease a owl:Class .\n\t?disease rdfs:subClassOf* ?root .\n\t?root a owl:Class .\n\t?root rdfs:label \"COVID-19\" .\n}\n```\n\nexecute:\n\n```bash\narq --data=knowledge.rdf --query=data/query.diseases.01.sparql \u003e TMP/diseases.01.out\n```\n\noutput [TMP/diseases.01.out](TMP/diseases.01.out):\n\n| diseaseName  |\n|-----|\n| \"COVID-19\"  |\n| \"Severe COVID-19\"  |\n\n\n\n\n## Example\n\n\u003e find the samples , their children, parents , diseases\n\n\n\nquery [data/query.samples.01.sparql](data/query.samples.01.sparql) :\n\n```sparql\n(...)\n\nSELECT DISTINCT\n\t\t(SAMPLE(?sampleName) as ?colName)\n\t\t(SAMPLE(?gender) as ?colGender )\n\t\t(SAMPLE(?fatherName) as ?colFather )\n\t\t(SAMPLE(?motherName)  as ?colMother)\n\t\t(GROUP_CONCAT(DISTINCT ?childName; SEPARATOR=\";\") as ?colChildren)\n\t\t(GROUP_CONCAT(DISTINCT ?diseaseName; SEPARATOR=\";\") as ?colDiseases)\n\t\t\nWHERE {\n\t?sample a foaf:Person .\n\t?sample foaf:name ?sampleName .\n\tOPTIONAL {?sample foaf:gender ?gender .}\n\tOPTIONAL {\n\t\t?sample u:has-disease ?disease .\n\t\t?disease a owl:Class .\n\t\t?disease rdfs:label ?diseaseName .\n\t\t} .\n\tOPTIONAL {\n\t\t?father a foaf:Person .\n\t\t?sample rel:childOf ?father .\n\t\t?father foaf:gender \"male\" .\n\t\t?father foaf:name ?fatherName .\n\t\t} .\n\tOPTIONAL {\n\t\t?mother a foaf:Person .\n\t\t?sample rel:childOf ?mother .\n\t\t?mother foaf:gender \"female\" .\n\t\t?mother foaf:name ?motherName .\n\t\t} .\n\tOPTIONAL {\n\t\t?child a foaf:Person .\n\t\t?child rel:childOf ?sample .\n\t\t?child foaf:name ?childName .\n\t\t} .\n}\nGROUP BY  ?sample\n```\n\nexecute:\n\n```bash\narq --data=knowledge.rdf --query=data/query.samples.01.sparql \u003e TMP/samples.01.out\n```\n\noutput [TMP/samples.01.out](TMP/samples.01.out):\n\n| colName | colGender | colFather | colMother | colChildren | colDiseases  |\n|-----|-----|-----|-----|-----|-----|\n| \"S1\" | \"female\" | \"S3\" | \"S2\" |  | \"Turner Syndrome;COVID-19\"  |\n| \"S2\" | \"female\" |  |  | \"S1\" |   |\n| \"S3\" | \"male\" |  |  | \"S1\" | \"Severe COVID-19\"  |\n| \"S4\" |  |  |  |  |   |\n| \"S5\" |  |  |  |  |   |\n\n\n\n\n## Example\n\n\u003e List all the `VCF` files and their samples, at least containing the sample \"S1\"\n\n\n\nquery [data/query.vcfs.01.sparql](data/query.vcfs.01.sparql) :\n\n```sparql\n(...)\n\nSELECT DISTINCT ?vcfPath ?fasta ?taxonName ?sampleName\nWHERE {\n  ?vcf a u:Vcf .\n  ?vcf u:filename ?vcfPath .\n\n   ?vcf u:sample ?sample1 .\n   ?sample1 a foaf:Person .\n   ?sample1 foaf:name \"S1\" .\n\n   ?vcf u:sample ?sample2 .\n   ?sample2 a foaf:Person .\n   ?sample2 foaf:name ?sampleName .\n\n  OPTIONAL {\n\t?vcf u:reference ?ref .\n\t?ref a u:Reference .\n\t?ref u:filename ?fasta\n\n\tOPTIONAL {\n\t\t?ref u:taxon ?taxon .\n\t\t?taxon a u:Taxon .\n\t\t?taxon dc:title ?taxonName .\n\t\t}\n\t}\n\n}\n```\n\nexecute:\n\n```bash\narq --data=knowledge.rdf --query=data/query.vcfs.01.sparql \u003e TMP/vcfs.01.out\n```\n\noutput [TMP/vcfs.01.out](TMP/vcfs.01.out):\n\n| vcfPath | fasta | taxonName | sampleName  |\n|-----|-----|-----|-----|\n| \"data/variants2.vcf\" | \"data/hg19.fasta\" | \"Homo Sapiens\" | \"S1\"  |\n| \"data/variants2.vcf\" | \"data/hg19.fasta\" | \"Homo Sapiens\" | \"S2\"  |\n| \"data/variants2.vcf\" | \"data/hg19.fasta\" | \"Homo Sapiens\" | \"S3\"  |\n| \"data/variants1.vcf\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S1\"  |\n| \"data/variants1.vcf\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S5\"  |\n| \"data/variants1.vcf\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S2\"  |\n| \"data/variants1.vcf\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S3\"  |\n\n\n\n\n## Example\n\n\u003e find the bam , their reference, samples , etc..\n\n\n\nquery [data/query.bams.01.sparql](data/query.bams.01.sparql) :\n\n```sparql\n(...)\n\nSELECT DISTINCT ?bamPath\n\t\t(SAMPLE(?fasta) as ?colFasta)\n\t\t(SAMPLE(?taxonName) as ?colTaxon)\n\t\t(SAMPLE(?sampleName) as ?colSampleName )\n\t\t(GROUP_CONCAT(DISTINCT ?groupName; SEPARATOR=\";\") as ?colGroups )\n\t\t(GROUP_CONCAT(DISTINCT ?gender; SEPARATOR=\";\") as ?colGender )\n\t\t(GROUP_CONCAT(DISTINCT ?diseaseName; SEPARATOR=\";\") as ?colDiseases)\n\t\t(SAMPLE(?fatherName) as ?colFather )\n\t\t(SAMPLE(?motherName)  as ?colMother)\n\t\t(GROUP_CONCAT(DISTINCT ?childName; SEPARATOR=\"; \") as ?colChildren)\nWHERE {\n  ?bam a u:Bam .\n  ?bam u:filename ?bamPath .\n\n  OPTIONAL {\n\t?bam u:reference ?ref .\n\t?ref a u:Reference .\n\t?ref u:filename ?fasta\n\n\tOPTIONAL {\n\t\t?ref u:taxon ?taxon .\n\t\t?taxon a u:Taxon .\n\t\t?taxon dc:title ?taxonName .\n\t\t}\n\t}\n\n  OPTIONAL {\n\t?bam u:sample ?sample .\n\t?sample a foaf:Person .\n\tOPTIONAL {?sample foaf:name ?sampleName .}\n\tOPTIONAL {?sample foaf:gender ?gender .}\n\tOPTIONAL {\n\t\t?group foaf:member ?sample .\n\t\t?group a foaf:Group .\n\t\t?group foaf:name ?groupName .\n\t\t} .\n\tOPTIONAL {\n\t\t?sample u:has-disease ?disease .\n\t\t?disease a owl:Class .\n\t\t?disease rdfs:label ?diseaseName .\n\t\t} .\n\tOPTIONAL {\n\t\t?father a foaf:Person .\n\t\t?sample rel:childOf ?father .\n\t\t?father foaf:gender \"male\" .\n\t\t?father foaf:name ?fatherName .\n\t\t} .\n\tOPTIONAL {\n\t\t?mother a foaf:Person .\n\t\t?sample rel:childOf ?mother .\n\t\t?mother foaf:gender \"female\" .\n\t\t?mother foaf:name ?motherName .\n\t\t} .\n\tOPTIONAL {\n\t\t?child a foaf:Person .\n\t\t?child rel:childOf ?sample .\n\t\t?child foaf:name ?childName .\n\t\t} .\n\t}.\n}\nGROUP BY  ?bamPath\n```\n\nexecute:\n\n```bash\narq --data=knowledge.rdf --query=data/query.bams.01.sparql \u003e TMP/bams.01.out\n```\n\noutput [TMP/bams.01.out](TMP/bams.01.out):\n\n| bamPath | colFasta | colTaxon | colSampleName | colGroups | colGender | colDiseases | colFather | colMother | colChildren  |\n|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|\n| \"/home/lindenb/src/hts-rdf/data/S1.grch38.bam\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S1\" | \"Fam01\" | \"female\" | \"Turner Syndrome;COVID-19\" | \"S3\" | \"S2\" |   |\n| \"/home/lindenb/src/hts-rdf/data/S2.grch37.bam\" | \"data/hg19.fasta\" | \"Homo Sapiens\" | \"S2\" | \"Fam01\" | \"female\" |  |  |  | \"S1\"  |\n| \"/home/lindenb/src/hts-rdf/data/S4.RF.bam\" | \"data/rotavirus_rf.fa\" | \"Rotavirus\" | \"S4\" |  |  |  |  |  |   |\n| \"/home/lindenb/src/hts-rdf/data/S5.grch38.bam\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S5\" | \"Fam01\" |  |  |  |  |   |\n| \"/home/lindenb/src/hts-rdf/data/S3.grch38.bam\" | \"data/hg38.fasta\" | \"Homo Sapiens\" | \"S3\" | \"Fam01\" | \"male\" | \"Severe COVID-19\" |  |  | \"S1\"  |\n| \"/home/lindenb/src/hts-rdf/data/S1.grch37.bam\" | \"data/hg19.fasta\" | \"Homo Sapiens\" | \"S1\" | \"Fam01\" | \"female\" | \"Turner Syndrome;COVID-19\" | \"S3\" | \"S2\" |   |\n\n\n\n\n# The Graph\n\nand here is the `RDF` graph as a `SVG` document:\n\n![knowledge.svg](knowledge.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindenb%2Fhts-rdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flindenb%2Fhts-rdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flindenb%2Fhts-rdf/lists"}