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
##~~~~~~~~~~~~~~~~~~~~~~~~~define class~~~~~~~~~~~~~~~~~~~~~~~~~ | |
## new class | |
setClass(Class = 'trick', | |
slots = c(id = 'character', time = 'matrix'), | |
validity = function(object) { | |
if (length(object@id) != nrow(object@time)) { | |
warns <- paste('length of id is', length(object@id), 'is not equal to row number of time', nrow(object@time)) | |
return(warns) | |
} else { | |
return(TRUE) |
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
SSIndex <- function(i, len, wise = 5) { | |
min <- i - wise | |
min <- ifelse(min < 1, 1, min) | |
max <- i + wise | |
max <- ifelse(max > len, len, max) | |
return(seq(min, max)) | |
} |
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
#include <iostream> | |
int main() { | |
double sum = 0.0; | |
double step = 0.01; | |
double each = 0.01; | |
for (int i = 0; i < 100; ++i) { | |
sum += step; | |
step += each; |
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
###Download gff/fna/ptt/rnt annotation files of a prokaryotic genome #### | |
## Escherichia coli str. K-12 substr. MG1655 (E. coli) | |
## KEGG ID is 'eco' (http://www.genome.jp/kegg-bin/show_organism?org=eco) | |
## NCBI assembly ID is 'GCF_000005845.2' (https://www.ncbi.nlm.nih.gov/assembly/GCF_000005845.2) | |
library('ProGenome') ## version >= 0.06 | |
library('magrittr') |
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
samtools view -b Example_Condition1.sam -o Example_Condition1.bam | |
samtools view -b Example_Condition2.sam -o Example_Condition2.bam | |
## reverse | |
samtools view -h -f 16 Example_Condition1.bam -o Example_Condition1_rev.bam | |
## forward | |
samtools view -h -F 16 Example_Condition1.bam -o Example_Condition1_forw.bam | |
## reverse | |
samtools view -h -f 16 Example_Condition2.bam -o Example_Condition2_rev.bam |
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
#include <iostream> | |
#include <limits> | |
using namespace std; | |
int main() { | |
int a = numeric_limits<int>::min(); | |
int b = numeric_limits<int>::max(); |
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
#include <stdio.h> | |
#include <limits.h> | |
#include <float.h> | |
int main() { | |
int a = INT_MIN; | |
int b = INT_MAX; | |
double c = DBL_MIN; |
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
## set working path | |
setwd('/home/Yulong/RESEARCH/QAPTest/') | |
## to symmetric matrix | |
SymMat <- function(mat) { | |
## example | |
## tmp1 <- matrix(c(1, '-', '-', 2, 4, '-', 3, 5, 6), ncol = 3, byrow = TRUE) | |
mat <- apply(mat, 1:2, as.character) | |
mat <- ifelse(mat == '-', 0, mat) | |
mat <- apply(mat, 1:2, as.numeric) |
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
#include <RcppArmadillo.h> | |
#include <RcppParallel.h> | |
#include <algorithm> | |
#include <cmath> | |
using namespace Rcpp; | |
using namespace RcppParallel; | |
using namespace arma; | |
// [[Rcpp::depends(RcppArmadillo, RcppParallel)]] |
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
library('microbenchmark') | |
library('Rcpp') | |
library('RcppParallel') | |
library('foreach') | |
library('parallel') | |
library('doParallel') | |
library('iterators') | |
sourceCpp('testrcpp.cpp') |
OlderNewer