Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genbank datatype #3339

Merged
merged 2 commits into from Dec 19, 2016

Conversation

Projects
None yet
3 participants
@erasche
Copy link
Member

commented Dec 19, 2016

This one has been sitting on my computer for a while. Feel free to reject. I'm PRing because:

  • We have a datatype for genbank, but no sniffer. If anyone is uploading genbank files they're manually setting the datatype which is sub-optimal.
  • Thus if we have a sniffer, there's no need for it to be perfect, as anything is an improvement over nothing, with room to make it more lenient in the future.

I have a branch somewhere that uses biopython for this, but it comes with a lot of baggage, so I'm just submitting this simple version as a minor improvement over the status quo.

@nsoranzo
Copy link
Member

left a comment

Thanks @erasche!

@@ -1066,3 +1066,22 @@ def sniff(self, filename):

# Number of lines is less than 3
return False

This comment has been minimized.

Copy link
@nsoranzo

nsoranzo Dec 19, 2016

Member

Can you add another blank line to make flake8 happy?

This comment has been minimized.

Copy link
@erasche

erasche Dec 19, 2016

Author Member

Done. Thanks for the review!


def sniff(self, filename):
try:
fh = open(filename, 'r')

This comment has been minimized.

Copy link
@nsoranzo

nsoranzo Dec 19, 2016

Member

Can you use the with syntax here?

if not line:
break # EOF
line = line.strip()
return line.startswith('LOCUS ')

This comment has been minimized.

Copy link
@nsoranzo

nsoranzo Dec 19, 2016

Member

You are effectively reading only the first line, you can replace the whole while cycle with:

            line = fh.readline().strip()
            return line.startswith('LOCUS ')
@@ -1066,3 +1066,22 @@ def sniff(self, filename):

# Number of lines is less than 3
return False

class Genbank(data.Text):
"""Class representing a Genbank sequence"""

This comment has been minimized.

Copy link
@nsoranzo

nsoranzo Dec 19, 2016

Member

Can you add also edam_data?

This comment has been minimized.

This comment has been minimized.

Copy link
@nsoranzo

@nsoranzo nsoranzo merged commit 4307501 into galaxyproject:dev Dec 19, 2016

4 checks passed

api test Build finished. 244 tests run, 0 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
framework test Build finished. 132 tests run, 0 skipped, 0 failed.
Details
toolshed test Build finished. 580 tests run, 0 skipped, 0 failed.
Details

@erasche erasche deleted the erasche:genbank branch Aug 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.