genomes.json
,改为本地的。chr1:12345
这样的位点,不能搜索EGFR
这样的基因字符串。还是要修改js文件,具体方法见下文。版本号: igv.version() #'2.15.10'
(1) 线索1a:该函数的返回值是什么类型的?
function searchWebService(browser, locus, searchConfig){ //57722
//
const result = await igvxhr.loadString(path, options);
//
}
(2) 线索1b: 先看参数类型
igvxhr.loadString(path, options); // line 57728
debug wjl: 1 EGFR https://igv.org/genomes/locus.php?genome=hg38&name=EGFR {timeout: 5000}
参数
cocus: EGFR
path: https://igv.org/genomes/locus.php?genome=hg38&name=EGFR
options: {timeout: 5000}
(3) 线索1c: 返回值
不确定,只能根据代码推测
return this._loadStringFromUrl(path, options)
async _loadStringFromUrl(url, options) {
options = options || {};
options.responseType = "arraybuffer";
const data = await this.load(url, options);
return arrayBufferToString(data)
}
this.load(url, options); 中引用的是
return this._loadURL(url, options) //18672
xhr.send(sendData); //18825
(4) 线索1d: ajax 的请求链接
url: ‘https://igv.org/genomes/locus.php?genome= G E N O M E GENOME GENOME&name= F E A T U R E FEATURE FEATURE’, //57547
https://igv.org/genomes/locus.php?genome=hg38&name=EGFR
(1) 线索2a: 下一行怎么使用该数据?
const locusObject = processSearchResult(browser, result, searchConfig);
找到最相关的 const locusObject = {chr, start, end}; //57796
const result = //手动设置,确认格式 //57731
这里很关键
(2) 线索2b: 该函数调用 parseSearchResults
function processSearchResult(browser, result, searchConfig) { //57750
if ('plain' === searchConfig.type) {
console.log("debug wjl: 4", result, searchConfig ) // ===>>>>debug 11223344
results = parseSearchResults(browser, result);
}
(3) 线索2c: 这时最终格式
* Parse the igv line-oriented (non json) search results.
* Example
* EGFR chr7:55,086,724-55,275,031 refseq
function parseSearchResults(browser, data) { //57827
}
(4) 这个格式怎么修改? 第5和第6列。
$ zcat ref/hg38/ncbiRefSeq.txt.gz | awk '{print $13"\t"$3":"$5"-"$6"\trefseq"}' | grep "EGFR" | head -n1
EGFR chr7:55019016-55156939 refseq
(5) 回退到上一步
57843行 line="EGFR\tchr7:55019016-55156939\trefseq"
57731 const result = "EGFR\tchr7:55019016-55156939\trefseq"
57547 url: 'https://igv.org/genomes/locus.php?genome=$GENOME$&name=$FEATURE$',
(6) 设置一个支持cors的、返回字符串的服务器,返回值是
zcat /home/wangjl/soft/scIGV/ref/hg38/ncbiRefSeq.txt.gz | awk '{print $13"\t"$3":"$5"-"$6"\trefseq"}' | grep "CCND1" | head -n 1
其他关键技术点:
幸运的是,这些之前都解决过。