forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request galaxyproject#17462 from bernt-matthias/topic/fast…
…a-set-meta Faster FASTA and FASTQ metadata setting
- Loading branch information
Showing
3 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../test-data/1.fasta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import pytest | ||
|
||
from galaxy.datatypes.sequence import ( | ||
Fasta, | ||
FastqSanger, | ||
FastqSolexa, | ||
) | ||
from .util import ( | ||
get_dataset, | ||
MockDatasetDataset, | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_file", | ||
[ | ||
"1.fasta", | ||
"1.fasta.gz", | ||
], | ||
) | ||
def test_fasta_set_meta(input_file): | ||
b = Fasta() | ||
with get_dataset("1.fasta") as dataset: | ||
b.set_meta(dataset=dataset) | ||
assert dataset.metadata.data_lines == 2 | ||
assert dataset.metadata.sequences == 1 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"fastq_type,input_file", | ||
[ | ||
[FastqSanger, "1.fastqsanger"], | ||
[FastqSanger, "1.fastqsanger.gz"], | ||
[FastqSanger, "1.fastqsanger.bz2"], | ||
[FastqSolexa, "1.fastqssolexa"], | ||
], | ||
) | ||
def test_fastqsanger_set_meta(fastq_type, input_file): | ||
b = fastq_type() | ||
with get_dataset("1.fastqsanger") as dataset: | ||
dataset.dataset = MockDatasetDataset(dataset.get_file_name()) | ||
b.set_meta(dataset=dataset) | ||
assert dataset.metadata.data_lines == 8 | ||
assert dataset.metadata.sequences == 2 |