File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines 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-->
You can’t perform that action at this time.
0 commit comments