BWT演算法在生物資訊學中的應用(二) 演算法實現

2021-08-11 00:12:16 字數 1594 閱讀 3168

上一節中,介紹了bwt演算法的基本原理,本節主要使用c++來完成bwt演算法。主要思路基於上一節中的思想。

編碼部分:

1.迴圈移位

2.排序

3.取最後一列

解碼部分:

1.calculatepresum方法,用來獲得在l列的每個字元是前面有幾個同樣的字元。

2.calculatefirstindex方法,用來標識在f列中,每乙個字元的第乙個字元出現的起始位置。

3.getlastseq方法,根據presum和firstindex,得到在l列中讀取的順序。

4.倒序賦值到poutoriginalarray中。

class datacompress

;

datacompress::datacompress()

datacompress::~datacompress()

bool datacompress::bwtencodeing(char* poutfirstarray, char* poutlastarray, int* poutlastindexseq, const string &strinput)

//2. sort

sort(strarray, strarray + len);

//3. set lastarray

for (int i = 0; i < len; i++)

if (null != strarray)

return true;

}bool datacompress::btwdecoding(char* pinfirstarray, char* pinlastarray, char* poutoriginalarray)

if (null != pcheckpresum)

if (null != ppresumindex)

if (null != plastindexseq)

return true;

}string datacompress::cyclicshift(const string &strinput, int n)

string firststrpart = strinput.substr(0, n);

string secondstrpart = strinput.substr(n);

return resultstr;

}void datacompress::calculatepresum(int

*poutpresum, const char *pinlastarray, int len)

}}void datacompress::calculatefirstindex(char *pinfirstarray, int

*poutfirstindex, int len)

}return;

}void datacompress::getlastseq(char* pinlastarray, int *pincheckpresum, int *pinpresumindex,

int *pinoutlastindexseq, int len)

}return;

}

生物資訊學軟體 自學生物資訊學

我是生物工程專業出身,在大三保研時選擇了生物資訊的道路,到現在為止已經在行業裡摸爬滾打了6年的時間,在這6年的學習之路上疑惑過,也迷茫過,特此把我學習的過程以及遇到的問題總結出來以讓大家避免出現同樣的問題。在我學習生物資訊過程的基礎上帶著大家順暢的走一遍。在學習生物資訊學之前,我們先來了解一下什麼是...

生物資訊學(Bioinformatics)

生物資訊學 bioinformatics 這個名詞有許多不同的定義。從字面上來看,生物資訊學是將資訊科學應用於生物學。生物資訊學廣義的概念是指應用資訊科學研究生物體系和生物過程中資訊的存貯 資訊的內涵和資訊的傳遞,研究和分析生物體細胞 組織 器官的生理 病理 藥理過程的中各種生物資訊,或者說是生命科...

生物資訊學緒論

hgp第乙個五年總結報告 生物資訊學是一門交叉學科 它包含了生物資訊的獲取 加工 儲存 分配 分析 解釋等在內的所有方面,它運用數學 電腦科學和生物學的各種工具闡明和解釋大量資料所包含的生物學意義。美國喬治亞理工大學 生物資訊學是採用數學 統計學和電腦科學,分析生物學 生物化學和生物物理學資料的一門...