-
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.
- Loading branch information
Showing
9 changed files
with
23 additions
and
14 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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2019, Simone Marsili | ||
# All rights reserved. | ||
# Author: Simone Marsili <[email protected]> | ||
# License: BSD 3 clause | ||
# Author: Simone Marsili ([email protected]) | ||
"""A little parser for alignments of biological sequences.""" | ||
|
||
import time | ||
|
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Simone Marsili <[email protected]> | ||
# License: BSD 3 clause | ||
""" | ||
Functions of sequences. If a transformed version of the sequence is | ||
returned, it should be a list of symbols (not a string). | ||
|
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Simone Marsili <[email protected]> | ||
# License: BSD 3 clause | ||
"""alignment parser""" | ||
import sys | ||
import logging | ||
|
@@ -24,8 +27,8 @@ def parse(source, fmt, func=None): | |
Yields | ||
------ | ||
(index, header, seq) : tuple (int, str, str) | ||
For each record, a tuple containing index, header and sequence. | ||
(header, seq) : tuple (str, str) | ||
For each record, a tuple containing header and sequence. | ||
""" | ||
from collections import Iterable | ||
|
@@ -48,12 +51,10 @@ def func(x): | |
if not callable(func): | ||
raise TypeError('%s object is not callable' % type(func)) | ||
|
||
index = 0 | ||
data = gopen.gread(source) | ||
parsed_data = bioparser(data) | ||
for title, seq in parsed_data: | ||
yield index, title, func(seq) | ||
index += 1 | ||
yield title, func(seq) | ||
|
||
|
||
def write(a, f=sys.stdout): | ||
|
@@ -74,8 +75,8 @@ def main(): | |
fmt = args.format | ||
|
||
parsed_records = parse(filename, fmt) | ||
for index, title, seq in parsed_records: | ||
print('%s %s\n%s' % (title, index, seq)) | ||
for title, seq in parsed_records: | ||
print('%s\n%s' % (title, seq)) | ||
|
||
|
||
if __name__ == '__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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Simone Marsili <[email protected]> | ||
# License: BSD 3 clause | ||
"""Utility functions.""" | ||
|
||
import logging | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[tox] | ||
envlist = py{27,35} | ||
envlist = py{35} | ||
|
||
[testenv] | ||
deps = -r{toxinidir}/requirements.txt | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "0.5" | ||
"version": "0.6" | ||
} |