silico.biotoul.fr
 

M2BBS - IDH

From silico.biotoul.fr

(Difference between revisions)
Jump to: navigation, search
m (Données et scripts)
m (Intégration dans une base de données orientée graphes)
Line 39: Line 39:
* https://neo4j.com/developer/get-started/
* https://neo4j.com/developer/get-started/
* pilotes : [https://neo4j.com/developer/python/ python] ; [https://neo4j.com/developer/r/ R]
* pilotes : [https://neo4j.com/developer/python/ python] ; [https://neo4j.com/developer/r/ R]
-
** (pas besoin mais pour info) R : Install RNeo4j using devtools. (from https://nicolewhite.github.io/2014/05/30/demo-of-rneo4j-part1.html)
 
-
install.packages("devtools")
 
-
devtools::install_github("nicolewhite/RNeo4j")
 
-
library(RNeo4j)
 
* Cypher reference card: https://neo4j.com/docs/cypher-refcard/current/
* Cypher reference card: https://neo4j.com/docs/cypher-refcard/current/
-
* et dans guest@enseignant:/home/Documents/eBooks
+
* et dans guest@intervenant:/home/Documents/eBooks
* exemples d'applications :
* exemples d'applications :
** graphe de co-expression : https://neo4j.com/graphgist/dba96ed2-2d3c-469c-a1a4-cda067c873fc
** graphe de co-expression : https://neo4j.com/graphgist/dba96ed2-2d3c-469c-a1a4-cda067c873fc
** réseau métabolique : https://neo4j.com/graphgist/563e4bfc-a3d8-479d-b065-1f9c9b84027e#listing_category=science
** réseau métabolique : https://neo4j.com/graphgist/563e4bfc-a3d8-479d-b065-1f9c9b84027e#listing_category=science
 +
 +
<!--
 +
** (pas besoin mais pour info) R : Install RNeo4j using devtools. (from https://nicolewhite.github.io/2014/05/30/demo-of-rneo4j-part1.html)
 +
install.packages("devtools")
 +
devtools::install_github("nicolewhite/RNeo4j")
 +
library(RNeo4j)
 +
-->
 +
 +
Téléchargement linuxhttps://neo4j.com/download/community-edition/
 +
 +
Installation (cf. https://neo4j.com/docs/operations-manual/current/deployment/#linux-installation)
Installation (cf. https://neo4j.com/docs/operations-manual/current/deployment/#linux-installation)
-
  tar tzf neo4j-community-3.0.6-unix.tar.gz
+
  tar tf neo4j-community-3.2.3-unix.tar.gz
-
  tar xzf neo4j-community-3.0.6-unix.tar.gz
+
  tar xf neo4j-community-3.2.3-unix.tar.gz
-
  cd neo4j-community-3.0.6/
+
  cd neo4j-community-3.2.3/
Démarrage et arrêt du serveur
Démarrage et arrêt du serveur

Revision as of 15:04, 4 September 2017

Contents

Enrichment analysis

Dans cette partie, il s'agit d'analyser un groupe de gènes en le confrontant à des groupes de gènes obtenus selon différentes fonctions de regroupement.

La fonction de regroupement proposée est l'appartenance à une même voie métabolique dans la banque de données BioCyc. Ainsi, pour chaque pathway, un groupe de gène est formé.

Le script python search_enriched_sets.py permet de charger ces ensembles de gènes pré-formés EcolA.biocyc.sets et de chercher les plus similaires à un groupe de gènes d'intérêts. Essayez-le avec ALAS ARGS ASNS ASPS CYSS GLTX GLYQ GLYS HISS ILES par exemple pour vous faire une idée de son fonctionnement.

Remarque : le script python utilise le module scipy.

root> pip install scipy

Comparez les résultats avec ceux obtenus en recherchant parmi les ensembles formés des gènes annotés avec le même terme de la Gene Ontology (EcolA.go.sets). Que constatez-vous ?

Travail à réaliser :

  • Analyser le code source du script search_enriched_sets.py
  • Pour chaque pathway biocyc, proposer le term GO le plus représentatif
  • Visualisation des résultats avec REVIGO

Prise en main de la librairie R/Bioconductor R-STRINGdb

Sites et documentation :

Travail à réaliser :

  • Installer la librairie (si nécessaire)
  • Retrouver l'espèce Escherichia coli K12 MG1655, quel est son identifiant taxonomique/STRINGdb ?
  • Quelle est la différence entre STRINGdb core et STRINGdb periphery ?
  • Télécharger tout le graphe pour E. coli K12 pour un seuil de 400. A quoi correspond ce seuil ? combien d'interactions obtenez-vous ?
  • Afficher le sous graphe pour les groupe de gènes ALAS ARGS ASNS ASPS CYSS GLTX GLYQ GLYS HISS ILES. A quoi correspond la p-valeur affichée ?
  • Télécharger les annotations associées à chaque sommet.

Intégration dans une base de données orientée graphes

Sites et documentations :


Téléchargement linuxhttps://neo4j.com/download/community-edition/


Installation (cf. https://neo4j.com/docs/operations-manual/current/deployment/#linux-installation)

tar tf neo4j-community-3.2.3-unix.tar.gz
tar xf neo4j-community-3.2.3-unix.tar.gz
cd neo4j-community-3.2.3/

Démarrage et arrêt du serveur

./bin/neo4j console

Le processus est au premier plan donc pour arrêter le serveur il faut faire Ctrl + C dans le terminal.

Utilisation depuis le navigateur (vérifier le port renseigné lors de la précédente commande)

http://localhost:7474/

Suivre le premier exemple dans Example Graphs intitulé Movie Graph.

Passer ensuite à l'exemple suivant Northwind Graph et adapter les commandes pour importer le modèle suivant :

Requêtes Cypher.

Interfaçage python.

Données et scripts

dnf install libcurl-devel.x86_64

commandes:

  • restauration de la base de données go
mysql -u root -pbioinfo -e 'create database go'
mysql -u root -pbioinfo go < go_daily-termdb-data
  • extraction d'un fichier csv tabulé pour l'import dans neo4j (dans le répertoire import)
 mysql -u root -pbioinfo go -B -e "SELECT id, acc, term_type, name FROM term WHERE acc LIKE 'GO:%' AND is_obsolete=0" > neo4j-community-3.0.6/import/go.terms.csv
  • remplacer les '\t' par des ','
  • import dans neo4j
LOAD CSV WITH HEADERS FROM "file:///go.terms.csv" AS row
CREATE (n:GOTerm)
SET n = row,
 n.id = row.id,
 n.acc = row.acc,
 n.term_type = row.term_type,
 n.name = row.name  

CREATE INDEX ON :GOTerm(id)
CREATE INDEX ON :GOTerm(acc)

MATCH (n:GOTerm) RETURN count(n)
MATCH (n:GOTerm) RETURN n LIMIT 10
MATCH (n:GOTerm {name: 'reproduction'} ) RETURN n

# IS_A (1)
 mysql -u root -pbioinfo go -B -e "SELECT term1_id, term2_id FROM term2term WHERE relationship_type_id = 1" > neo4j-community-3.0.6/import/go.rel.is_a.dump.txt
geany neo4j-community-3.0.6/import/go.rel.is_a.dump.txt

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///go.rel.is_a.dump.txt" AS line
MATCH (t1:GOTerm),(t2:GOTerm)
WHERE t1.id=line.term1_id AND t2.id=line.term2_id 
WITH t1,t2
CREATE UNIQUE (t1)-[:IS_A]->(t2)

# PART_OF (25)
mysql -u root -pbioinfo go -B -e "SELECT term1_id, term2_id FROM term2term WHERE relationship_type_id = 25" > neo4j-community-3.0.6/import/go.rel.part_of.dump.txt
geany neo4j-community-3.0.6/import/go.rel.part_of.dump.txt

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///go.rel.part_of.dump.txt" AS line
MATCH (t1:GOTerm),(t2:GOTerm)
WHERE t1.id=line.term1_id AND t2.id=line.term2_id 
WITH t1,t2
CREATE UNIQUE (t1)-[:PART_OF]->(t2)
# Proteins
sdb = STRINGdb$new(version='10', species=511145, score_threshold=0, input_directory='repo_data')
g=sdb$get_graph()
sp=sdb$get_proteins()
cp ..../repo_data/511145__proteins.tsv.gz neo4j-community-3.0.6/import/
gunzip neo4j-community-3.0.6/import/511145__proteins.tsv.gz 
# remplacer les tabulations par des virgules (si besoin)
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///511145__proteins.csv" AS row 
CREATE (n:Protein)
SET n = row,
 n.id = toInt(row.protein_id),
 n.name = row.protein_external_id
CREATE INDEX ON :Protein(name)

MATCH (p:Protein) RETURN p LIMIT 10
# Liens GO -> Protein
annot=sdb$get_annotations()
cp ...../repo_data/annotations_511145.tsv.gz neo4j-community-3.0.6/import/
gunzip neo4j-community-3.0.6/import/annotations_511145.tsv.gz 
grep 'GO:' annotations_511145.tsv > annotations_511145.csv
# remplacer les tabulations par des virgules et rajouter les noms de colonnes
# prot,got,branch,iea
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "file:///annotations_511145.csv" AS line
MATCH (p:Protein), (goterm:GOTerm)
WHERE p.name=line.prot AND goterm.acc=line.got
WITH p, goterm
CREATE (p)-[:HAS_GO]->(goterm)
# script python
#!/usr/bin/python 
 
from neo4j.v1 import GraphDatabase, basic_auth
 
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "bioinfo"))
session = driver.session()
 
#~ session.run("CREATE (a:Person {name:'Arthur', title:'King'})")
 
result = session.run("MATCH (f:GOTerm)-[:IS_A]->(g:GOTerm) WHERE g.name='reproduction' RETURN f.acc AS acc, f.name AS name")
for record in result:
	print "acc: %s, name: %s" % (record['acc'], record['name'])
	print
 
session.close()