Last active
August 29, 2015 14:00
-
-
Save esycat/11204717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //exit; | |
ini_set('display_errors', true); | |
require_once('config.php'); | |
require_once($folders['lib_prefix'].'/common.php'); | |
echo 'I am relatively healthy.', '<br />'; | |
$filename = './t_second_rna_a14.log'; | |
try { | |
$sql = 'INSERT IGNORE INTO proteins (title, AA, alpha, beta) VALUES (?, ?, ?, ?)'; | |
$stmt = $dbh->prepare($sql); | |
$file = file($filename); | |
echo $filename; | |
foreach ($file as $line) { | |
$data = preg_split('/\s+/', trim($line)); | |
$stmt->execute($data); | |
} | |
} | |
catch (Exception $e) { | |
echo $e->getMessage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $allFilesPath = '/WOK2/sokolova/allfiles'; | |
$fileExt = 'int'; | |
$fileSuffix = '00.' . $fileExt; | |
$inputFileName = 'rf_chi.log'; | |
$dsn = 'mysql:dbname=dara;host=devroom'; | |
$dbh = new PDO($dsn, 'dara', 'dara'); | |
$name_rft = array(); | |
$names = array(); | |
$rf_chi_array = file($inputFileName, FILE_IGNORE_NEW_LINES ^ FILE_SKIP_EMPTY_LINES); | |
$rf_chi_count = count($rf_chi_array); | |
for ($i = 0; $i < $rf_chi_count; $i++) { | |
$record = trim($rf_chi_array[$i]); | |
$name_rft[$i] = preg_split('/\s+/', $record); | |
} | |
foreach ($name_rft as $rft) { | |
$name = basename($rft[0], $fileSuffix); | |
$names[] = $dbh->quote($name); | |
} | |
$sql = 'SELECT title, alpha, beta FROM proteins WHERE title IN (' . implode(',', $names) . ')'; | |
$data = $dbh->query($sql)->fetchAll(); | |
var_dump($sql, $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //exit; | |
ini_set('display_errors', true); | |
require_once('config.php'); | |
require_once($folders['lib_prefix'].'/common.php'); | |
echo 'I am relatively healthy.', '<br />'; | |
$filename = 'title-mw-rg.dat'; | |
echo $filename; | |
try { | |
$sql = 'UPDATE proteins SET mw = ?, rg = ? WHERE title = ?'; | |
// $sql = 'UPDATE proteins SET mw = :mw, rg = :rg WHERE title = :title'; | |
$stmt = $dbh->prepare($sql); | |
$file = file($filename); | |
foreach ($file as $line) { | |
list($title, $mw, $rg) = preg_split('/\s+/', trim($line)); | |
$data = array($mw, $rg, $title); | |
/* | |
$data = array( | |
':title' => $title, | |
':mw' => $mw, | |
':rg' => $rg | |
); | |
*/ | |
$stmt->execute($data); | |
} | |
} | |
catch (Exception $e) { | |
echo $e->getMessage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS proteins; | |
CREATE TABLE proteins ( | |
title CHAR(4) NOT NULL, | |
AA SMALLINT(5) UNSIGNED NOT NULL, | |
alpha DECIMAL(5,2) NOT NULL, | |
beta DECIMAL(5,2) NOT NULL, | |
PRIMARY KEY (title) | |
); | |
ALTER TABLE proteins | |
ADD COLUMN mw DOUBLE UNSIGNED, | |
ADD COLUMN rg DECIMAL(5,2) UNSIGNED, | |
ADD KEY (mw), | |
ADD KEY (rg) | |
; | |
INSERT INTO proteins (title, alpha, beta) VALUES | |
('1o91', 1, 1), | |
('3ihu', 1, 2), | |
('4ec6', 1, 3) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1o9100.int Rf 2.415 Chi 1.110 | |
3ihu00.int Rf 2.239 Chi 1.185 | |
2oit00.int Rf 2.361 Chi 1.159 | |
4ec600.int Rf 2.314 Chi 1.260 | |
9icl00.int Rf 2.156 Chi 1.207 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1b2m 0.2391E+05 18.71 | |
1b7f 0.4528E+05 30.08 | |
1c0a 0.9125E+05 31.28 | |
1c9s 0.1906E+06 34.70 | |
1cvj 0.1587E+06 36.24 | |
1cx0 0.3464E+05 27.27 | |
1ddl 0.6179E+05 29.73 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment