Skip to content

Commit

Permalink
Merge pull request #66 from andrewjpage/sq_exceeds_80
Browse files Browse the repository at this point in the history
Sq exceeds 80
  • Loading branch information
andrewjpage authored Nov 9, 2016
2 parents 76d35f0 + 5af6160 commit a203c0d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ RUN apt-get update -qq && apt-get install -y python-genometools genometools wget
#
# Download build and install gff3toembl python
#
RUN wget https://github.com/sanger-pathogens/gff3toembl/archive/v1.1.0.tar.gz && mv v1.1.0.tar.gz /opt && cd /opt && tar xzf v1.1.0.tar.gz
RUN wget https://github.com/sanger-pathogens/gff3toembl/archive/v1.1.1.tar.gz && mv v1.1.1.tar.gz /opt && cd /opt && tar xzf v1.1.1.tar.gz

RUN cd /opt && tar xzf v1.1.0.tar.gz && rm v1.1.0.tar.gz && cd /opt/gff3toembl-1.1.0 && python setup.py install
RUN cd /opt && tar xzf v1.1.1.tar.gz && rm v1.1.1.tar.gz && cd /opt/gff3toembl-1.1.1 && python setup.py install
4 changes: 3 additions & 1 deletion gff3toembl/EMBLContig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def format(self):
except AttributeError:
raise ValueError("Could not format contig, no sequence data found")
formatted_string = header + features + sequence
line_lengths = map(len, formatted_string.split('\n'))
header_features_formatted_string = header + features
line_lengths = map(len, header_features_formatted_string.split('\n'))
maximum_line_length = max(line_lengths)
if maximum_line_length > 80:
raise ValueError("Could not format contig, a line exceeded 80 characters in length")
Expand Down Expand Up @@ -409,6 +410,7 @@ def calculate_nucleotide_counts(self, sequence):
return counts

def format_header(self, nucleotide_counts):
# This line can exceed 80 characters
template = "SQ Sequence {total} BP; {a} A; {c} C; {g} G; {t} T; {other} other;"
total_counts = sum(nucleotide_counts.values())
nucleotide_counts['total'] = total_counts
Expand Down
11 changes: 0 additions & 11 deletions gff3toembl/tests/EMBLContig_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@ def test_format(self):
"""
self.assertEqual(calculated_string, expected_string)

def test_format_line_too_long(self):
contig = EMBLContig()
header_mock = MagicMock()
sequence_mock = MagicMock()
header_mock.format.return_value = "Header"
sequence_mock.format.return_value = "Very long line: " + '*'*100
contig.header = header_mock
contig.features = {}
contig.sequence = sequence_mock
self.assertRaises(ValueError, contig.format)

def test_add_feature(self):
contig = EMBLContig()
contig.add_feature(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(fname):

setup(
name='gff3toembl',
version='1.1.0',
version='1.1.1',
description='Convert a GFF3 file to EMBL format for submission',
long_description=read('README.md'),
packages = find_packages(),
Expand Down

0 comments on commit a203c0d

Please sign in to comment.