$sSequence = $sSequenceSpliced; $nCDSstartNC -= $lCut; $nCDSendNC -= $lCut; } $aNMCache[$sNCFileID . ':' . $sRefSeqID] = array($nCDSstartNC, $nCDSendNC, $sSequence); } list($nCDSstart, $nCDSend, $sSequence) = $aNMCache[$sNCFileID . ':' . $sRefSeqID]; // Get Motif or upstream sequence. if ($sType == 'peak_classification') { // Fetch motif. $aTIS['Motif'] = substr($sSequence, 0, 3); } else { // For 5'UTR (all we see here), get the whole upstream sequence. $aTIS['DNASeqToAUG'] = substr($sSequence, 0, -3); // Now, get it translated. $sProteinSequence = RPF_translateDNA($aTIS['DNASeqToAUG']); $aTIS['ProtSeqToAUG'] = $sProteinSequence; } } } fputs($aSample['file_out'][$sType]['handle'], implode("\t", $aTIS) . "\n"); // Only for 5'UTR classification, we show all. Otherwise, just the first will do. if ($sType != 'peak_classification_5UTR') { break; } } if (!($nLine % 50)) { $nPercentageRead = round($nLine / $aSample['peak_count'], 2); $nAvailableWidth = $_SETT['terminal_width'] - 8 - strlen($nLine); $lDone = round($nPercentageRead * $nAvailableWidth); print str_repeat(chr(8), $_SETT['terminal_width']) . '[' . str_repeat('=', $lDone) . str_repeat(' ', $nAvailableWidth - $lDone) . '] ' . $nLine . ' ' . str_pad(round($nPercentageRead * 100), 3, ' ', STR_PAD_LEFT) . '%';
// 0-based position. if ($nPositionInString < 0) { // We don't have the start of the sequence. $bTranslatable = false; if ($nCDSstart == 1) { $sSequenceProtein = 'no_5UTR'; } else { // No upstream sequence, or not enough upstream sequence available. $sSequenceProtein = 'unannotated_5UTR'; } } } $sSequenceToTranslate = $sSequenceToTranslateToStop = ''; if ($bTranslatable) { $sSequenceToTranslate = substr($sSequence, $nPositionInString); $sSequenceProtein = RPF_translateDNA($sSequenceToTranslate); // Shorten sequence, only show until the first stop. $sSequenceProtein = substr($sSequenceProtein, 0, strpos($sSequenceProtein . '*', '*') + 1); // Then create a short mRNA sequence, up and until the first stop. $sSequenceToTranslateToStop = substr($sSequenceToTranslate, 0, strlen($sSequenceProtein) * 3); } // Output... fputs($fFileOut, $sChr . ':' . $nPosition . "\t" . $sTranscript . "\t" . $nPositionOnTranscript . "\t" . $sSequenceToTranslateToStop . "\t" . $sSequenceToTranslate . "\t" . $sSequenceProtein . "\n"); } // Clean up... $sLabel = ''; // Print the progress. if (!($nLine % 5)) { $nPercentageRead = round($nLine / $nLines, 2); $nAvailableWidth = $_SETT['terminal_width'] - 8 - strlen($nLine); $lDone = round($nPercentageRead * $nAvailableWidth);