Skip to content

Commit

Permalink
Merge branch 'release-0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
simomarsili committed Feb 11, 2019
2 parents c3eafbd + dd76c5b commit 5adc96a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

## [0.6] - 2019-02-11
### Changed
- remove index from record tuple

## [0.5] - 2019-02-5
### Added
- `func` argument to `parse` function.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016, Simone Marsili
Copyright (c) 2019, Simone Marsili
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
4 changes: 1 addition & 3 deletions lilbio/__init__.py
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
Expand Down
3 changes: 3 additions & 0 deletions lilbio/funcs.py
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).
Expand Down
15 changes: 8 additions & 7 deletions lilbio/parser.py
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
Expand All @@ -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
Expand All @@ -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):
Expand All @@ -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__':
Expand Down
3 changes: 3 additions & 0 deletions lilbio/utils.py
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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import lilbio

RECORDS = "[(0, 'VP54_CPSVP/90-227', '........LGTLKSITDKLRKLGGESSQPFIQFYKVQCMYIPLFSRVDGDNG......EITVSLIDDGKEAAGQDPIIQSITFDASQMAMVELSMNFFVEKKDMDFIGIHVSAENVPVQDRAYGSINLAFFTNEQSVPMMQEEKKSSYLMID..'), (1, 'Q6E6Y4_9VIRU/93-231', 'ttkvkitt-------MDKVTSLIKFEKFPFYRVDRLKILYIPLFSGENSEGK......NITFSIQDRSMVVAGKPKKISSATAPINKMSMIELSATYFVQSKDLSKIEFGYKAKGIPVSGRSFAAVYLAFYIHGDHFPATMRPKDPIVLLID..'), (2, 'A0A075IE34_9VIRU/105-247', '.iatmgrv-------VNLFKKATG-NEMPFVKFEKVQVMYIPLFQKTNEEDDpdkkipSMTVALVDKGQEEAGGDGIIQSITFRADEMALMELSMNFFVTRKDIEKIVVDACVDEIPVEGRAYGAMTIAFFVHEDYVPLRTELKPSTLMY--it')]"
RECORDS = "[('VP54_CPSVP/90-227', '........LGTLKSITDKLRKLGGESSQPFIQFYKVQCMYIPLFSRVDGDNG......EITVSLIDDGKEAAGQDPIIQSITFDASQMAMVELSMNFFVEKKDMDFIGIHVSAENVPVQDRAYGSINLAFFTNEQSVPMMQEEKKSSYLMID..'), ('Q6E6Y4_9VIRU/93-231', 'ttkvkitt-------MDKVTSLIKFEKFPFYRVDRLKILYIPLFSGENSEGK......NITFSIQDRSMVVAGKPKKISSATAPINKMSMIELSATYFVQSKDLSKIEFGYKAKGIPVSGRSFAAVYLAFYIHGDHFPATMRPKDPIVLLID..'), ('A0A075IE34_9VIRU/105-247', '.iatmgrv-------VNLFKKATG-NEMPFVKFEKVQVMYIPLFQKTNEEDDpdkkipSMTVALVDKGQEEAGGDGIIQSITFRADEMALMELSMNFFVTRKDIEKIVVDACVDEIPVEGRAYGAMTIAFFVHEDYVPLRTELKPSTLMY--it')]"


def tests_dir():
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
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
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.5"
"version": "0.6"
}

0 comments on commit 5adc96a

Please sign in to comment.