我有多个序列对齐的问题。我有两个序列如下,我试图使用biojava方法对齐它们,我得到这样的错误。我不知道出了什么问题。我知道序列长度不一样但不重要。
GSKTGTKITFYEDKNFQGRRYDCDCDCADFHTYLSRCNSIKVEGGTWAVYERPNFAGYMYILPQGEYPEYQRWMGLNDRLSSCRAVHLPSGGQYKIQIFEKGDFSGQMYETTEDCPSIMEQFHMREIHSCKVLEGVWIFYELPNYRGRQYLLDKKEYRKPIDWGAASPAVQSFRRIVE SMSAGPWKMVVWDEDGFQGRRHEFTAECPSVLELGFETVRSLKVLSGAWVGFEHAGFQGQQYILERGEYPSWDAWGGNTAYPAERLTSFRPAACANHRDSRLTIFEQENFLGKKGELSDDYPSLQAMGWEGNEVGSFHVHSGAWVCSQFPGYRGFQYVLECDHHSGDYKHFREWGSHAPTFQVQSIRRIQQ
线程中的异常" main" java.lang.ArrayIndexOutOfBoundsException:1 在 org.forester.evoinference.distance.NeighborJoining.getValueFromD(NeighborJoining.java:150) 在 org.forester.evoinference.distance.NeighborJoining.execute(NeighborJoining.java:123) 在org.biojava3.alignment.GuideTree。(GuideTree.java:88)at org.biojava3.alignment.Alignments.getMultipleSequenceAlignment(Alignments.java:183) 在Fasta.main(Fasta.java:41)
public class Fasta {
public static void main(String[] args) throws Exception{
ArrayList<String> fileName = new ArrayList<String> ();
fileName.add("2M3T.fasta.txt");
fileName.add("3LWK.fasta.txt");
ArrayList<ProteinSequence> al = new ArrayList<ProteinSequence>();
//ArrayList<ProteinSequence> all = new ArrayList<ProteinSequence>();
for (String fn : fileName)
{
al = getProteinSequenceFromFasta(fn);
//all.add(al.get(0));
for (ProteinSequence s : al)
{
System.out.println(s);
}
}
Profile<ProteinSequence, AminoAcidCompound> profile = Alignments.getMultipleSequenceAlignment(al);
System.out.printf("Clustalw:%n%s%n", profile);
ConcurrencyTools.shutdown();
}
//for (int i=0;i<sequence.size();i++)
// System.out.println(sequence);
public static ArrayList<ProteinSequence> getProteinSequenceFromFasta(String file) throws Exception{
LinkedHashMap<String, ProteinSequence> a = FastaReaderHelper.readFastaProteinSequence(new File(file));
//sztuczne
ArrayList<ProteinSequence> sequence = new ArrayList<ProteinSequence>(a.values());
return sequence;
}
}
答案 0 :(得分:0)
我的猜测是问题在于这一行:
for (String fn : fileName)
{
al = getProteinSequenceFromFasta(fn);
...
}
您正在覆盖每个文件的a1
内容。 (我假设您要将所有fasta记录添加到a1
。如果您的fasta文件每个只有1条记录,那么它就无法对单条记录进行多重对齐。
你可能想要
for (String fn : fileName)
{
al.addAll(getProteinSequenceFromFasta(fn) );
...
}
当然,您使用的库可能应该首先检查以确保有超过1个序列....