[Biojava-l] NullPointerException when using Alignments.getMultipleSequenceAlignment

Hannes Brandstätter-Müller biojava at hannes.oib.com
Wed Oct 5 07:41:57 UTC 2011


Hello!

I tried to follow http://biojava.org/wiki/BioJava:CookBook3:MSA, but
when I run it, I get:

java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
	at java.util.concurrent.FutureTask.get(FutureTask.java:83)
	at org.biojava3.alignment.Alignments.getListFromFutures(Alignments.java:282)
	at org.biojava3.alignment.Alignments.runPairwiseScorers(Alignments.java:602)
	at org.biojava3.alignment.Alignments.getMultipleSequenceAlignment(Alignments.java:173)

 What could I be doing wrong?

(
on the cookbook page, there is also an import missing:
import org.biojava3.alignment.Alignments;
)
-> then the cookbook runs, but my code does not

private static void processFile(String filename) {
        try {
            FileInputStream inStream = new FileInputStream(filename);
            FastaReader<DNASequence, NucleotideCompound> fastaReader =
                    new FastaReader<DNASequence, NucleotideCompound>(
                    inStream,
                    new GenericFastaHeaderParser<DNASequence,
NucleotideCompound>(),
                    new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()));
            LinkedHashMap<String, DNASequence> b = fastaReader.process();

            List<DNASequence> sequences = new ArrayList<DNASequence>();
            for (Entry<String, DNASequence> entry : b.entrySet()) {
                if (sequences.size() < 5) {
                    sequences.add(entry.getValue());
                }
                System.out.println(entry.getValue());
            }

            Profile<DNASequence, NucleotideCompound> profile =
Alignments.getMultipleSequenceAlignment(sequences);
            System.out.printf("Clustalw:%n%s%n", profile);

            ConcurrencyTools.shutdown();
        } catch (Exception ex) {
            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
    }



More information about the Biojava-l mailing list