use of org.biojavax.bio.seq.RichSequenceIterator in project ice by JBEI.
the class FastaParser method parse.
@Override
public FeaturedDNASequence parse(String textSequence) throws InvalidFormatParserException {
try {
textSequence = cleanSequence(textSequence);
try (BufferedReader br = new BufferedReader(new StringReader(textSequence))) {
FeaturedDNASequence sequence;
RichSequenceIterator richSequences = IOTools.readFastaDNA(br, null);
if (richSequences.hasNext()) {
RichSequence richSequence = richSequences.nextRichSequence();
sequence = new FeaturedDNASequence(richSequence.seqString(), new LinkedList<>());
} else {
throw new InvalidFormatParserException("No sequence found in sequence file!");
}
return sequence;
}
} catch (BioException | IOException e) {
throw new InvalidFormatParserException("Couldn't parse FASTA sequence!", e);
}
}
Aggregations