49
生生生生生生生生生生 生生生生生生生生生生 Part 7 Part 7 Database Management by PHP Database Management by PHP

生物資訊程式語言應用 Part 7

  • Upload
    zagiri

  • View
    85

  • Download
    4

Embed Size (px)

DESCRIPTION

生物資訊程式語言應用 Part 7. Database Management by PHP. Database Management and data presentation. Database : MySql Tools : phpmyadmin Step 1 : Creating a database and tables in MySql To create a database To create a table and to define attributes Insert data (By program- Perl or manual) - PowerPoint PPT Presentation

Citation preview

Page 1: 生物資訊程式語言應用 Part 7

生物資訊程式語言應用生物資訊程式語言應用Part 7Part 7

Database Management by PHPDatabase Management by PHP

Page 2: 生物資訊程式語言應用 Part 7

22

Database Management and data presentation

Database : MySql

Tools : phpmyadmin

Step 1 : Creating a database and tables in MySqlTo create a database

To create a table and to define attributes

Insert data (By program-Perl or manual)

Step 2 : Develop a website for this databaseSelection / insertion / deletion / updating

According to user requirements.

Page 3: 生物資訊程式語言應用 Part 7

33

Flow Chart

PubmedCrawl Pubmed

literatures/sequences by query keyword

Insertion Deletion

Updating

Database mmanagement and data presentation

User query Html

User query

Mark query term

Html

Selection

Perl

PHP

MySql

Page 4: 生物資訊程式語言應用 Part 7

44

Management and presentation for PubMed data

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

Insertion Deletion

Updating

Database mmanagement and data presentation

User query

Html

Selection

ManagementSelection

Insertion

Deletion

Updating

Link

FilesIndex.php

abstract.php

abstractDel.php

abstractUpd.php

abstractUpdInt.php

abstractIns.php

abstractNew.php

Page 5: 生物資訊程式語言應用 Part 7

55

Management and presentation for PubMed dataManagement

SelectionInsertion

Deletion

Updating

Link

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

Files

Index.php

abstract.phpabstractDel.php

abstractUpd.php

abstractUpdInt.php

abstractIns.php

abstractNew.php

Page 6: 生物資訊程式語言應用 Part 7

66

The query frame (index.php)

SQL:SHOW COLUMNS FROM article FROM summer;

Selection

output

Input

Page 7: 生物資訊程式語言應用 Part 7

77

The query frame (index.php)

Send two massages (choice, text_query) to article.php

Example : To select abstract and key in “interaction”.

Setup for DB link

SQL

Obtain records

Selection

output

Input

Page 8: 生物資訊程式語言應用 Part 7

88

Selection (article.php)Select abstract and key in “interaction”.

SELECT * FROM article where abstract like '%interaction%'

Selection

output

Input

Page 9: 生物資訊程式語言應用 Part 7

99

Selection (article.php) (con.)

Page 10: 生物資訊程式語言應用 Part 7

1010

Setup for DB link

SQL

Obtain records

Insertion Deletion

Updating

Database mmanagement and data presentation

User query

Html

Selection

Page 11: 生物資訊程式語言應用 Part 7

1111

Exercisearticle.php

article_html.php

article_php.php

index.phpindex_html.php

index_php.php

To build article.php and index.php by *_php.php and *_html.php

Page 12: 生物資訊程式語言應用 Part 7

II KK MM

Manage database by Phpmyadmin.

How do we manage the database by phpmyadmin?

How do we manage the database by PHP?

Page 13: 生物資訊程式語言應用 Part 7

1313

Page 14: 生物資訊程式語言應用 Part 7

1414

Page 15: 生物資訊程式語言應用 Part 7

1515

Updating Deletiion

Insertion

Page 16: 生物資訊程式語言應用 Part 7

1616

Insertion

Page 17: 生物資訊程式語言應用 Part 7

1717

Insertion (con.)

Page 18: 生物資訊程式語言應用 Part 7

1818

Updating

Page 19: 生物資訊程式語言應用 Part 7

1919

Deletion

Page 20: 生物資訊程式語言應用 Part 7

2020

ExerciseUse phpmyadmin to insert a record to article table, and write down their executing SQL.

Use phpmyadmin to update a record to article table, and write down their executing SQL.

Use phpmyadmin to delete a record to article table, and write down their executing SQL.

Page 21: 生物資訊程式語言應用 Part 7

2121

Build a new frame for insertion, deletion and updating. (article.php)

Page 22: 生物資訊程式語言應用 Part 7

2222

ExerciseInclude insertion, updating, deletion buttons in article.php

You may apply article_IDUtag.php to finish you practice.

Page 23: 生物資訊程式語言應用 Part 7

2323

Management and presentation for PubMed dataManagement

Selection

InsertionDeletion

Updating

Link

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

FilesIndex.php

abstract.phpabstractDel.php

abstractUpd.php

abstractUpdInt.php

abstractIns.php

abstractNew.php

Page 24: 生物資訊程式語言應用 Part 7

2424

Insertion-Abstract Insert frame (article_new.php)

Send two massages (pmid, year, title, abstract)

to articleIns.php

Abstract Insert frame

Insert into mysql

Insertion SQL

Input

Page 25: 生物資訊程式語言應用 Part 7

2525

ExercisearticleNew.php

<FORM action="" name="" method="post">

What is the target file you want to send these massages?

Page 26: 生物資訊程式語言應用 Part 7

2626

Insertion - Insert into MySql (articleIns.php)

Abstract Insert frame

Insert into mysql

Insertion SQL

Input

Setup for DB link

SQLGet massages

Page 27: 生物資訊程式語言應用 Part 7

2727

ExercisePlease to finish insertion step by modifying articleIns.php.

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

Page 28: 生物資訊程式語言應用 Part 7

2828

Management and presentation for PubMed dataManagement

Selection

Insertion

Deletion

UpdatingLink

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

FilesIndex.php

abstract.phpabstractDel.php

abstractUpd.php

abstractUpdInt.phpabstractIns.php

abstractNew.php

Page 29: 生物資訊程式語言應用 Part 7

2929

Updating (article.php)

Selection frame

Update the record

Selection SQL

Selected Information

Updating SQL

Page 30: 生物資訊程式語言應用 Part 7

3030

Updating (articleUpd.php)

Selection frame

Update the record

Selection SQL

Selected Information

Updating SQL

Page 31: 生物資訊程式語言應用 Part 7

3131

ExercisearticleUpd.php

articleUpd_php.php

articleUpd_php.php

To build articleUpd.php and by articleUpd_php.php and articleUpd_php.php

Page 32: 生物資訊程式語言應用 Part 7

3232

Updating (con.) (articleUpdInt.php)

Selection frame

Update the record

Selection SQL

Selected Information

Updating SQL

Setup for DB link

SQL

Page 33: 生物資訊程式語言應用 Part 7

3333

ExercisePlease to finish Updating step by modifying articleUpdIns.php.

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

Page 34: 生物資訊程式語言應用 Part 7

3434

Management and presentation for PubMed dataManagement

Selection

Insertion

DeletionUpdating

Link

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

FilesIndex.php

abstract.php

abstractDel.phpabstractUpd.php

abstractUpdInt.php

abstractIns.php

abstractNew.php

Page 35: 生物資訊程式語言應用 Part 7

3535

Deletion (article.php)

Selection frame

Delete the record

Deletion SQL

Page 36: 生物資訊程式語言應用 Part 7

3636

Deletion (con.) (articleDel.php)

Setup for DB link

SQL

Selection frame

Delete the record

Deletion SQL

Page 37: 生物資訊程式語言應用 Part 7

3737

ExercisePlease to finish Deletion step by modifying articleDel.php.

abstract.php

abstractNew.php abstractIns.php

abstractUpd.php abstractUpdIns.php

abstractDel.php

index.php

Page 38: 生物資訊程式語言應用 Part 7

Extract sequences from the NCBIBy user query

http://www.ncbi.nlm.nih.gov/

By FTPftp.ncbi.nlm.nih.gov/refseq/H_sapiens/H_sapiens/protein/protein.fa.gz

ftp.ncbi.nlm.nih.gov/refseq/H_sapiens/H_sapiens/RNA/rna.fa.gz

3838

Page 39: 生物資訊程式語言應用 Part 7

Insert the sequences to databaseTo construct the table for the sequences.

To use the program to insert the sequences in the table.

Perl code (practice)

3939

Page 40: 生物資訊程式語言應用 Part 7

4040

ExerciseUse phpmyadmin to select , insert , update, delete a record to sequence table, and write down their executing SQL.

Modified the article%.php for the sequences table.

Page 41: 生物資訊程式語言應用 Part 7

4141

Combine article.php and articleNew.php article.php?option=add

Page 42: 生物資訊程式語言應用 Part 7

分頁

4242

Page 43: 生物資訊程式語言應用 Part 7

分頁

4343

Page 44: 生物資訊程式語言應用 Part 7

To calculate particular information for sequences

Frequency語法 : string substr (string string, int start [, int length])

說明 : substr( ) 傳回 string 的一部份字串,由參數 start 和 length 指定。如果 start 是正數,傳回的字串將會從 string 的第 start 個字元開始。Example :

<?php

    $rest = substr ("abcdef", 1);       // returns "bcdef" 

    $rest = substr ("abcdef", 1, 3);   // returns "bcd"

?>

如果 start 是負數,傳回的字串將會從 string 結尾的第 start 個字開始。

4444

Page 45: 生物資訊程式語言應用 Part 7

To calculate particular information for sequences

CG%

Length語法 : int strlen (string str)

說明 : 傳回字串 str 的長度。

Example :

<?php

$DNA_length=strlen($a);

?>

4545

Page 46: 生物資訊程式語言應用 Part 7

Translate the nucleotide to amino acid$codons = substr ($sequence, $first, $first+2);

4646

Page 47: 生物資訊程式語言應用 Part 7

Submit a sequence to blast by the interfacehttp://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastn&BLAST_PROGRAMS=megaBlast&PAGE_TYPE=BlastSearch&SHOW_DEFAULTS=on&LINK_LOC=blasthome

4747

Page 48: 生物資訊程式語言應用 Part 7

Hyperlink for the sequence idhttp://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&term=

Example:

http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&term=gi|194473734|ref|NM_181054.2| Homo sapiens hypoxia inducible factor 1, alpha subunit (basic helix-loop-helix transcription factor) (HIF1A), transcript variant 2, mRNA

4848

Page 49: 生物資訊程式語言應用 Part 7

4949

ResourcesMySql http://dev.MySql.com/

Perl http://www.perl.com/

phpmyadmin http://sourceforge.net/projects/phpmyadmin/

php http://www.php.net/