Skip to content

Commit

Permalink
Try using pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
emjbishop committed May 30, 2024
1 parent 8e3f722 commit 277fcc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
author_email='[email protected]',
license='MIT',
packages=find_packages(),
package_data={"": ["*.csv", "*.fa"]},
include_package_data=True,
package_data={'tcrconverter': ['data/*'],},
install_requires=['pandas'])
10 changes: 3 additions & 7 deletions tcrconverter/convert.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@

import os
import pandas as pd

# Determine file location to create path for lookup table
here = os.path.dirname(__file__)
import pkg_resources

# Standard column names for different sources of TCR data
col_ref = {'tenx': ('v_gene', 'j_gene', 'cdr3'),
Expand Down Expand Up @@ -35,10 +31,10 @@ def convert_tcr(df,

# Determine if we're using the 10X lookup table
if fmt_from == 'tenx':
lookup_f = os.path.join(here, 'data/lookup_from_tenx.csv')
lookup_f = pkg_resources.resource_filename('tcrconverter', 'data/lookup_from_tenx.csv')
print("CONVERTING FROM 10X: CHOOSING *01 AS ALLELE FOR ALL GENES")
else:
lookup_f = os.path.join(here, 'data/lookup.csv')
lookup_f = pkg_resources.resource_filename('tcrconverter', 'data/lookup.csv')

# Load lookup table
try:
Expand Down

0 comments on commit 277fcc3

Please sign in to comment.