-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed many deps, integrated svb and wordwrap * removed svb submodule * added svb back * add cpuid, murmur, remove testify * change around workflows * Fix linting problems except weightedrand * Added go.mod to lib, removed weightedRand * fix import problems * update directories * Updated readme and seqhash.go for clarity
- Loading branch information
Showing
66 changed files
with
4,809 additions
and
697 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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ run: | |
skip-dirs: | ||
- data | ||
- api/gen | ||
- lib/bio/slow5/svb | ||
linters: | ||
enable: | ||
- bodyclose | ||
|
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,3 @@ | ||
go 1.21.5 | ||
|
||
use ./lib |
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
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,93 @@ | ||
package genbank | ||
|
||
import ( | ||
"bytes" | ||
"unicode" | ||
) | ||
|
||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2014 Mitchell Hashimoto | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
const nbsp = 0xA0 | ||
|
||
// wrapString wraps the given string within lim width in characters. | ||
// | ||
// Wrapping is currently naive and only happens at white-space. A future | ||
// version of the library will implement smarter wrapping. This means that | ||
// pathological cases can dramatically reach past the limit, such as a very | ||
// long word. | ||
func wrapString(s string, lim uint) string { | ||
// Initialize a buffer with a slightly larger size to account for breaks | ||
init := make([]byte, 0, len(s)) | ||
buf := bytes.NewBuffer(init) | ||
|
||
var current uint | ||
var wordBuf, spaceBuf bytes.Buffer | ||
var wordBufLen, spaceBufLen uint | ||
|
||
for _, char := range s { | ||
if char == '\n' { | ||
if wordBuf.Len() == 0 { | ||
if current+spaceBufLen > lim { | ||
|
||
} else { | ||
_, _ = spaceBuf.WriteTo(buf) | ||
} | ||
spaceBuf.Reset() | ||
spaceBufLen = 0 | ||
} else { | ||
_, _ = spaceBuf.WriteTo(buf) | ||
spaceBuf.Reset() | ||
spaceBufLen = 0 | ||
_, _ = wordBuf.WriteTo(buf) | ||
wordBuf.Reset() | ||
wordBufLen = 0 | ||
} | ||
buf.WriteRune(char) | ||
current = 0 | ||
} else if unicode.IsSpace(char) && char != nbsp { | ||
if spaceBuf.Len() == 0 || wordBuf.Len() > 0 { | ||
current += spaceBufLen + wordBufLen | ||
_, _ = spaceBuf.WriteTo(buf) | ||
spaceBuf.Reset() | ||
spaceBufLen = 0 | ||
_, _ = wordBuf.WriteTo(buf) | ||
wordBuf.Reset() | ||
wordBufLen = 0 | ||
} | ||
|
||
spaceBuf.WriteRune(char) | ||
spaceBufLen++ | ||
} else { | ||
wordBuf.WriteRune(char) | ||
wordBufLen++ | ||
|
||
if current+wordBufLen+spaceBufLen > lim && wordBufLen < lim { | ||
buf.WriteRune('\n') | ||
current = 0 | ||
spaceBuf.Reset() | ||
spaceBufLen = 0 | ||
} | ||
} | ||
} | ||
|
||
if wordBuf.Len() == 0 { | ||
if current+spaceBufLen <= lim { | ||
_, _ = spaceBuf.WriteTo(buf) | ||
} | ||
} else { | ||
_, _ = spaceBuf.WriteTo(buf) | ||
_, _ = wordBuf.WriteTo(buf) | ||
} | ||
|
||
return buf.String() | ||
} |
Oops, something went wrong.