Skip to content

Instantly share code, notes, and snippets.

@rdmpage
Last active August 29, 2015 14:07
Show Gist options
  • Save rdmpage/bc2a1a74ad3f17cf6ad1 to your computer and use it in GitHub Desktop.
Save rdmpage/bc2a1a74ad3f17cf6ad1 to your computer and use it in GitHub Desktop.
GenBank specimen

Simple case of specimen and sequence both in GBIF

// GBIF occurrence
CREATE (occurrence478678909:Occurrence { name: "gbif478678909", catalogNumber: "NMV D 73979" }),
(occurrence478678909)-[:HASNAME]->(name1:Name { name: "Diporiphora magna Storr, 1974"}),
// has code
(sample1:Sample { name: "NMV D 73979" }),
(occurrence478678909)-[:HASCODE]->(sample1),

// data provided by
(dataset1:Dataset { name: "Museum Victoria provider for OZCAM"})<-[:SOURCE]-(occurrence478678909),

// INDSC
(occurrence488924228:Occurrence { name: "gbif488924228", catalogNumber: "HQ699055" }),

// data provided by
(dataset2:Dataset { name: "Geographically tagged INSDC sequences"})<-[:SOURCE]-(occurrence488924228),


// Sequence
(HQ699055:Sequence { accession:"HQ699055", catalogueNumber: "NMVD73979" }),
(HQ699055)-[:SAMEAS]->(occurrence488924228),
(HQ699055)-[:HASCODE]->(sample2:Sample { name: "NMVD73979" }),
(HQ699055)-[:PUBLISHEDIN]->(pub1:Publication { name: "PMID 21166790" }),
(HQ699055)-[:HASNAME]->(name2:Name { name: "Diporiphora magna"}),


// mapping samples
(occurrence478678909)-[:HASCODE]->(sample2)

Merge GBIF records for "same" thing

MATCH (o1:Occurrence)-[:HASCODE]-(Sample)-[:HASCODE]-(Sequence)-[:SAMEAS]-(o2:Occurrence)
WITH o1, collect(o2.name) AS os
RETURN o1.name , os

Get publication linked to sequence and add it to GBIF record form data provider

MATCH (o1:Occurrence)-[:HASCODE]-(Sample)-[:HASCODE]-(s1:Sequence)
WITH o1, s1
MATCH (s1)-[:PUBLISHEDIN]-(p1:Publication)
RETURN o1.name, s1.accession, p1.name

In this example we get the publication linked to the sequence and link it to the voucher specimen provider. This is a way to build a list of publications using provider collections.

MATCH (d1:Dataset)-[:SOURCE]-(o1:Occurrence)-[:HASCODE]-(Sample)-[:HASCODE]-(s1:Sequence)
WITH d1, o1, s1
MATCH (s1)-[:PUBLISHEDIN]-(p1:Publication)
RETURN d1.name, s1.accession, p1.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment