Code Monkey home page Code Monkey logo

codon-usage-tables's Issues

csv_string_to_codons_dict() raises ValueError when reading a custom codon table - proposed workaround

I've used pandas df.to_csv() to write out a custom codon table
codon_table.csv

reading this table gives an error when reading the last line. adding the length check ( if len(line)>3:) solves this problem.

def csv_string_to_codons_dict(csv_string):
    """Transform a CSV string of a codon table to a dict."""
    result = {}
    for line in csv_string.split("\n")[1:]:
        if len(line)>3: # new check
            aa, codon, freq = line.split(",")
            if aa not in result:
                result[aa] = {}
            result[aa][codon] = float(freq)
    return result

Package fails to install via pip

When installing via pip pip install python_codon_tables the following error is produced

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/_f/5kqpr8kx5zl9qjtkzzkb31xw0000gn/T/pip-install-a0_5fa8a/python-codon-tables/setup.py", line 16, in <module>
        with open(os.path.join('data', 'version.txt'), 'r') as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'data/version.txt'

Seems that the issue is that the data directory is one up from the packaged directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.