Skip to content

Commit

Permalink
Merge pull request #4 from 3dem/devel
Browse files Browse the repository at this point in the history
version 0.0.7
  • Loading branch information
azazellochg authored Nov 8, 2020
2 parents 34aeffd + 192c71a commit b62f804
Show file tree
Hide file tree
Showing 16 changed files with 848 additions and 13 deletions.
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*pyc
#### Eclipse and so on
.project
.cproject
.pydevproject
.classpath
.idea

#### Python
build/
dist/
*.egg-info/
*.egg
*.py[cod]
__pycache__/
*.so
*~
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.0.7: exported Column via Table class
0.0.6: first version for pip
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.rst
include LICENSE
include *.txt
1 change: 0 additions & 1 deletion README.md

This file was deleted.

5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=======
emtable
=======

Simple module to deal with EM tabular data (aka metadata)
26 changes: 26 additions & 0 deletions emtable/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# **************************************************************************
# *
# * Authors: J. M. de la Rosa Trevin ([email protected])
# * Authors: Grigory Sharov ([email protected])
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# * 02111-1307 USA
# *
# * All comments concerning this program package may be sent to the
# * e-mail address '[email protected]'
# *
# **************************************************************************

from .metadata import *
11 changes: 6 additions & 5 deletions metadata.py → emtable/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# *
# **************************************************************************

__version__ = '0.0.6'
__version__ = '0.0.7'
__author__ = 'Jose Miguel de la Rosa Trevin'


Expand All @@ -29,7 +29,7 @@
from collections import OrderedDict, namedtuple


class Column:
class _Column:
def __init__(self, name, type=None):
self._name = name
# Get the type from the LABELS dict, assume str by default
Expand Down Expand Up @@ -93,7 +93,7 @@ def _createColumns(self, columnList, line=None, guessType=False):
"""
self._columns.clear()

if isinstance(columnList[0], Column):
if isinstance(columnList[0], _Column):
for col in columnList:
self._columns[col.getName()] = col
else:
Expand All @@ -103,7 +103,7 @@ def _createColumns(self, columnList, line=None, guessType=False):
typeList = [str] * len(columnList)

for colName, colType in zip(columnList, typeList):
self._columns[colName] = Column(colName, colType)
self._columns[colName] = _Column(colName, colType)

self._createRowClass()

Expand Down Expand Up @@ -298,6 +298,7 @@ class Table(_ColumnsList):
"""
Reader = _Reader
Writer = _Writer
Column = _Column

def __init__(self, **kwargs):
_ColumnsList.__init__(self)
Expand Down Expand Up @@ -412,7 +413,7 @@ def addColumns(self, *args):
map[colName] = value
constSet.add(value)

newCols[colName] = Column(colName, colType)
newCols[colName] = _Column(colName, colType)

# Update columns and create new Row class
self._columns.update(newCols)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# **************************************************************************
# *
# * Authors: J. M. de la Rosa Trevin ([email protected])
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# * 02111-1307 USA
# *
# * All comments concerning this program package may be sent to the
# * e-mail address '[email protected]'
# *
# **************************************************************************

try:
from StringIO import StringIO ## for Python 2
from StringIO import StringIO # for Python 2
except ImportError:
from io import StringIO ## for Python 3
from io import StringIO # for Python 3

import unittest
from metadata import Table
Expand Down
30 changes: 26 additions & 4 deletions tests/test_basic.py → emtable/tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
# **************************************************************************
# *
# * Authors: J. M. de la Rosa Trevin ([email protected])
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# * 02111-1307 USA
# *
# * All comments concerning this program package may be sent to the
# * e-mail address '[email protected]'
# *
# **************************************************************************

import sys
import os
import psutil

try:
from StringIO import StringIO ## for Python 2
from StringIO import StringIO # for Python 2
except ImportError:
from io import StringIO ## for Python 3
from io import StringIO # for Python 3
import unittest

from metadata import Table
from strings_star_relion import particles_3d_classify, one_micrograph_mc
from .strings_star_relion import particles_3d_classify, one_micrograph_mc

here = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -301,4 +324,3 @@ def read_emcore():
unittest.main()
#read_metadata()
#read_emcore()

66 changes: 66 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# **************************************************************************
# *
# * Authors: J. M. de la Rosa Trevin ([email protected])
# * Authors: Grigory Sharov ([email protected])
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# * 02111-1307 USA
# *
# * All comments concerning this program package may be sent to the
# * e-mail address '[email protected]'
# *
# **************************************************************************

"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

# Arguments marked as "Required" below must be included for upload to PyPI.
# Fields marked as "Optional" may be commented out.

setup(
name='emtable', # Required
version='0.0.7', # Required
description='Simple module to deal with EM tabular data (aka metadata)', # Required
long_description=long_description, # Optional
url='https://github.com/delarosatrevin/emtable', # Optional
author='J.M. De la Rosa Trevin', # Optional
author_email='[email protected]', # Optional
classifiers=[ # Optional
'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3'
],
keywords='electron-microscopy cryo-em structural-biology image-processing', # Optional
packages=find_packages(),
project_urls={ # Optional
'Bug Reports': 'https://github.com/delarosatrevin/emtable/issues',
'Source': 'https://github.com/delarosatrevin/emtable',
},
)

0 comments on commit b62f804

Please sign in to comment.