C++ 模板与泛型编程

泛型编程旨在编写独立于数据类型的代码” 《c++ primer plus》(6th ed)

实现一种方法,可以用于各种类型的数据。

#include<iostream>

using namespace std;

template <class Nott>
class Stack{
  private:
    Nott arr[20];
    int num;
  public:
    Stack();
    void push(const Nott& ele);
    void print();
};


template <class Nott>
Stack<Nott>::Stack(){
  num = 0;
}

template <class Nott>
void Stack<Nott>::push(const Nott& ele){
  arr[num] = ele;
  num ++; 
}

template <class Nott>
void Stack<Nott>::print(){
  for(int i = 0;i < num;i ++) 
    cout << arr[i] << " ";
  cout << endl;
}

int main(){
  Stack<char> nott;
  nott.push('N');
  nott.push('O');
  nott.push('T');
  nott.push('T');
  nott.print();
  Stack<int> nottt;
  nottt.push(6);
  nottt.push(6);
  nottt.push(6);
  nottt.push(6);
  nottt.print();
  return 0;
}

输出结果:

I C B C
6 6 6 6

HOX gene

ref: 2013-the reg­u­la­tion of hox gene expres­sion dur­ing ani­mal devel­op­ment

 

home­o­sis the replace­ment of part of one seg­ment of an insect or oth­er sege­ment­ed ani­mal by a struc­ture char­ac­ter­is­tic of a dif­fer­ent seg­ment, espe­cial­ly through muta­tion.
home­obox any of a class of close­ly sim­i­lar sequences which occur in var­i­ous genes and are involved in reg­u­lat­ing embry­on­ic devel­op­ment in a wide range of species

 

 

GATK caveat

1. 选择/过滤

Vari­ant­Fil­tra­tion: Fil­ter vari­ant calls based on INFO and/or FORMAT anno­ta­tions
out­put: A fil­tered VCF in which pass­ing vari­ants are anno­tat­ed as PASS and fail­ing vari­ants are anno­tat­ed with the name(s) of the filter(s) they failed.
Select­Vari­ants:    Select a sub­set of vari­ants from a VCF file.
out­put:
1.如果一个值缺失,VariantFiltration会认为这条值所在的记录通过检查,而SelectVariants认为这条记录不能通过检查。

2.foobar

 

notes of ANNOVAR

1. 坐标系: By default, 1-based coor­di­nate sys­tem is used.

2. 核心程序: annotate_variation.pl

3. 注释类型: gene-based (-genean­no), region-based (-regio­nan­no) and fil­ter-based (-fil­ter) anno­ta­tions.

4. 输出结果:

a. The first file con­tains anno­ta­tion for all vari­ants, by adding two columns to the begin­ning of each input line.

b. The sec­ond out­put file con­tains the amino acid changes as a result of the exon­ic vari­ant.

5. 重点定位:

What about GFF3 file for new species?(http://annovar.openbioinformatics.org/en/latest/user-guide/gene/)

gff3­To­GenePred                                                                               (http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/)

Saccharomyces cerevisiae (yeast)

The bud­ding yeast Sac­cha­romyces cere­visi­ae is one of the major mod­el organ­isms for under­stand­ing cel­lu­lar and mol­e­c­u­lar process­es in eukary­otes. This sin­gle-celled organ­ism is also impor­tant in indus­try, where it is used to make bread, beer, wine, enzymes, and pharmaceuticals.The Sac­cha­romyces cere­visi­ae genome is approx­i­mate­ly 12 Mb, orga­nized in 16 chro­mo­somes.

shell脚本路径问题

如何在shell的脚本内得知脚本所在的位置?有些命令当使用sh执行本脚本时可以成立,但是通过source执行本脚本的时候就不行了。下面详细论述各种情况。

1.参数传入

sh script.sh para1或者­source script.sh para1

在脚本里面可以通过$1来获得para1

2.

GCE 图片欣赏

图一

A.由于reads错误率上升,无效的reads越来越多,错误峰从无到有,从低到高;

B.由于越来越多的reads变成错误的reads,所以正确的reads占比下降,峰高下降;

C.正确的reads占比下降,是由于其数量的减少导致的,进而导致其对基因组的覆盖度下降,峰左移;

图二

A. Kmer分析峰的深度,比数据对基因组的覆盖深度会低少许,峰左移;

B. Kmer分析峰的高度更高一些,实际意义待定。

 

无锁(lock-free)的非阻塞算法:CAS (Compare-And-Swap)

定义

CAS的意思是:当本线程打算修改某个其他线程也可以访问的变量时,并且这个变量的改变和其旧值相关,那么,在修改前进行这样的操作:判断这个变量的当前值是否和本线程存储的其过去值相等,如果相等,就将其修改为新值;否则,就将其过去值修改为当前值,本次尝试修改失败,然后再次尝试修改这个值。

当讨论多线程的时候,就得讨论锁,而CAS是一种乐观锁。所谓乐观锁,就是指,不去锁定数据,而是通过判断来确定是否可以修改这个值。

应用:

Jel­ly­fish