use of org.jbei.ice.lib.parsers.ABIParser in project ice by JBEI.
the class TraceSequences method parseTraceSequence.
private boolean parseTraceSequence(String fileName, byte[] bytes) {
DNASequence dnaSequence = null;
// First try parsing as ABI
ABIParser abiParser = new ABIParser();
try {
dnaSequence = abiParser.parse(bytes);
} catch (InvalidFormatParserException e) {
//
}
if (dnaSequence == null) {
// try parsing as fasta, genbank, etc
dnaSequence = GeneralParser.getInstance().parse(bytes);
if (dnaSequence == null || dnaSequence.getSequence() == null) {
String errMsg = ("Could not parse \"" + fileName + "\". Only Fasta, GenBank & ABI files are supported.");
Logger.error(errMsg);
return false;
}
}
TraceSequence traceSequence = importTraceSequence(fileName, dnaSequence.getSequence().toLowerCase(), new ByteArrayInputStream(bytes));
if (traceSequence == null)
return false;
Sequence sequence = DAOFactory.getSequenceDAO().getByEntry(entry);
if (sequence == null)
return true;
buildOrRebuildAlignment(traceSequence, sequence);
return true;
}
Aggregations