SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Pycon.it 2009 Python e bioinformatica Giovanni Marco Dall'Olio Universitá Pompeu Fabra, Biologia Evolutiva, Barcelona
Bioinformatica ,[object Object]
Nata negli anni '70, con lo sviluppo di un metodo per confrontare due sequenze di proteine (Matrici PAM)
Esplosione di dati scientifici ,[object Object]
Costi e tempi diminuiti rapidamente n. sequenze (GenBank) 2009 1996
Tipico esempio di bioinformatica ,[object Object]
Genoma umano ,[object Object]
Non é molto utile finché non la integriamo con altri dati
Che strumenti utilizzare per analizzarla?
Che approcci, che tecniche?
Esempio di annotazione ,[object Object],Coding SNP ????
Bioinfo – altri casi d'uso ,[object Object]
Docking molecolare : simulare l'efficacia di una molecola come farmaco
Bioinfo – altri casi d'uso ,[object Object]
La maggior parte del lavoro di un bioinformatico consiste in questo ,[object Object],[object Object]
Altri esempi – presentare i dati ,[object Object]
Senza, sarebbe impossibile coordinare qualsiasi progetto di ricerca
Alcuni portali (ncbi, uniprot, …) mettono a disposizione dati e tool pubblici
Bioinformatica e programmazione ,[object Object]
-> in bioinformatica sono molto diffusi linguaggi di scripting (perl, python, R, ...)
Python e bioinformatica ,[object Object],www.bioinformatics.org  survey Java Perl Python
Vantaggi di Python in bioinfo ,[object Object]
Facile da imparare
Ottimo per  scripting
Librerie per database, testing, documentazione, calcolo scientifico
Orientato ad oggetti , ma multi-paradigma
Python e bioinformatica Curva d'apprendimento ☺☺☺☺☺ Facile da imparare ma potente Leggibilitá ☺☺☺☺☺ Testing ☺☺☺☺☺ Doctest, unittest, nose Comunitá open source ☺☺☺ BioPerl e BioConductor sono piu' ampi Paradigmi di programmazione ☺☺☺☺☺ Multi paradigma, OO Velocitá di esecuzione  Interpretato;  Database ☺☺☺☺☺ Ottimi ORM (sqlalchemy), supporto ad altri tipi di db
Bioinformatica e programmazione ,[object Object]
Makefiles e simili per creare pipelines
Tests utilizzati anche per comunicare con non-programmatori
Continua necessitá di riadattare scripts
Bioinformatica e scripts ,[object Object]
Piu' facili da riadattare ,[object Object]
Esempio di pipeline (Makefile) ,[object Object]
Esempio più complicato di pipeline mask(S)   flat: S.masked   run: RepeatMasker -lib $(RMLIB) S mask_then_blast(S,D)   flat: S-results/S.D.blast.raw   req:  mask(S) blastindex(D)   srun: blastall -p blastx -i  ....... BioMake  ( http://skam.sourceforge.net/skam-intro.html  )
Testing usato per comunicare ,[object Object]
Come dimostrare che sia corretto?
Testing - esempio ,[object Object]
In bioinformatica é la stessa cosa, solo che molto si fa al computer
Testing - esempio ,[object Object]
Abbiamo scritto un programma per leggere il formato Fasta e convertirlo al formato GenBank,  e testato il suo funzionamento corretto su un file con una sola sequenza, su un file con sequenze multiple, su un file corrotto.....
Python e testing ,[object Object]
Unittest  -> unit test classico con fixtures
Nosetest  -> individua tutte le funzioni che assomigliano a tests e le esegue
doctest >>>  help (say_hello) Help on function say_hello in module __main__: say_hello(name) print hello <name> to the screen  example: >>> say_hello('Albert Einstein') hello Albert Einstein!!!
Doctest esempio 2  ,[object Object]
unittest From unittest import * class SimpleFastaSeqCase(unittest.TestCase): @classmethod def setUpClass(cls): ..... @classmethod def tearDownClass(cls): ..... def setUp(self): ..... def tearDown(self): ..... def testCondition1(self): ..... def testCondition2(self): ..... Istruzioni da eseguire prima/dopo  tutti  i test Istruzioni da eseguire  prima/dopo  ogni  test Tests
Python a oggetti ,[object Object]
Su ogni cromosoma possiamo individuare diversi elementi, come geni, fattori di regolazione, etc..
Ogni gene codifica per più trascritti, che a loro volta possono dare origine a più proteine
>  la programmazione a oggetti si presta molto bene a rappresentare dati di tipo biologico
Programmazione a oggetti - esempio genes = { 'gene1' :  {  'position' : 10000, 'chromosome': 11,   'sequence' :  'GTAGCCTGATGAACGGGCTAGCATGC....' ,   'transcripts' :  { 'transcript1' : [......], 'transcript2' : [......], }, }, 'gene1' : {  'position' : ...........}, ..... } def  get_subseq(genes, geneid, start, end): ''' get a subsequence of a gene, given a dictionary of gene annotations, a gene id, and start/end position ''' pass

Weitere ähnliche Inhalte

Andere mochten auch

Py t3 python-oggetti
Py t3 python-oggettiPy t3 python-oggetti
Py t3 python-oggettiMajong DevJfu
 
Py a3 python-metaprogramming
Py a3 python-metaprogrammingPy a3 python-metaprogramming
Py a3 python-metaprogrammingMajong DevJfu
 
Py a2 python-documentazione
Py a2 python-documentazionePy a2 python-documentazione
Py a2 python-documentazioneMajong DevJfu
 
Py a6 python-database
Py a6 python-databasePy a6 python-database
Py a6 python-databaseMajong DevJfu
 
Py a1 python-unit_testing
Py a1 python-unit_testingPy a1 python-unit_testing
Py a1 python-unit_testingMajong DevJfu
 
Penetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferPenetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferSimone Onofri
 

Andere mochten auch (10)

Py t2 python-moduli
Py t2 python-moduliPy t2 python-moduli
Py t2 python-moduli
 
Py t3 python-oggetti
Py t3 python-oggettiPy t3 python-oggetti
Py t3 python-oggetti
 
Py a3 python-metaprogramming
Py a3 python-metaprogrammingPy a3 python-metaprogramming
Py a3 python-metaprogramming
 
Py a2 python-documentazione
Py a2 python-documentazionePy a2 python-documentazione
Py a2 python-documentazione
 
Py t1 python-intro
Py t1 python-introPy t1 python-intro
Py t1 python-intro
 
Py a5 python-text
Py a5 python-textPy a5 python-text
Py a5 python-text
 
Py a6 python-database
Py a6 python-databasePy a6 python-database
Py a6 python-database
 
Py a4 python-file
Py a4 python-filePy a4 python-file
Py a4 python-file
 
Py a1 python-unit_testing
Py a1 python-unit_testingPy a1 python-unit_testing
Py a1 python-unit_testing
 
Penetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferPenetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network Sniffer
 

Ähnlich wie Pycon

Pycrashcourse
PycrashcoursePycrashcourse
Pycrashcourserik0
 
Corso Python Django
Corso Python DjangoCorso Python Django
Corso Python Djangobarmassimo
 
What is new in C# 2018
What is new in C# 2018What is new in C# 2018
What is new in C# 2018Marco Parenzan
 
Python nel primo biennio della scuola superiore
Python nel primo biennio della scuola superiorePython nel primo biennio della scuola superiore
Python nel primo biennio della scuola superioreguestc11532
 
Javaday 2006: Java 5
Javaday 2006: Java 5Javaday 2006: Java 5
Javaday 2006: Java 5Matteo Baccan
 
Data hiding - metodologie e strumenti open source
Data hiding - metodologie e strumenti open sourceData hiding - metodologie e strumenti open source
Data hiding - metodologie e strumenti open sourceMarco Ferrigno
 
Pycrashcourse3.1
Pycrashcourse3.1Pycrashcourse3.1
Pycrashcourse3.1rik0
 
Netbeans e Xdebug per debugging e profiling di applicazioni PHP
Netbeans e Xdebug per debugging e profiling di applicazioni PHPNetbeans e Xdebug per debugging e profiling di applicazioni PHP
Netbeans e Xdebug per debugging e profiling di applicazioni PHPGiorgio Cefaro
 
Come sviluppo le applicazioni web
Come sviluppo le applicazioni webCome sviluppo le applicazioni web
Come sviluppo le applicazioni webAndrea Lazzarotto
 
Pycrashcourse3.0
Pycrashcourse3.0Pycrashcourse3.0
Pycrashcourse3.0rik0
 
Data Hiding
Data HidingData Hiding
Data HidingNaLUG
 
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...Boymix81
 
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...Cristian Randieri PhD
 

Ähnlich wie Pycon (20)

Pycrashcourse
PycrashcoursePycrashcourse
Pycrashcourse
 
Presentazione java7
Presentazione java7Presentazione java7
Presentazione java7
 
Corso Python Django
Corso Python DjangoCorso Python Django
Corso Python Django
 
What is new in C# 2018
What is new in C# 2018What is new in C# 2018
What is new in C# 2018
 
Pycon Jungle
Pycon JunglePycon Jungle
Pycon Jungle
 
Python nel primo biennio della scuola superiore
Python nel primo biennio della scuola superiorePython nel primo biennio della scuola superiore
Python nel primo biennio della scuola superiore
 
Javaday 2006: Java 5
Javaday 2006: Java 5Javaday 2006: Java 5
Javaday 2006: Java 5
 
Data hiding - metodologie e strumenti open source
Data hiding - metodologie e strumenti open sourceData hiding - metodologie e strumenti open source
Data hiding - metodologie e strumenti open source
 
Pycrashcourse3.1
Pycrashcourse3.1Pycrashcourse3.1
Pycrashcourse3.1
 
Netbeans e Xdebug per debugging e profiling di applicazioni PHP
Netbeans e Xdebug per debugging e profiling di applicazioni PHPNetbeans e Xdebug per debugging e profiling di applicazioni PHP
Netbeans e Xdebug per debugging e profiling di applicazioni PHP
 
Come sviluppo le applicazioni web
Come sviluppo le applicazioni webCome sviluppo le applicazioni web
Come sviluppo le applicazioni web
 
Pycrashcourse3.0
Pycrashcourse3.0Pycrashcourse3.0
Pycrashcourse3.0
 
Rest sdk
Rest sdkRest sdk
Rest sdk
 
Data Hiding
Data HidingData Hiding
Data Hiding
 
Lezione01
Lezione01Lezione01
Lezione01
 
Lezione01
Lezione01Lezione01
Lezione01
 
Vdcnn daniele meetup_27_june
Vdcnn daniele meetup_27_juneVdcnn daniele meetup_27_june
Vdcnn daniele meetup_27_june
 
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...
Presentazione della Tesi di Laurea Specialistica : STRUMENTI PER LA GENERAZIO...
 
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...
Lezioni di programmazione in c i file By Cristian Randieri - www.intellisyste...
 
What's new in C# 7
What's new in C# 7What's new in C# 7
What's new in C# 7
 

Mehr von Giovanni Marco Dall'Olio

Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...
Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...
Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...Giovanni Marco Dall'Olio
 
The true story behind the annotation of a pathway
The true story behind the annotation of a pathwayThe true story behind the annotation of a pathway
The true story behind the annotation of a pathwayGiovanni Marco Dall'Olio
 

Mehr von Giovanni Marco Dall'Olio (20)

Fehrman Nat Gen 2014 - Journal Club
Fehrman Nat Gen 2014 - Journal ClubFehrman Nat Gen 2014 - Journal Club
Fehrman Nat Gen 2014 - Journal Club
 
Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...
Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...
Thesis defence of Dall'Olio Giovanni Marco. Applications of network theory to...
 
Agile bioinf
Agile bioinfAgile bioinf
Agile bioinf
 
Version control
Version controlVersion control
Version control
 
Linux intro 5 extra: awk
Linux intro 5 extra: awkLinux intro 5 extra: awk
Linux intro 5 extra: awk
 
Linux intro 5 extra: makefiles
Linux intro 5 extra: makefilesLinux intro 5 extra: makefiles
Linux intro 5 extra: makefiles
 
Linux intro 4 awk + makefile
Linux intro 4  awk + makefileLinux intro 4  awk + makefile
Linux intro 4 awk + makefile
 
Linux intro 3 grep + Unix piping
Linux intro 3 grep + Unix pipingLinux intro 3 grep + Unix piping
Linux intro 3 grep + Unix piping
 
Linux intro 2 basic terminal
Linux intro 2   basic terminalLinux intro 2   basic terminal
Linux intro 2 basic terminal
 
Linux intro 1 definitions
Linux intro 1  definitionsLinux intro 1  definitions
Linux intro 1 definitions
 
Wagner chapter 5
Wagner chapter 5Wagner chapter 5
Wagner chapter 5
 
Wagner chapter 4
Wagner chapter 4Wagner chapter 4
Wagner chapter 4
 
Wagner chapter 3
Wagner chapter 3Wagner chapter 3
Wagner chapter 3
 
Wagner chapter 2
Wagner chapter 2Wagner chapter 2
Wagner chapter 2
 
Wagner chapter 1
Wagner chapter 1Wagner chapter 1
Wagner chapter 1
 
Hg for bioinformatics, second part
Hg for bioinformatics, second partHg for bioinformatics, second part
Hg for bioinformatics, second part
 
Hg version control bioinformaticians
Hg version control bioinformaticiansHg version control bioinformaticians
Hg version control bioinformaticians
 
The true story behind the annotation of a pathway
The true story behind the annotation of a pathwayThe true story behind the annotation of a pathway
The true story behind the annotation of a pathway
 
Plotting data with python and pylab
Plotting data with python and pylabPlotting data with python and pylab
Plotting data with python and pylab
 
Makefiles Bioinfo
Makefiles BioinfoMakefiles Bioinfo
Makefiles Bioinfo
 

Pycon

  • 1. Pycon.it 2009 Python e bioinformatica Giovanni Marco Dall'Olio Universitá Pompeu Fabra, Biologia Evolutiva, Barcelona
  • 2.
  • 3. Nata negli anni '70, con lo sviluppo di un metodo per confrontare due sequenze di proteine (Matrici PAM)
  • 4.
  • 5. Costi e tempi diminuiti rapidamente n. sequenze (GenBank) 2009 1996
  • 6.
  • 7.
  • 8. Non é molto utile finché non la integriamo con altri dati
  • 9. Che strumenti utilizzare per analizzarla?
  • 10. Che approcci, che tecniche?
  • 11.
  • 12.
  • 13. Docking molecolare : simulare l'efficacia di una molecola come farmaco
  • 14.
  • 15.
  • 16.
  • 17. Senza, sarebbe impossibile coordinare qualsiasi progetto di ricerca
  • 18. Alcuni portali (ncbi, uniprot, …) mettono a disposizione dati e tool pubblici
  • 19.
  • 20. -> in bioinformatica sono molto diffusi linguaggi di scripting (perl, python, R, ...)
  • 21.
  • 22.
  • 24. Ottimo per scripting
  • 25. Librerie per database, testing, documentazione, calcolo scientifico
  • 26. Orientato ad oggetti , ma multi-paradigma
  • 27. Python e bioinformatica Curva d'apprendimento ☺☺☺☺☺ Facile da imparare ma potente Leggibilitá ☺☺☺☺☺ Testing ☺☺☺☺☺ Doctest, unittest, nose Comunitá open source ☺☺☺ BioPerl e BioConductor sono piu' ampi Paradigmi di programmazione ☺☺☺☺☺ Multi paradigma, OO Velocitá di esecuzione  Interpretato; Database ☺☺☺☺☺ Ottimi ORM (sqlalchemy), supporto ad altri tipi di db
  • 28.
  • 29. Makefiles e simili per creare pipelines
  • 30. Tests utilizzati anche per comunicare con non-programmatori
  • 31. Continua necessitá di riadattare scripts
  • 32.
  • 33.
  • 34.
  • 35. Esempio più complicato di pipeline mask(S) flat: S.masked run: RepeatMasker -lib $(RMLIB) S mask_then_blast(S,D) flat: S-results/S.D.blast.raw req: mask(S) blastindex(D) srun: blastall -p blastx -i ....... BioMake ( http://skam.sourceforge.net/skam-intro.html )
  • 36.
  • 37. Come dimostrare che sia corretto?
  • 38.
  • 39. In bioinformatica é la stessa cosa, solo che molto si fa al computer
  • 40.
  • 41. Abbiamo scritto un programma per leggere il formato Fasta e convertirlo al formato GenBank, e testato il suo funzionamento corretto su un file con una sola sequenza, su un file con sequenze multiple, su un file corrotto.....
  • 42.
  • 43. Unittest -> unit test classico con fixtures
  • 44. Nosetest -> individua tutte le funzioni che assomigliano a tests e le esegue
  • 45. doctest >>> help (say_hello) Help on function say_hello in module __main__: say_hello(name) print hello <name> to the screen example: >>> say_hello('Albert Einstein') hello Albert Einstein!!!
  • 46.
  • 47. unittest From unittest import * class SimpleFastaSeqCase(unittest.TestCase): @classmethod def setUpClass(cls): ..... @classmethod def tearDownClass(cls): ..... def setUp(self): ..... def tearDown(self): ..... def testCondition1(self): ..... def testCondition2(self): ..... Istruzioni da eseguire prima/dopo tutti i test Istruzioni da eseguire prima/dopo ogni test Tests
  • 48.
  • 49. Su ogni cromosoma possiamo individuare diversi elementi, come geni, fattori di regolazione, etc..
  • 50. Ogni gene codifica per più trascritti, che a loro volta possono dare origine a più proteine
  • 51. > la programmazione a oggetti si presta molto bene a rappresentare dati di tipo biologico
  • 52. Programmazione a oggetti - esempio genes = { 'gene1' : { 'position' : 10000, 'chromosome': 11, 'sequence' : 'GTAGCCTGATGAACGGGCTAGCATGC....' , 'transcripts' : { 'transcript1' : [......], 'transcript2' : [......], }, }, 'gene1' : { 'position' : ...........}, ..... } def get_subseq(genes, geneid, start, end): ''' get a subsequence of a gene, given a dictionary of gene annotations, a gene id, and start/end position ''' pass
  • 53. Programmazione a oggetti - esempio genes = {'gene1': { 'position': 10000, 'chromosome': 11, 'sequence': 'GTAGCCTGATGAACGGGCTAGCATGC....', 'transcripts': { 'transcript1': [......], 'transcript2': [......], }, }, 'gene1': { 'position': ...........}, ..... } def get_subseq(genes, geneid, start, end): ''' get a subsequence of a gene, given a dictionary of gene annotations, a gene id, and start/end position ''' pass
  • 54.
  • 55. Più concisa di Java, inoltre non é obbligatorio usare OO
  • 56. OO é piuttosto complicato in perl
  • 57. Python and Java classes public class Gene { public int position; public str chromosome; public str transcripts[]; public Gene(int pos){ position = pos } public void getSubseq(int start, int end) { pass } class gene: def __init__(self,pos): self.position = pos self.sequence = '' self.transcripts = [] def get_subseq(self, start, end): pass (Una classe in python) (Una classe in Java) (non sono un programmatore Java!)
  • 58.
  • 59. diffusione di vari formati di testo
  • 60. disputa tra flat files, database, e altri sistemi
  • 61.
  • 63.
  • 65. Merging di insiemi di dati?
  • 66.
  • 67. Problema comune in bioinformatica http://phenomics.cs.ucla.edu/
  • 68.
  • 70.
  • 73. ...
  • 74.
  • 75. Database gerarchico (tabelle dentro altre tabelle)
  • 76. Ottime APIs in python (PyTables) SNP object - id - position - chromosome - genotypes individual genotype - allele1 - allele2 - stats population iHS Fst Nested tables
  • 77.
  • 78.
  • 79.
  • 80. APIs per entrez e alcuni database importanti
  • 82. Biopython Esempi # Leggere un file in formato fasta e salvarlo in un dizionario from Bio.SeqIO import SeqIO seqfile = open('fastafile.fa', 'r') sequences = SeqIO.to_dict(SeqIO.parse(seqfile)) # Query NCBI results = Entrez.esearch(db='nucleotide', term='cox2') Entrez.read(results)
  • 83.
  • 84.
  • 85. Usare e configurare blast locali
  • 87. Interfaccia con ncbi, ensembl, ucsc
  • 88. Pygr esempi # Ensembl APIs serverRegistry = get_registry( host= 'ensembldb.ensembl.org', user='anonymous') coreDBAdaptor = serverRegistry.get_DBAdaptor( 'homo_sapiens', 'core', '47_36i') sequence = coreDBAdaptor.fetch_slice_by_seqregion( coordSystemName, seqregionName) # Scarica la seq del genoma umano da ucsc(18) import pygr.Data hg18 = pygr.Data.Bio.Seq.Genome.HUMAN.hg18( download=True)
  • 89.
  • 90. Scipy : calcolo matematico avanzato, test statistici..
  • 92.
  • 94.
  • 95.
  • 96. In alcuni campi, mancano ancora buone librerie
  • 98.
  • 100.
  • 103. nodalpoint.org and all bioinfo bloggers
  • 105.
  • 106. Come trarre ordine da una massa di dati come questa?
  • 107. Come associare un gene ad una posizione, sequenza?
  • 108. Che strumenti? Che tecniche?
  • 110.
  • 111.
  • 112.
  • 113. ....
  • 114. ....
  • 115.
  • 117.