当我在js中解析文本并且想要从多行中检索(DNA序列)查询名称并将其放在段落标签之间时,它无法正常工作。用javascript解析文本:神秘生成的段落标签
(的部分)文本文件:
Database: db
22,774 sequences; 12,448,185 total letters
Searching..................................................done
Query= gi|998623327|dbj|LC126440.1| Rhodosporidium sp. 14Y315 genes
for ITS1, 5.8S rRNA, ITS2, partial and complete sequence
(591 letters)
Score E
Sequences producing significant alignments: (bits) Value
的代码:
(I第一读线到一个数组)
for(var i = 0; i < lines.length; i++){
var line = lines[i];
if(line.search("Query= ") != -1){
results.innerHTML += " <p class='result_name'> <br>Result name: ";
//the name starts at 7th char
results.innerHTML += line.slice(7);
//take the next line
i++;
// tried to searh for "\n" or "\r" or "\r\n" to end cycle - didn't work
// so instead I put this for the while condition:
while(lines[i].length > 2){
results.innerHTML += lines[i];
i++;
}
//here is where I want the result_name paragraph to end.
results.innerHTML += " </p> <p>Result(s):</p>";
}
}
尝试改变
标签由
– Walfrat
更改和删除
标签没有帮助 –