1
- from docker .utils .json_stream import json_decoder
2
- from omnipy import (Chain2 ,
3
- Chain3 ,
4
- convert_dataset ,
5
- Dataset ,
6
- HttpUrlDataset ,
7
- LinearFlowTemplate ,
8
- MatchItemsModel ,
9
- Model ,
10
- PandasDataset ,
11
- SplitToItemsModel ,
12
- SplitToLinesModel ,
13
- StrDataset ,
14
- TableOfPydanticRecordsModel ,
15
- TaskTemplate )
1
+ from typing import Literal
2
+
3
+ from omnipy import (Chain2 , Chain3 , convert_dataset , Dataset , HttpUrlDataset , LinearFlowTemplate ,
4
+ MatchItemsModel , Model , PandasDataset , SplitToItemsModel , SplitToLinesModel ,
5
+ TableOfPydanticRecordsModel , TaskTemplate )
16
6
from omnipy_examples .util import get_github_repo_urls
17
7
from pydantic import BaseModel , conint , constr
18
8
@@ -46,7 +36,7 @@ class BedRecordModel(BaseModel):
46
36
strand : constr (regex = '[-+\.]' ) | None
47
37
thickStart : GenomeCoord | None
48
38
thickEnd : GenomeCoord | None
49
- itemRgb : SplitOnComma2RgbColorModel | conint ( ge = 0 , le = 0 ) | None
39
+ itemRgb : SplitOnComma2RgbColorModel | Literal [ 0 ] | None
50
40
blockCount : conint (ge = 0 ) | None
51
41
blockSizes : SplitOnComma2ListOfIntsModel | None
52
42
blockStarts : SplitOnComma2ListOfIntsModel | None
@@ -66,8 +56,8 @@ class BedDataset(Dataset[BedModel]):
66
56
67
57
# Omnipy tasks
68
58
@TaskTemplate ()
69
- def fetch_bed_dataset (url_list : HttpUrlDataset ) -> StrDataset :
70
- bed_raw_dataset = StrDataset ()
59
+ def fetch_bed_dataset (url_list : HttpUrlDataset ) -> BedDataset :
60
+ bed_raw_dataset = BedDataset ()
71
61
bed_raw_dataset .load (url_list )
72
62
return bed_raw_dataset
73
63
@@ -76,7 +66,6 @@ def fetch_bed_dataset(url_list: HttpUrlDataset) -> StrDataset:
76
66
@LinearFlowTemplate (
77
67
get_github_repo_urls ,
78
68
fetch_bed_dataset ,
79
- convert_dataset .refine (name = 'parse_bed' , fixed_params = {'dataset_cls' : BedDataset }),
80
69
convert_dataset .refine (
81
70
name = 'convert_to_dataframe' , fixed_params = {'dataset_cls' : PandasDataset }),
82
71
)
@@ -89,5 +78,3 @@ def import_bed_files_to_pandas(owner: str, repo: str, branch: str, path: str,
89
78
if __name__ == '__main__' :
90
79
import_bed_files_to_pandas .run (
91
80
owner = 'arq5x' , repo = 'bedtools2' , branch = 'master' , path = 'data' , file_suffix = 'bed' )
92
-
93
- json_decoder
0 commit comments