Ejemplo n.º 1
0
<?php

include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$ds1 = filteralpha(getdef($query, 'dataset1', ''));
$ds2 = filteralpha(getdef($query, 'dataset2', ''));
if ($ds1 == "" && $ds2 == "") {
    $ps = pg_prepare($db, 'getgene', "SELECT DISTINCT * FROM godm NATURAL JOIN goinfo");
    $rs = pg_execute($db, 'getgene', array());
} else {
    $ps = pg_prepare($db, 'getgene', "SELECT DISTINCT * FROM godm NATURAL JOIN goinfo WHERE dataset1=\$1 AND dataset2=\$2 ORDER BY pvalue");
    $rs = pg_execute($db, 'getgene', array($ds1, $ds2));
}
echo '"dataset1","dataset2","goid","goname","pvalue","tscore"' . "\n";
while ($line = pg_fetch_array($rs, null, PGSQL_ASSOC)) {
    echo '"' . $line["dataset1"] . '","' . $line["dataset2"] . '","' . $line["goid"] . '","' . $line["goname"] . '","' . $line["pvalue"] . '","' . $line["tscore"] . "\"\n";
}
pg_free_result($rs);
### Return result
#header('Content-Type: application/json; ');
#header('filename="godm.json"; ');
include "end.php";
Ejemplo n.º 2
0
/**
 * Download Files
 *
 * Forces the download of file types
 * Allows downloads of any file in uploads and backups/zip
 *
 * @package GetSimple
 * @subpackage Download
 */
// Setup inclusions
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
login_cookie_check();
// disable this entirely if not enabled
if (getdef('GSALLOWDOWNLOADS', true) === false) {
    die(i18n('NOT_ALLOWED'));
}
# check if all variables are set
if (isset($_GET['file'])) {
    $file = removerelativepath($_GET['file']);
    // check that this file is safe to access
    $archivesafe = filepath_is_safe($file, GSBACKUPSPATH . DIRECTORY_SEPARATOR . 'zip');
    // check for archives
    if ($archivesafe) {
        check_for_csrf("archive", "download.php");
    }
    // check archive nonce
    $filesafe = filepath_is_safe($file, GSDATAUPLOADPATH);
    // check for uploads
    if (!($filesafe || $archivesafe)) {
Ejemplo n.º 3
0
<?php

include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$ds1 = filteralpha(getdef($query, 'dataset', ''));
if ($ds1 == "") {
    $ps = pg_prepare($db, 'getgene', "SELECT DISTINCT * FROM genedm");
    $rs = pg_execute($db, 'getgene', array());
} else {
    $ps = pg_prepare($db, 'getgene', "SELECT DISTINCT * FROM genedm WHERE dataset=\$1");
    $rs = pg_execute($db, 'getgene', array($ds1));
}
echo '"dataset","geneid","genedm"' . "\n";
while ($line = pg_fetch_array($rs, null, PGSQL_ASSOC)) {
    echo '"' . $line["dataset"] . '","' . $line["geneid"] . '","' . $line["genedm"] . "\"\n";
}
pg_free_result($rs);
### Return result
#header('Content-Type: application/json; ');
#header('filename="godm.json"; ');
include "end.php";
Ejemplo n.º 4
0
<?php

include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$geneid = getdef($query, 'geneset', array("ENSMUSG00000000126", "ENSMUSG00000000028"));
$datasets = getdef($query, 'datasets', array("ola_a2i"));
$graphw = filteralpha(getdef($query, 'graphw', 500));
$cmd = "echo 'genes <- c();";
foreach ($geneid as $s) {
    $cmd = $cmd . "genes <- c(genes,\"" . filteralpha($s) . "\");";
}
$cmd = $cmd . "datasets <- c();";
foreach ($datasets as $s) {
    $cmd = $cmd . "datasets <- c(datasets,\"" . filteralpha($s) . "\");";
}
$cmd = $cmd . "graphw<-" . $graphw . ";";
$cmd = $cmd . "source(\"corrgenecell.R\")' | /usr/bin/R --vanilla --slave";
$handle = popen($cmd, "r");
$ret = "";
do {
    $data = fread($handle, 8192);
    if (strlen($data) == 0) {
        break;
    }
    $ret .= $data;
} while (true);
pclose($handle);
header("Cache-Control: no-cache, must-revalidate");
if (strlen($ret) < 100) {
    #for any errors?
    echo "error running " . $cmd;
Ejemplo n.º 5
0
?>
';
		var maxFileSize   = '<?php 
echo toBytesShorthand(getMaxUploadSize(), 'M');
?>
';
		
		<?php 
if (isset($_COOKIE['gs_editor_theme'])) {
    // $editor_theme = var_out($_COOKIE['gs_editor_theme']);
    $editor_theme = var_out($_COOKIE['gs_editor_theme']);
    echo "// codemirror editortheme\n";
    echo '		var editorTheme = "' . $editor_theme . "\";\n";
}
if (getDef('GSAUTOSAVE', true)) {
    $autosaveintvl = getdef('GSAUTOSAVEINTERVAL');
    echo "\t\t// edit autosave\n";
    echo '		var GSAUTOSAVEPERIOD = ' . (!is_int($autosaveintvl) ? 10 : $autosaveintvl) . ";\n";
} else {
    echo "      var GSAUTOSAVEPERIOD = false;\n";
}
?>

        // ckeditor config obj shim for config
        if(typeof CKEDITOR == 'undefined'){
			CKEDITOR           = {};
			CKEDITOR.SHIM      = true;
			CKEDITOR.ENTER_P   = 1;
			CKEDITOR.ENTER_BR  = 2;
			CKEDITOR.ENTER_DIV = 3;
        }
Ejemplo n.º 6
0
<?php

include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$geneid = getdef($query, 'geneset', array("ENSMUSG00000000126", "ENSMUSG00000000028"));
$graphw = filteralpha(getdef($query, 'graphw', 500));
$dataset = filteralpha(getdef($query, 'dataset', 'es_lif'));
$cmd = "echo 'genes <- c();";
foreach ($geneid as $s) {
    $cmd = $cmd . "genes <- c(genes,\"" . filteralpha($s) . "\");";
}
$cmd = $cmd . "graphw<-" . $graphw . ";";
$cmd = $cmd . "dataset<-\"" . $dataset . "\";";
$cmd = $cmd . "source(\"corrgenegene.R\")' | /usr/bin/R --vanilla --slave";
#echo $cmd;
$handle = popen($cmd, "r");
$ret = "";
do {
    $data = fread($handle, 8192);
    if (strlen($data) == 0) {
        break;
    }
    $ret .= $data;
} while (true);
pclose($handle);
header("Cache-Control: no-cache, must-revalidate");
if (strlen($ret) == 0) {
    echo "error running " . $cmd;
} else {
    header("Content-type:image/png");
    echo $ret;
Ejemplo n.º 7
0
<?php

include "common.php";
### Query database
#$q = getdef($_GET,'q','');
#$gene = $q['gene'];
$gene = getdef($_GET, 'gene', '');
#echo $gene;
if ($gene != '') {
    #	$ps=pg_prepare($db, 'getgene','SELECT * FROM geneinfo WHERE to_tsvector(genesym || \' \' || geneid) @@ to_tsquery($1) LIMIT 15');
    $ps = pg_prepare($db, 'getgene', 'SELECT * FROM (SELECT *, similarity(genesym,$1) as sim FROM geneinfo WHERE similarity(genesym,$1)>0.3 OR $1=geneid) as foo ORDER BY sim DESC LIMIT 20');
    $rs = pg_execute($db, 'getgene', array($gene));
} else {
    $ps = pg_prepare($db, 'getgene', 'SELECT *, -1 as sim FROM geneinfo LIMIT 10');
    $rs = pg_execute($db, 'getgene', array());
}
### Fetch result, make JSON
$results = array();
while ($line = pg_fetch_array($rs, null, PGSQL_ASSOC)) {
    $results[] = array('geneid' => $line['geneid'], 'genesym' => $line['genesym'], 'sim' => $line['sim']);
}
pg_free_result($rs);
### Return result
header('filename="data.json"; ');
header('Content-Type: application/json; ');
echo json_encode($results);
include "end.php";
Ejemplo n.º 8
0
<?php

include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$geneid = getdef($query, 'geneset', array("ENSMUSG00000000126", "ENSMUSG00000000028"));
$cmd = "echo 'genes <- c();";
foreach ($geneid as $s) {
    $cmd = $cmd . "genes <- c(genes,\"" . filteralpha($s) . "\");";
}
$cmd = $cmd . "source(\"geneset.R\")' | /usr/bin/R --vanilla --slave";
$handle = popen($cmd, "r");
$ret = "";
do {
    $data = fread($handle, 8192);
    if (strlen($data) == 0) {
        break;
    }
    $ret .= $data;
} while (true);
pclose($handle);
header("Cache-Control: no-cache, must-revalidate");
if (strlen($ret) == 0) {
    echo "error running " . $cmd;
} else {
    header('Content-Type: application/json; ');
    echo $ret;
}
Ejemplo n.º 9
0
							  </tr>';
        $count++;
    }
}
?>
			</tbody>
			</table>
			<p><em><b><span id="pg_counter"><?php 
echo $count;
?>
</span></b> <?php 
i18n('TOTAL_ARCHIVES');
?>
</em></p>
			<?php 
if (!getdef('GSALLOWDOWNLOADS', true)) {
    echo '<p><em class="hint">' . i18n_r('ARCHIVE_DL_DISABLED') . '</em></p>';
}
?>
		</div>
	</div>
	
	<div id="sidebar" >
		<?php 
include 'template/sidebar-backups.php';
?>
	</div>

</div>
<?php 
get_template('footer');
Ejemplo n.º 10
0
<?php

ini_set('memory_limit', '512M');
## http://localhost/geneinfo.php?q={%22gene%22:%22ENSMUSG00000000049%22}
include "common.php";
$query = json_decode(getdef($_GET, 'q', '{}'), TRUE);
$geneid = filteralpha(getdef($query, 'gene', ''));
### Query database for expression counts, for all datasets
$time_getgene = microtime();
$ps = pg_prepare($db, 'getgene', 'SELECT * FROM geneexp WHERE fromgene=$1');
$rs = pg_execute($db, 'getgene', array($geneid));
$resultsexp = array();
while ($line = pg_fetch_array($rs, null, PGSQL_ASSOC)) {
    $resultsexp[$line['dataset']] = array('fromcell' => splitcomma($line['fromcell']), 'exp' => splitcomma($line['exp']));
}
pg_free_result($rs);
$time_getgene = microtime() - $time_getgene;
$results = array();
$results['dataset'] = $resultsexp;
$results['geneid'] = $geneid;
### Query database for gene info --- this particular gene
$time_getgenei = microtime();
$ps = pg_prepare($db, 'getgenei', 'SELECT * FROM geneinfo WHERE geneid=$1 LIMIT 1');
$rs = pg_execute($db, 'getgenei', array($geneid));
while ($line = pg_fetch_array($rs, null, PGSQL_ASSOC)) {
    $results['genesym'] = $line['genesym'];
}
pg_free_result($rs);
$time_getgenei = microtime() - $time_getgenei;
### Query database for DM
$time_getgenedm = microtime();