SPARQLthon60/DDBJ

提供:TogoWiki

(版間での差分)
移動: 案内, 検索
(AP011615.1 エントリーに含まれるlocus_tag, feature_type product, gene_symbolのリスト)
(Taxonomy ID: 1148の配列エントリーの’リスト)
102行: 102行:
== Taxonomy ID: 1148の配列エントリーの’リスト ==
== Taxonomy ID: 1148の配列エントリーの’リスト ==
<pre>
<pre>
 +
# Search for a Taxonomy ID "1148" and the anntated sequence enties.
 +
 +
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
-
PREFIX dc:<http://purl.org/dc/elements/1.1/>
 
-
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
 
-
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
 
-
PREFIX sio:<http://semanticscience.org/resource/>
 
PREFIX obo:<http://purl.obolibrary.org/obo/>
PREFIX obo:<http://purl.obolibrary.org/obo/>
-
PREFIX faldo:<http://biohackathon.org/resource/faldo#>
 
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>
-
PREFIX insdcdiv:<http://ddbj.nig.ac.jp/ontologies/nucleotide/Division#>
 
-
PREFIX insdcref:<http://ddbj.nig.ac.jp/ontologies/nucleotide/reference#>
 
PREFIX tax: <http://ddbj.nig.ac.jp/ontologies/taxonomy/>
PREFIX tax: <http://ddbj.nig.ac.jp/ontologies/taxonomy/>
 +
SELECT
SELECT
-
?organism ?sequence_version ?definition  ?sequence_date
+
  ?organism ?sequence_version ?definition  ?sequence_date
WHERE
WHERE
{
{
-
values ?tax_id {tax:1148}  
+
  values ?tax_id {tax:1148}  
-
#values ?taxon_root {tax:1148}
+
  ?entry insdc:sequence ?sequence.
-
#?taxon_root a tax:Taxon .
+
  ?sequence obo:RO_0002162 ?taxon.
-
#?taxon rdfs:subClassOf* ?taxon_root.
+
  ?taxon owl:sameAs ?tax_id.
-
?entry insdc:sequence ?sequence.
+
  ?entry insdc:definition ?definition .
-
?sequence obo:RO_0002162 ?taxon.
+
  ?entry insdc:division ?division .
-
?taxon owl:sameAs ?tax_id.
+
  ?entry insdc:organism ?organism .
-
?entry insdc:definition ?definition .
+
  ?entry insdc:sequence_date ?sequence_date .
-
?entry insdc:division ?division .
+
  ?entry insdc:sequence_version ?sequence_version .
-
?entry insdc:organism ?organism .
+
-
?entry insdc:sequence_date ?sequence_date .
+
-
?entry insdc:sequence_version ?sequence_version .
+
}
}
-
#limit 100
 
ORDER BY ?sequence_date
ORDER BY ?sequence_date
</pre>
</pre>
-
 
-
 
== GTF ==
== GTF ==

2017年10月2日 (月) 07:46時点における版

目次

DDBJ RDFサンプルSPARQL

CP002459.1エントリーのメタデータ取得

#  Search for a DDBJ entry "CP002459.1" and the metadata.

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>

SELECT
  ?predicate ?object
WHERE
{
  VALUES ?entry { <http://identifiers.org/insdc/CP002459.1> }
  VALUES ?predicate { 
    insdc:comment
    insdc:definition
    insdc:division
    insdc:organism
    insdc:sequence_date
    insdc:sequence_version
    insdc:source
    insdc:taxonomy
    insdc:dblink
  }                      
  ?entry rdf:type insdc:Entry. 
  ?entry ?predicate ?object.
}

BioProject ID: PRJNA244038 の配列エントリーのリスト

#  Search for a BioProject entry "PRJNA244038.1" and the anntated sequence enties. 

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>

SELECT
  ?sequence_version ?definition replace(str(?topology), "http://ddbj.nig.ac.jp/ontologies/nucleotide/","") as ?topology
WHERE
{
  VALUES ?project { <http://identifiers.org/bioproject/PRJNA244038> }
  ?entry insdc:dblink ?project.
  ?entry rdf:type insdc:Entry. 
  ?project rdf:type insdc:BioProject.
  ?entry insdc:sequence_version ?sequence_version.
  ?entry insdc:definition ?definition.
  ?entry insdc:sequence ?sequence.
  ?sequence insdc:topology ?topology.
}

PubMed ID: 21441521関連の配列エントリーのリスト

#  Search for a PubMed ID "21441521" and the related DDBJ enties. 

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>

SELECT
  ?sequence_version
WHERE
{
  VALUES ?pubmed { <http://identifiers.org/pubmed/21441521> }
  ?entry rdfs:seeAlso ?pubmed.
  ?entry rdf:type insdc:Entry.  
  ?pubmed rdf:type insdc:PubMed.
  ?entry insdc:sequence_version ?sequence_version.
}

AP011615.1 エントリーに含まれるlocus_tag, feature_type product, gene_symbolのリスト

# Find features containing locus_tag qualifier in DDBJ entry "AP011615.1"

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX obo:<http://purl.obolibrary.org/obo/>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>

select
  ?locus_tag ?feature_type ?product ?gene_symbol
where
{ 
  values ?entry {<http://identifiers.org/insdc/AP011615.1>}.
  ?entry   insdc:sequence ?sequence .
  ?feature obo:so_part_of+ ?sequence .
  ?sequence rdfs:subClassOf obo:SO_0000001 .
  ?feature rdf:type ?type .
  ?type rdfs:label ?feature_type .
  ?feature insdc:locus_tag ?locus_tag.
  ?feature insdc:product ?product .
  OPTIONAL { ?feature insdc:gene ?gene_symbol .}
}
ORDER BY ?locus_tag

Taxonomy ID: 1148の配列エントリーの’リスト

# Search for a Taxonomy ID "1148" and the anntated sequence enties.

PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX obo:<http://purl.obolibrary.org/obo/>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>
PREFIX tax: <http://ddbj.nig.ac.jp/ontologies/taxonomy/>

SELECT
  ?organism ?sequence_version ?definition  ?sequence_date
WHERE
{
  values ?tax_id {tax:1148} 
  ?entry insdc:sequence ?sequence.
  ?sequence obo:RO_0002162 ?taxon.
  ?taxon owl:sameAs ?tax_id.
  ?entry insdc:definition ?definition .
  ?entry insdc:division ?division .
  ?entry insdc:organism ?organism .
  ?entry insdc:sequence_date ?sequence_date .
  ?entry insdc:sequence_version ?sequence_version .
}
ORDER BY ?sequence_date

GTF

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc:<http://purl.org/dc/elements/1.1/>
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX sio:<http://semanticscience.org/resource/>
PREFIX obo:<http://purl.obolibrary.org/obo/>
PREFIX faldo:<http://biohackathon.org/resource/faldo#>
PREFIX insdc:<http://ddbj.nig.ac.jp/ontologies/nucleotide/>
PREFIX insdcdiv:<http://ddbj.nig.ac.jp/ontologies/nucleotide/Division#>
PREFIX insdcref:<http://ddbj.nig.ac.jp/ontologies/nucleotide/reference#>

SELECT
distinct ?seqid ?source replace(str(?type),"http://purl.obolibrary.org/obo/","") as ?feature_type ?start ?end ?score ?strand_type ?strand ?phase ?frame ?gene_id
#distinct ?idorg
WHERE
{
#VALUES ?idorg    {<http://identifiers.org/bioproject/PRJDA42161>}
VALUES ?idorg { <http://identifiers.org/bioproject/PRJNA13415> }
#VALUES ?idorg { <http://identifiers.org/bioproject/PRJNA244> }
#VALUES ?seq_type  { obo:SO_0000340 obo:SO_0000155 }
#VALUES ?type { obo:SO_0000704 obo:SO_0000252 obo:SO_0000253 }
#VALUES ?insdc_type { insdc:Coding_Sequence insdc:Gene insdc:Transfer_RNA insdc:Ribosomal_RNA}
#VALUES ?insdc_type { insdc:Gene insdc:Transfer_RNA insdc:Ribosomal_RNA}
VALUES ?strand_type { faldo:ForwardStrandPosition faldo:ReverseStrandPosition }
VALUES ?source {'DDBJ'}
VALUES ?score {'.'}
VALUES ?frame {'.'}
VALUES ?phase {0}
VALUES ?strand {'.'} # default
?gene rdfs:subClassOf ?type.
?gene insdc:locus_tag ?locus_tag ;
    a ?insdc_type ;
    obo:so_part_of ?seq ;
    faldo:location ?location.
?location faldo:begin ?faldo_begin ;
    faldo:end ?faldo_end.
?faldo_begin rdf:type ?strand_type ;
    faldo:position ?start.
?faldo_end faldo:position ?end.
?entry insdc:sequence ?seq.
?entry insdc:sequence_version ?seqid .
?entry insdc:dblink ?idorg.
?seq rdfs:subClassOf ?seq_type. #only obo:SO_0000001
BIND(?seqid as ?seqname) # for GTF2.2
BIND(?insdc_type as ?feature)  # for GTF2.2
BIND(?phase as ?frame)   # for GTF2.2
BIND(?locus_tag as ?gene_id)
}
ORDER BY ?seqid ?start
limit 100
個人用ツール