Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore stdin #17

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include LICENSE
include ChangeLog.md
include Makefile
include pyproject.toml
include cli_test.sh

graft micov
graft ci
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

test:
pytest micov

bash cli_test.sh
lint:
ruff check micov setup.py
check-manifest
8 changes: 8 additions & 0 deletions cli_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
xzcat micov/tests/test_data/test.sam.xz | micov compress > from_stdin
micov compress --data micov/tests/test_data/test.sam.xz > from_args
cmp --silent <(sort from_stdin) <(sort from_args)
if [[ $? -ne 0 ]]; then
echo "Files are different"
exit 1
fi
3 changes: 1 addition & 2 deletions micov/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
import io
import sys
import tqdm
from glob import glob
from ._io import (parse_genome_lengths, parse_taxonomy, set_taxonomy_as_id,
parse_qiita_coverages, parse_sam_to_df, write_qiita_cov,
Expand Down Expand Up @@ -105,7 +104,7 @@ def compress(data, output, disable_compression, lengths, taxonomy):
if taxonomy is not None:
taxonomy = parse_taxonomy(taxonomy)

if os.path.isdir(data):
if data is not None and os.path.isdir(data):
file_list = (glob(data + "/*.sam")
+ glob(data + '/*.sam.xz')
+ glob(data + '/*.sam.gz'))
Expand Down
4 changes: 2 additions & 2 deletions micov/tests/test_cov.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from micov._cov import compress, coverage_percent
from micov._constants import (BED_COV_SCHEMA, COLUMN_GENOME_ID,
GENOME_LENGTH_SCHEMA,
GENOME_LENGTH_SCHEMA, COLUMN_START,
GENOME_COVERAGE_SCHEMA)
import polars as pl
import polars.testing as plt
Expand All @@ -28,7 +28,7 @@ def test_compress(self):
['G456', 400, 500]],
orient='row',
schema=BED_COV_SCHEMA.dtypes_flat)
obs = compress(data).sort(COLUMN_GENOME_ID)
obs = compress(data).sort(COLUMN_GENOME_ID).sort(COLUMN_START)
plt.assert_frame_equal(obs, exp)

def test_coverage_percent(self):
Expand Down
Empty file.
Binary file added micov/tests/test_data/test.sam.xz
Binary file not shown.
Loading