我有多个序列对齐的问题。我有两个序列如下,我试图对齐他们使用生物java方法,我得到这样的错误。我不知道怎么了。我知道序列的长度不一样,但这应该无关紧要。
GSKTGTKITFYEDKNFQGRRYDCDCDCADFHTYLSRCNSIKVEGGTWAVYERPNFAGYMYILPQGEYPEYQRWMGLNDRLSSCRAVHLPSGGQYKIQIFEKGDFSGQMYETTEDCPSIMEQFHMREIHSCKVLEGVWIFYELPNYRGRQYLLDKKEYRKPIDWGAASPAVQSFRRIVESMSAGPWKMVVWDEDGFQGRRHEFTAECPSVLELGFETVRSLKVLSGAWVGFEHAGFQGQQYILERGEYPSWDAWGGNTAYPAERLTSFRPAACANHRDSRLTIFEQENFLGKKGELSDDYPSLQAMGWEGNEVGSFHVHSGAWVCSQFPGYRGFQYVLECDHHSGDYKHFREWGSHAPTFQVQSIRRIQQ
线程"main"异常java.lang.ArrayIndexOutOfBoundsException: 1在org.forester.evoinference.distance.NeighborJoining.getValueFromD (NeighborJoining.java: 150)在org.forester.evoinference.distance.NeighborJoining.execute (NeighborJoining.java: 123)(GuideTree.java:88org.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;
}
}
我猜问题在这一行:
for (String fn : fileName)
{
al = getProteinSequenceFromFasta(fn);
...
}
您正在为每个文件覆盖a1
的内容。(我假设您想将所有fasta记录添加到a1
中。如果你的fasta文件只有1条记录,那么它不能对单个记录进行多次对齐。
你可能想要
for (String fn : fileName)
{
al.addAll(getProteinSequenceFromFasta(fn) );
...
}
当然,您正在使用的库可能应该首先检查以确保有超过1个序列....