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
生物資訊程式語言應用生物資訊程式語言應用Part 7Part 7
Database Management by PHPDatabase Management by PHP
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.
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
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
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
66
The query frame (index.php)
SQL:SHOW COLUMNS FROM article FROM summer;
Selection
output
Input
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
88
Selection (article.php)Select abstract and key in “interaction”.
SELECT * FROM article where abstract like '%interaction%'
Selection
output
Input
99
Selection (article.php) (con.)
1010
Setup for DB link
SQL
Obtain records
Insertion Deletion
Updating
Database mmanagement and data presentation
User query
Html
Selection
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
II KK MM
Manage database by Phpmyadmin.
How do we manage the database by phpmyadmin?
How do we manage the database by PHP?
1313
1414
1515
Updating Deletiion
Insertion
1616
Insertion
1717
Insertion (con.)
1818
Updating
1919
Deletion
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.
2121
Build a new frame for insertion, deletion and updating. (article.php)
2222
ExerciseInclude insertion, updating, deletion buttons in article.php
You may apply article_IDUtag.php to finish you practice.
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
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
2525
ExercisearticleNew.php
<FORM action="" name="" method="post">
What is the target file you want to send these massages?
2626
Insertion - Insert into MySql (articleIns.php)
Abstract Insert frame
Insert into mysql
Insertion SQL
Input
Setup for DB link
SQLGet massages
2727
ExercisePlease to finish insertion step by modifying articleIns.php.
abstract.php
abstractNew.php abstractIns.php
abstractUpd.php abstractUpdIns.php
abstractDel.php
index.php
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
2929
Updating (article.php)
Selection frame
Update the record
Selection SQL
Selected Information
Updating SQL
3030
Updating (articleUpd.php)
Selection frame
Update the record
Selection SQL
Selected Information
Updating SQL
3131
ExercisearticleUpd.php
articleUpd_php.php
articleUpd_php.php
To build articleUpd.php and by articleUpd_php.php and articleUpd_php.php
3232
Updating (con.) (articleUpdInt.php)
Selection frame
Update the record
Selection SQL
Selected Information
Updating SQL
Setup for DB link
SQL
3333
ExercisePlease to finish Updating step by modifying articleUpdIns.php.
abstract.php
abstractNew.php abstractIns.php
abstractUpd.php abstractUpdIns.php
abstractDel.php
index.php
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
3535
Deletion (article.php)
Selection frame
Delete the record
Deletion SQL
3636
Deletion (con.) (articleDel.php)
Setup for DB link
SQL
Selection frame
Delete the record
Deletion SQL
3737
ExercisePlease to finish Deletion step by modifying articleDel.php.
abstract.php
abstractNew.php abstractIns.php
abstractUpd.php abstractUpdIns.php
abstractDel.php
index.php
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
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
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.
4141
Combine article.php and articleNew.php article.php?option=add
分頁
4242
分頁
4343
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
To calculate particular information for sequences
CG%
Length語法 : int strlen (string str)
說明 : 傳回字串 str 的長度。
Example :
<?php
$DNA_length=strlen($a);
?>
4545
Translate the nucleotide to amino acid$codons = substr ($sequence, $first, $first+2);
4646
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
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
4949
ResourcesMySql http://dev.MySql.com/
Perl http://www.perl.com/
phpmyadmin http://sourceforge.net/projects/phpmyadmin/
php http://www.php.net/