Skip to content
Permalink
Browse files

fasta server side

  • Loading branch information
yuj12001 committed Sep 17, 2015
1 parent eae14a2 commit 0f81a939b995a8e1e7ac1b0d9fc4f2de55ee4afe
Showing with 45 additions and 2 deletions.
  1. +2 −2 VQI_GenomeBrowser.js
  2. +43 −0 dynamic_loading.php
@@ -1715,10 +1715,10 @@ function VQI_GenomeBrowser(id, serviceURL) {


fileInput.addEventListener('change', function (e) { fileInput.addEventListener('change', function (e) {
var file = fileInput.files[0]; var file = fileInput.files[0];
if (file.name == "hg19.fa.txt") { if (file.name == "mm9.fa.txt") {
faFile = file; faFile = file;
} }
if (file.name == "hg19.fa.fai.txt") { if (file.name == "mm9.fa.fai.txt") {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e) { reader.onload = function (e) {
data = reader.result; data = reader.result;
@@ -58,6 +58,49 @@
loadTable(); loadTable();
} }
function loadFastaData($chrom, $start, $length, $file, $indexFile){
$indexFile = fopen($indexFile, "r");
$indexArray = [];
while (($line = fgets($indexFile))) {
if($line !== ""){
$lineArray = explode("\t", $line);
array_push($indexArray,$lineArray);
}
}
fclose($indexFile);
foreach ($indexArray as $key => $value) {
if ($value[0] == $chrom){
$chromStart = $value[2];
$chromLength = $value[1];
$lineLength = $value[3];
}
}
$lineNum = floor($start/$lineLength); //the line number of the starting bit
$startBit = $chromStart + $lineNum + $start; //starting bit position
$file = new SplFileObject($file);
$file->fseek($startBit);
$resultLine1 = $file->current();
$file->next();
$nextLine2 = $file->current();
$file->next();
$nextLine3 = $file->current();
$composeLine = $resultLine1 . $nextLine2 . $nextLine3;
$returnString = str_replace("\n", "", $composeLine);
return substr($returnString,0,$length);
}
function processData($serviceUrl,$processFileHandle){ function processData($serviceUrl,$processFileHandle){

0 comments on commit 0f81a93

Please sign in to comment.
You can’t perform that action at this time.