-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move OboEntries into own module for clarity reasons
- Loading branch information
Showing
4 changed files
with
32 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace FsOboParser | ||
|
||
|
||
/// Functions for working with OboEntries. | ||
module OboEntries = | ||
|
||
/// Reads a collection of strings and parses them into a list of OboEntries. | ||
let fromLines verbose (input : seq<string>) = | ||
|
||
let en = input.GetEnumerator() | ||
let rec loop (en:System.Collections.Generic.IEnumerator<string>) entries lineNumber = | ||
|
||
match en.MoveNext() with | ||
| true -> | ||
match (en.Current |> DBXref.trimComment) with | ||
| "[Term]" -> | ||
let lineNumber, parsedTerm = (OboTerm.fromLines verbose en lineNumber "" "" false [] "" "" [] [] [] [] [] [] [] [] false [] [] [] false "" "") | ||
loop en (Term parsedTerm :: entries) lineNumber | ||
| "[Typedef]" -> | ||
let lineNumber, parsedTypeDef = (OboTypeDef.fromLines verbose en lineNumber "" "" "" "" [] [] false false false false false false false) | ||
loop en (TypeDef parsedTypeDef :: entries) lineNumber | ||
| _ -> loop en entries (lineNumber + 1) | ||
| false -> entries | ||
|
||
loop en [] 1 | ||
|
||
/// Reads an OBO file and returns a list of OboEntries. | ||
let fromFile verbose filepath = | ||
System.IO.File.ReadAllLines filepath | ||
|> fromLines verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters