| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 219af9a commit 4ad8eb6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,6 +79,27 @@ BioJava can also be used to parse large FASTA files. The example below can parse | |||
| 79 | 79 | } | |
| 80 | 80 | ``` | |
| 81 | 81 | ||
| 82 | + BioJava can also process large FASTA files using the Java streams API. | ||
| 83 | + | ||
| 84 | + ```java | ||
| 85 | + FastaStreamer | ||
| 86 | + .from(path) | ||
| 87 | + .stream() | ||
| 88 | + .forEach(sequence -> System.out.printf("%s -> %ss\n", sequence.getOriginalHeader(), sequence.getSequenceAsString())); | ||
| 89 | + ``` | ||
| 90 | + | ||
| 91 | + If you need to specify a header parser other that `GenericFastaHeaderParser` or a sequence creater other than a | ||
| 92 | + `ProteinSequenceCreator`, these can be specified before streaming the contents as follows: | ||
| 93 | + | ||
| 94 | + ```java | ||
| 95 | + FastaStreamer | ||
| 96 | + .from(path) | ||
| 97 | + .withHeaderParser(new PlainFastaHeaderParser<>()) | ||
| 98 | + .withSequenceCreator(new CasePreservingProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())) | ||
| 99 | + .stream() | ||
| 100 | + .forEach(sequence -> System.out.printf("%s -> %ss\n", sequence.getOriginalHeader(), sequence.getSequenceAsString())); | ||
| 101 | + ``` | ||
| 102 | + | ||
| 82 | 103 | ||
| 83 | 104 | ||
| 84 | 105 | <!--automatically generated footer--> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments