Skip to content

Commit

Permalink
Merge pull request #17 from simleo/rename_package
Browse files Browse the repository at this point in the history
Rename package to biotracks
  • Loading branch information
sbesson authored May 2, 2017
2 parents b06dfe2 + 06f533b commit bd20e74
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Steps to follow to use the package:
python setup.py install
+ **step 2** - create a ``cell_track_dpkg.ini`` configuration file and place it in the same directory as your tracking file. The file must be structured as follows:
+ **step 2** - create a ``biotracks.ini`` configuration file and place it in the same directory as your tracking file. The file must be structured as follows:

.. code-block::
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions dpkg/createdp.py → biotracks/createdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import datapackage as dp
from jsontableschema import infer
import dpkg.names as names
from .names import OBJECTS_TABLE_NAME, LINKS_TABLE_NAME


def create_dpkg(top_level_dict, dict_, directory, joint_id):
Expand Down Expand Up @@ -34,7 +34,7 @@ def create_dpkg(top_level_dict, dict_, directory, joint_id):
primary_key=joint_id)

myDP.descriptor['resources'].append(
{"name": names.OBJECTS_TABLE_NAME,
{"name": OBJECTS_TABLE_NAME,
"path": path,
"schema": schema,
}
Expand All @@ -51,13 +51,13 @@ def create_dpkg(top_level_dict, dict_, directory, joint_id):
"fields": joint_id,
"reference": {
"datapackage": "",
"resource": names.OBJECTS_TABLE_NAME,
"resource": OBJECTS_TABLE_NAME,
"fields": joint_id
}
}]

myDP.descriptor['resources'].append(
{"name": names.LINKS_TABLE_NAME,
{"name": LINKS_TABLE_NAME,
"path": path,
"schema": schema,
}
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions dpkg/pushtopandas.py → biotracks/pushtopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from datapackage.pushpull import _convert_path as convert_path
import pandas as pd

import dpkg.names as names
from .names import OBJECTS_TABLE_NAME, LINKS_TABLE_NAME


def push_to_pandas(directory, object_id_cmso):
Expand All @@ -20,8 +20,8 @@ def push_to_pandas(directory, object_id_cmso):
storage = dp.push_datapackage(descriptor=descr, backend='pandas')
print(storage.buckets)

objects = storage[convert_path("objects.csv", names.OBJECTS_TABLE_NAME)]
links = storage[convert_path("links.csv", names.LINKS_TABLE_NAME)]
objects = storage[convert_path("objects.csv", OBJECTS_TABLE_NAME)]
links = storage[convert_path("links.csv", LINKS_TABLE_NAME)]

objects.reset_index(inplace=True)
print(objects.head()), print(links.head())
Expand Down
14 changes: 8 additions & 6 deletions dpkg/readfile.py → biotracks/readfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import xlrd
from xlrd import XLRDError

import dpkg.names as names
from .names import (
X_COORD_NAME, Y_COORD_NAME, FRAME_NAME, OBJECT_NAME, LINK_NAME
)


def xls_to_csv(xls_file):
Expand Down Expand Up @@ -250,10 +252,10 @@ def read_cellprofiler(cp_file, track_dict):
cp_df = pd.read_csv(cp_file)
# dictionary for the objects
objects_dict = {}
x = track_dict.get(names.X_COORD_NAME)
y = track_dict.get(names.Y_COORD_NAME)
frame = track_dict.get(names.FRAME_NAME)
obj_id = track_dict.get(names.OBJECT_NAME)
x = track_dict.get(X_COORD_NAME)
y = track_dict.get(Y_COORD_NAME)
frame = track_dict.get(FRAME_NAME)
obj_id = track_dict.get(OBJECT_NAME)
# parse the digits used for the tracking settings (e.g. 15)
digits = x.split('_')[2]
# sort the dataframe by [track_id, frame]
Expand Down Expand Up @@ -310,7 +312,7 @@ def read_cellprofiler(cp_file, track_dict):
for key, value in links_dict.items():
for object_ in value:
links_df = links_df.append([[key, object_]])
links_df.columns = [track_dict.get(names.LINK_NAME), obj_id]
links_df.columns = [track_dict.get(LINK_NAME), obj_id]

return (objects_df, links_df)

Expand Down
9 changes: 3 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
.. sample documentation master file, created by
sphinx-quickstart.
Data package representation for cell migration tracking data.

Welcome to dpkg's documentation!
==================================

Contents:
Contents
========

.. toctree::
:maxdepth: 2



Indices and tables
==================

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions scripts/create_dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import numpy as np
import pandas as pd

import dpkg.createdp as createdp
import dpkg.plot as plot
import dpkg.pushtopandas as pushtopandas
import dpkg.readfile as readfile
import dpkg.names as names
from dpkg.configuration import readConfigFile
import biotracks.createdp as createdp
import biotracks.plot as plot
import biotracks.pushtopandas as pushtopandas
import biotracks.readfile as readfile
import biotracks.names as names
from biotracks.configuration import readConfigFile

# global variable - file name from the command line
f = sys.argv[1]
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from distutils.dep_util import newer

VERSION_FILE = "VERSION"
PY_VERSION_FILE = "dpkg/version.py"
PY_VERSION_FILE = "biotracks/version.py"


def get_version_string():
Expand Down Expand Up @@ -36,13 +36,13 @@ def run(self):


setup(
name='cell_track_dpkg',
name='biotracks',
version=get_version_string(),
description='Data package representation for cell migration tracking data',
long_description=readme,
author='paola masuzzo',
author_email='[email protected]',
url='https://github.com/pcmasuzzo/cell_track_dpkg',
url='https://github.com/CellMigStandOrg/biotracks',
license="BSD",
cmdclass={"build_py": BuildPy},
classifiers=[
Expand Down
2 changes: 1 addition & 1 deletion tests/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

import dpkg
import biotracks
4 changes: 2 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dpkg.configuration import readConfigFile
from biotracks.configuration import readConfigFile
from pytest import fixture
import os

Expand All @@ -7,7 +7,7 @@
def ini_file():
directory = os.path.dirname(__file__)
return os.path.join(
directory, "test_files", "cell_track_dpkg.ini")
directory, "test_files", "biotracks.ini")


class TestReadConfigFile(object):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_readfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import os
import sys
# needed if using pytest (not needed for py.test)
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../dpkg")
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../biotracks")

from dpkg import readfile
from biotracks import readfile
from pytest import fixture
import pandas as pd

Expand Down

0 comments on commit bd20e74

Please sign in to comment.