-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tips subcommand for starting mini tree workflow, unit tests
- Loading branch information
1 parent
f6b7bc5
commit 0bf9423
Showing
5 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
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,17 @@ | ||
import skbio | ||
from skbio import BiologicalSequence | ||
|
||
|
||
""" takes 97_OTUs (at "species" level) and clusters them at a lower level of | ||
similarity using swarm. | ||
""" | ||
|
||
|
||
def preprocess_tip_sequences(species_level_otus_f): | ||
for seq in skbio.read(species_level_otus_f, format="fasta"): | ||
if "-" not in seq.id: | ||
new_seq_id = str(seq.id) + "_1" | ||
seq = BiologicalSequence(seq.sequence, id=new_seq_id) | ||
yield seq | ||
|
||
# swarmdir = "/Users/jenniferfouquier/dev/ghost-tree/swarm" |
Empty file.
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,25 @@ | ||
import unittest | ||
from StringIO import StringIO | ||
|
||
from skbio import BiologicalSequence | ||
|
||
from ghosttree.tips.cluster import preprocess_tip_sequences | ||
|
||
|
||
# Fix input OTU level sequence files (unnecessary characters and other | ||
# requirements set forth by SWARM software) | ||
class TestClusterTipSequences(unittest.TestCase): | ||
def setUp(self): | ||
self.tips_with_returns = StringIO(tips_with_returns) | ||
|
||
def test_tip_sequences_with_returns(self): | ||
result = preprocess_tip_sequences(self.tips_with_returns) | ||
self.assertEqual(list(result), [BiologicalSequence("ATC", | ||
id="SSS456_1")]) | ||
|
||
tips_with_returns = """>SSS456 | ||
ATC | ||
""" | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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