Skip to content

Commit

Permalink
rename package (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecw authored Oct 17, 2024
1 parent 8af26a7 commit 5ad8d58
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [ "master" ]
paths:
- 'src/python/dropseq_metadata/**'
- 'src/python/dropseq_aggregation/**'


jobs:
Expand Down Expand Up @@ -44,11 +44,11 @@ jobs:
echo "use_lockfiles: false" >> ~/.mambarc
- name: Install dependencies
run: |
cd src/python/dropseq_metadata
cd src/python/dropseq_aggregation
conda env update --file environment.yml --name base
- name: Lint with flake8
run: |
cd src/python/dropseq_metadata
cd src/python/dropseq_aggregation
# Explicitly using the classic solver to avoid:
# a) "libarchive.so.20: cannot open shared object", and
Expand All @@ -65,5 +65,5 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
cd src/python/dropseq_metadata
cd src/python/dropseq_aggregation
PYTHONPATH=src python -m unittest discover -s tests
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dropseq_metadata
name: dropseq_aggregation
channels:
- conda-forge
- nodefaults
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@


def main(args=None):
parser = argparse.ArgumentParser(prog="dropseq_metadata", description=__doc__)
parser = argparse.ArgumentParser(prog="dropseq_aggregation", description=__doc__)
parser.add_argument("--log-level", "-l", default="INFO", choices=dctLogLevel.keys(),
help="Set the logging level. (default: %(default)s)")
subparsers = parser.add_subparsers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import pandas.testing

import dropseq_metadata.join_and_filter_tsv
import dropseq_aggregation.join_and_filter_tsv

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
Expand All @@ -40,7 +40,7 @@

class TestJoinAndFilterTSV(unittest.TestCase):
def setUp(self):
self.testDataDir = "../../../testdata/python/dropseq_metadata/join_and_filter_tsv"
self.testDataDir = "../../../testdata/python/dropseq_aggregation/join_and_filter_tsv"
self.tmpDir = tempfile.mkdtemp(".tmp", "join_and_filter_tsv.")
self.outputFile = os.path.join(self.tmpDir, "output.tsv")
self.options = OptionsTuple(open(self.outputFile, "w"))
Expand All @@ -53,7 +53,7 @@ def test_basic(self):
secondary = os.path.join(self.testDataDir, "sample1.100.scPred.txt")
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
self.assertSharedColumnsEqual(self.outputFile, primary)
self.assertSharedColumnsEqual(self.outputFile, secondary)

Expand All @@ -62,7 +62,7 @@ def test_fewer_secondary(self):
secondary = os.path.join(self.testDataDir, "sample1.50.scPred.txt")
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
self.assertSharedColumnsEqual(self.outputFile, primary)
self.assertSharedColumnsEqual(self.outputFile, secondary, wideRows=49)

Expand All @@ -71,7 +71,7 @@ def test_fewer_primary(self):
secondary = os.path.join(self.testDataDir, "sample1.100.scPred.txt")
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
self.assertSharedColumnsEqual(self.outputFile, primary)
self.assertSharedColumnsEqual(self.outputFile, secondary, narrowRows=49)

Expand All @@ -82,7 +82,7 @@ def test_additional_join(self):
options = self.options._replace(input=open(primary),
join=[(secondary1, "CELL_BARCODE", "CELL_BARCODE"),
(secondary2, "DONOR", "DONOR")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
self.assertSharedColumnsEqual(self.outputFile, primary)
self.assertSharedColumnsEqual(self.outputFile, secondary1)
self.assertMultiJoin(self.outputFile, secondary2, "DONOR", "DONOR")
Expand All @@ -94,7 +94,7 @@ def test_set(self):
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")],
set=setTuples)
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
for column, value in setTuples:
self.assertTrue((outputDf[column] == value).all())
Expand All @@ -107,7 +107,7 @@ def test_min(self):
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")],
min=[("max.prob", "0.8")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
self.assertTrue((outputDf["max.prob"] >= 0.8).all())
primaryDf = pd.read_csv(primary, sep='\t')
Expand All @@ -119,7 +119,7 @@ def test_max(self):
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")],
max=[("max.prob", "0.8")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
self.assertTrue((outputDf["max.prob"] <= 0.8).all())
primaryDf = pd.read_csv(primary, sep='\t')
Expand All @@ -130,7 +130,7 @@ def test_include_file(self):
includeFile = os.path.join(self.testDataDir, "donor_subset.txt")
options = self.options._replace(input=open(primary),
include_file=[("DONOR", includeFile)])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
includeValues = pd.read_csv(includeFile, sep='\t', header=None).iloc[0]
self.assertTrue((outputDf["DONOR"].isin(includeValues)).all())
Expand All @@ -140,7 +140,7 @@ def test_exclude_file(self):
excludeFile = os.path.join(self.testDataDir, "donor_subset.txt")
options = self.options._replace(input=open(primary),
exclude_file=[("DONOR", excludeFile)])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
excludeValues = pd.read_csv(excludeFile, sep='\t', header=None).iloc[0]
self.assertFalse((outputDf["DONOR"].isin(excludeValues)).any())
Expand All @@ -152,7 +152,7 @@ def test_include_exclude(self):
options = self.options._replace(input=open(primary),
include=[["DONOR"] + donorsToInclude],
exclude=[["predClass"] + predClassesToExclude])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
self.assertTrue((outputDf["DONOR"].isin(donorsToInclude)).all())
self.assertFalse((outputDf["predClass"].isin(predClassesToExclude)).any())
Expand All @@ -162,13 +162,13 @@ def test_negative_non_unique_join(self):
secondary = os.path.join(self.testDataDir, "sample1.nonunique.scPred.txt")
options = self.options._replace(input=open(primary),
join=[(secondary, "CELL_BARCODE", "CELL_BARCODE")])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 1)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 1)

def test_boolean(self):
primary = os.path.join(self.testDataDir, "sample1.100.cell_metadata.txt")
options = self.options._replace(input=open(primary),
exclude=[["doublet", "true"]])
self.assertEqual(dropseq_metadata.join_and_filter_tsv.main(options), 0)
self.assertEqual(dropseq_aggregation.join_and_filter_tsv.main(options), 0)
outputDf = pd.read_csv(self.outputFile, sep='\t')
self.assertFalse(outputDf["doublet"].any())

Expand Down

0 comments on commit 5ad8d58

Please sign in to comment.