寻找算法做长对子核苷酸比对

时间:2012-09-08 00:02:29

标签: r alignment bioinformatics bioconductor sequence-alignment

我试图通过将支架与参考基因组的子序列比对来扫描可能的SNPsindels。 (原始读取不可用)。我正在使用R/bioconductor和Biostrings包中的`pairwiseAlignment函数。 这适用于较小的脚手架,但当我尝试将56kbp脚手架与错误信息对齐时失败:

  

QualityScaledXStringSet.pairwiseAlignment(pattern = pattern,   :无法分配大小为17179869183.7 Gb的内存块

我不确定这是不是一个错误? ;我的印象是Needleman-Wunsch algorithm使用的pairwiseAlignmentO(n*m),我认为这意味着计算需求大约为3.1E9次操作(56K * 56k ~= 3.1E9) }。似乎Needleman-Wunsch相似性矩阵也应该占用3.1 gig的内存。不确定我是否正确记住了大写符号,或者实际上是在R scripting环境的开销下构建对齐所需的内存开销。

是否有人建议使用更好的对齐算法来对齐更长的序列?已经使用BLAST进行初始比对以找到参照基因组的区域以进​​行比对。我并不完全有信心BLAST正确放置indel的可靠性,我还没有找到与生物串提供的解析原始BLAST比对的api一样好的api。

顺便说一句,这是一个复制问题的代码片段:

library("Biostrings")
scaffold_set = read.DNAStringSet(scaffold_file_name) #scaffold_set is a DNAStringSet instance
scafseq = scaffold_set[[scaffold_name]] #scaf_seq is a "DNAString" instance

genome = read.DNAStringSet(genome_file_name)[[1]] #genome is a "DNAString" instance

#qstart, qend, substart, subend are all from intial BLAST alignment step
scaf_sub = subseq(scafseq, start=qstart, end=qend) #56170-letter "DNAString" instance
genomic_sub = subseq(genome, start=substart, end=subend) #56168-letter "DNAString" instance

curalign = pairwiseAlignment(pattern = scaf_sub, subject = genomic_sub)
#that last line gives the error: 
#Error in .Call2("XStringSet_align_pairwiseAlignment", pattern, subject,  : 
#cannot allocate memory block of size 17179869182.9 Gb

较短的比对(数百个碱基)不会发生错误。 我还没有找到错误开始发生的长度截止

1 个答案:

答案 0 :(得分:-1)

所以我使用Clustal作为对齐工具。不确定具体的性能,但在进行大量的多序列比对时从未给我带来问题。这是一个运行.fasta文件的整个目录并对齐它们的脚本。您可以修改系统调用上的标志以满足您的输入/输出需求。只需看看clustal文档。这是在Perl中,我不会过多地使用R来进行对齐。您需要编辑脚本中的可执行文件路径以匹配计算机上clustal的位置。

#!/usr/bin/perl 


use warnings;

print "Please type the list file name of protein fasta files to align (end the directory    path with a / or this will fail!): ";
$directory = <STDIN>;
chomp $directory;

opendir (DIR,$directory) or die $!;

my @file = readdir DIR;
closedir DIR;

my $add="_align.fasta";

foreach $file (@file) {
 my $infile = "$directory$file";
 (my $fileprefix = $infile) =~ s/\.[^.]+$//;
 my $outfile="$fileprefix$add";
 system "/Users/Wes/Desktop/eggNOG_files/clustalw-2.1-macosx/clustalw2 -INFILE=$infile -OUTFILE=$outfile -OUTPUT=FASTA -tree";
}