from iza.static import AMAZON_BUCKET_FLUENTBIO
= ArchiveDownloader(
downloader = AMAZON_BUCKET_FLUENTBIO,
rootdir = 'public-datasets/pbmc/',
archive = ['combined.html', 'filtered_matrix.tar.gz'],
entries = '~/Downloads/fluent_bio', extract=True, cleanup=True
savedir
) downloader.execute()
utils
Utils
This notebook was generated from _00_utils.ipynb)
Basic Utils
arein
arein (vals:Iterable, refs:Iterable)
isin
isin (val:Any, vals:Iterable)
allsametype
allsametype (vals:Any)
allinstance
allinstance (vals:Any, dtype:Union[Type,TypeAlias]=typing.Any)
isiter
isiter (val:Any)
str_part_end
str_part_end (s:str, sep:Optional[str]=' ')
str_part_mid
str_part_mid (s:str, sep:Optional[str]=' ')
str_part_pre
str_part_pre (s:str, sep:Optional[str]=' ')
str_split_get
str_split_get (s:str, sep:str='_', idx:int=0)
strip_punc
strip_punc (s:str)
str_just_numeric
str_just_numeric (s:str)
Filters a string for just numeric values
str_just_alpha
str_just_alpha (s:str)
Filters a string for just alpha values
Argument and Key-Word Argument Wrangling
get_func_params
get_func_params (fn:Callable, drop_self:Optional[bool]=True, drop_before:Optional[int]=0, drop_idxs:Optional[List[int]]=[], drop_names:Optional[List[str]]=[], drop_after:Optional[int]=None)
wrangle_kwargs_for_class
wrangle_kwargs_for_class (cls:Callable, defaults:Optional[dict]=None, **kwargs:Optional[dict])
wrangle_kwargs_for_func
wrangle_kwargs_for_func (fn:Callable, defaults:Optional[dict]=None, **kwargs:Optional[dict])
filter_kwargs_for_class
filter_kwargs_for_class (cls:Callable, **kwargs:Optional[dict])
filter_kwargs_for_func
filter_kwargs_for_func (fn:Callable, **kwargs:Optional[dict])
copy_to_clipboard
copy_to_clipboard (text:str)
Files
This notebook was generated from _01_files.ipynb)
PathLib Interoperabliilty
sort_directory_first
sort_directory_first (path:Union[pathlib.Path,pathlib.PosixPath])
sort_file_first
sort_file_first (path:Union[pathlib.Path,pathlib.PosixPath])
to_abs_expanded
to_abs_expanded (dirname:Union[str,pathlib.Path,pathlib.PosixPath,NoneTy pe]=None)
path_to_str
path_to_str (path:Union[pathlib.Path,pathlib.PosixPath])
Convert a pathlib.Path object to a string
str_to_path
str_to_path (path:str)
Convert a string to a pathlib.Path object
is_path
is_path (path:Any, existance:Optional[bool])
Check if the input is a path
is_pathlike
is_pathlike (path:Any)
Check if the input is a path
is_pathlib
is_pathlib (path:Any)
Check if the input is a path
User Utils
collapse_user
collapse_user (path:str)
get_user
get_user ()
Extensions
drop_ext
drop_ext (filename:str, extension:Optional[str]=None)
check_ext
check_ext (filename:str, extension:str)
is_tarball
is_tarball (filename:str)
is_targz
is_targz (filename:str)
is_gz
is_gz (filename:str)
is_tar
is_tar (filename:str)
get_gz_files_in_dir
get_gz_files_in_dir (dirname:str)
filter_for_gz_files
filter_for_gz_files (files:List[str])
Decompression
undo_gz
undo_gz (filename:str, remove:bool=False)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Notes
else: warn(msg)
decompress_gunzip
decompress_gunzip (filename:str, remove:bool=False)
Type | Default | Details | |
---|---|---|---|
filename | str | ||
remove | bool | False | |
Returns | Tuple | The name of the decompressed file e.g. ~/Downloads/fluentbio.tsv.gz wouldyield ~/Downloads/fluentbio.tsv |
decompress_tarball
decompress_tarball (filename:str, remove:bool=False)
Type | Default | Details | |
---|---|---|---|
filename | str | ||
remove | bool | False | |
Returns | Tuple | The name of the archive e.g. ~/Downloads/fluentbio.tar.gz wouldyield ~/Downloads/fluentbio |
RecursiveDecompressor
RecursiveDecompressor (dirname:Union[pathlib.Path,pathlib.PosixPath], entries:Optional[List[str]]=<factory>, strategy:Op tional[Callable[[str,bool],str]]=<function undo_gz>, remove:Optional[bool]=True, progress:Optional[Any]=None)
Directories
dir_dirs
dir_dirs (dirname:str)
make_missing_dirs
make_missing_dirs (dirs:List[str])
decompress_tarball_of_gunzipped_files
decompress_tarball_of_gunzipped_files (filename:str, desc:Optional[str]=None, remove:Optional[bool]=False)
decompress_directory_of_gunzipped_files
decompress_directory_of_gunzipped_files (dirname:str, desc:Optional[str]=None, remove:Optional[bool]=False)
Streaming
stream_file
stream_file (uri:str, filename:Optional[str]=None, desc:Optional[str]=None)
Type | Default | Details | |
---|---|---|---|
uri | str | The URI to download | |
filename | Optional | None | The fullpath name of the file to download. Defaults to ~/Downloads/os.path.basename(uri) . |
desc | Optional | None | The description of the tqdm progress bar. Defaults to os.path.basename(uri) . |
Returns | None |
Downloads
download_and_decompress_tarball_of_gunzipped_files
download_and_decompress_tarball_of_gunzipped_files (uri:str, download_dir:str=None , desc:Optional[str]= None, remove:Optional [bool]=False)
Temporary Files
make_temp_file
make_temp_file (**kwargs:Any)
URLs
urljoin
urljoin (*parts:str)
Slice
This notebook was generated from _02_slice.ipynb)
Slice
Helps convert slices
to its numeric values
Slice
Slice (slc:slice=<factory>)
A class for representing a slice and providing conversion to other formats.
Director
This notebook was generated from _03_directory.ipynb)
Directory Viewer
Default Functions
Init Tree
init_tree
init_tree (dirname)
rich_init_tree
rich_init_tree (dirname)
base_init_tree
base_init_tree (dirname:str)
Walked Entry to Str
entry_fn
entry_fn (path:pathlib.Path, prefix:str='', pointer:str='', suffix:str='')
rich_entry_fn
rich_entry_fn (path:pathlib.Path, prefix:str='', pointer:str='', suffix:str='')
base_entry_fn
base_entry_fn (path:pathlib.Path, prefix:str='', pointer:str='', suffix:str='')
Walk Function
walk_dir_tree
walk_dir_tree (dirname:Union[str,pathlib.Path,pathlib.PosixPath], prefix:str='', hidden:Optional[bool]=False, tree:Optional[rich.tree.Tree]=None, entry_fn:Callable[[For wardRef('PathLike'),Optional[str],Optional[str],Optional[s tr]],str]=<function entry_fn>)
A recursive generator, given a directory Path object will yield a visual tree structure line by line with each line prefixed by the same characters Notes —– Adapted from https://stackoverflow.com/a/59109706/5623899
DirectoryTree
walks through directory
DirectoryTree
DirectoryTree (dirname:str, hidden:Optional[bool]=False, entry_fn:Optiona l[Callable[[ForwardRef('PathLike'),Optional[str],Optional[ str],Optional[str]],str]]=<function entry_fn>)
RichDirectory
RichDirectory (dirname:str, hidden:Optional[bool]=False, entry_fn:Optiona l[Callable[[ForwardRef('PathLike'),Optional[str],Optional[ str],Optional[str]],str]]=<function entry_fn>, console:Optional[rich.console.Console]=<factory>)
Directory
Directory (dirname:Union[str,pathlib.Path,pathlib.PosixPath], hidden:Optional[bool]=False, entry_fn:Optional[Callable[[Forwa rdRef('PathLike'),Optional[str],Optional[str],Optional[str]],s tr]]=<function entry_fn>)
Filter matrix director
This notebook was generated from _04_filter_matrix_directory.ipynb)
Filter Matrix Directory Viewer
Guards
This notebook was generated from _05_guards.ipynb)
Guards
Numpy and Pandas
is_np
is_np (arr_q:Union[list,pandas.core.series.Series,numpy.ndarray,Iterable[ numbers.Number],Any,List[int],List[Union[bool,numpy.bool_,Literal[ 0],Literal[1]]],pandas.core.indexes.base.Index])
Checks whether or not arr_q
is a ndarray
Type | Details | |
---|---|---|
arr_q | Union | object to check whether or not it is a SeriesLike. |
Returns | bool |
is_series_like
is_series_like (series_q:Union[list,pandas.core.series.Series,numpy.ndarr ay,Iterable[numbers.Number],Any,List[int],List[Union[bool ,numpy.bool_,Literal[0],Literal[1]]],pandas.core.indexes. base.Index])
Checks whether or not series_q
is SeriesLike i.e. something that is probably data.
Type | Details | |
---|---|---|
series_q | Union | object to check whether or not it is a SeriesLike. |
Returns | bool |
is_series
is_series (arr:Union[list,pandas.core.series.Series,numpy.ndarray,Iterabl e[numbers.Number],Any,List[int],List[Union[bool,numpy.bool_,Li teral[0],Literal[1]]],pandas.core.indexes.base.Index])
Checks whether or not arr
is a pd.Series
Type | Details | |
---|---|---|
arr | Union | object to check whether or not it is a pd.Series. |
Returns | bool |
undo_npmatrix
undo_npmatrix (arr:Union[list,pandas.core.series.Series,numpy.ndarray,Ite rable[numbers.Number],Any,List[int],List[Union[bool,numpy. bool_,Literal[0],Literal[1]]],pandas.core.indexes.base.Ind ex])
Given a tensor converts it to a numpy array
Type | Details | |
---|---|---|
arr | Union | |
Returns | Union |
is_matrix
is_matrix (arr:Union[list,pandas.core.series.Series,numpy.ndarray,Iterabl e[numbers.Number],Any,List[int],List[Union[bool,numpy.bool_,Li teral[0],Literal[1]]],pandas.core.indexes.base.Index])
Checks whether or not arr
is a np.matrix
Type | Details | |
---|---|---|
arr | Union | object to check whether or not it is a np.matrix. |
Returns | bool |
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section See Also
else: warn(msg)
is_torch
is_torch (tensor_q:Union[list,pandas.core.series.Series,numpy.ndarray,Ite rable[numbers.Number],Any,List[int],List[Union[bool,numpy.bool_ ,Literal[0],Literal[1]]],pandas.core.indexes.base.Index])
Alias for is_tensor
.
Type | Details | |
---|---|---|
tensor_q | Union | object to check whether or not it is a pytorch tensor |
Returns | bool |
is_tensor
is_tensor (tensor_q:Union[list,pandas.core.series.Series,numpy.ndarray,It erable[numbers.Number],Any,List[int],List[Union[bool,numpy.boo l_,Literal[0],Literal[1]]],pandas.core.indexes.base.Index])
Checks whether or not tensor_q
is a pytorch tensor
Type | Details | |
---|---|---|
tensor_q | Union | object to check whether or not it is a pytorch tensor |
Returns | bool |
is_mps
is_mps (tensor:Union[Iterable[numbers.Number],Any])
Checks whether or not tensor
is on cpu
Type | Details | |
---|---|---|
tensor | Union | object to check whether or not it is on cpu. |
Returns | bool |
is_cpu
is_cpu (tensor:Union[Iterable[numbers.Number],Any])
Checks whether or not tensor
is on cpu
Type | Details | |
---|---|---|
tensor | Union | object to check whether or not it is on cpu. |
Returns | bool |
is_device
is_device (device_q:Union[str,NoneType,Any])
Checks whether or not device_q
is a valid pytorch device type.
Type | Details | |
---|---|---|
device_q | Union | object to check whether or not it is a pytorch device. |
Returns | bool |
to_ndarray
to_ndarray (arr)
undo_sparse
undo_sparse (arr:Union[list,pandas.core.series.Series,numpy.ndarray,Itera ble[numbers.Number],Any,List[int],List[Union[bool,numpy.bool _,Literal[0],Literal[1]]],pandas.core.indexes.base.Index])
Given a arr tries to make it a dense array
Type | Details | |
---|---|---|
arr | Union | |
Returns | Union |
Torch utils
This notebook was generated from _06_torch_utils.ipynb)
Torch Utils
Adata
This notebook was generated from _07_adata.ipynb)
Adata
AdataExtractor
AdataExtractor (adata:Any, layer:Optional[str]='X_magic', x_emb:Optional[str]='X_phate', dim_str:Optional[str]=None, use_hvg:Optional[bool]=True)
Ex
This notebook was generated from _09_exp.ipynb)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Arguments:
else: warn(msg)
find_exps
find_exps (path, params)
is_config_subset
is_config_subset (truth, params)
setup_exp
setup_exp (path, params, name=None)
save_exp_params
save_exp_params (path, params, logger=None)
load_exp_params
load_exp_params (path)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: potentially wrong underline length...
Returns:
---------- in
Returns:
----------...
else: warn(msg)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Returns:
else: warn(msg)
gen_exp_name
gen_exp_name (name=None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: potentially wrong underline length...
Notes:
---------- in
Notes:
----------...
else: warn(msg)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Notes:
else: warn(msg)
list_exps
list_exps (path)
exp_param_filename
exp_param_filename (path)
exp_log_filename
exp_log_filename (path)
config_exp_logger
config_exp_logger (path)
Archive
This notebook was generated from _10_archive.ipynb)
Directory Viewer
Archive Downloader
Directory
defined in_02_utils/_03_directory.ipynb
ConsoleType
defined in_02_utils/_03_directory.ipynb
get_console
imported in_02_utils/_03_directory.ipynb
is_rich_available
defined in_02_utils/_08_archive.ipynb
urljoin
defined in_02_utils/_01_files.ipynb
parse_url
imported in_02_utils/_01_files.ipynb
ArchiveDownloader
ArchiveDownloader (rootdir:str, archive:str, entries:Union[str,list[str]], savedir:str, extract:bool=False, cleanup:bool=False, compound_archive:bool=False, archives:Optional[list[str]]=None, console:Optional[rich.console.Console]=None, progress:Optional[rich.progress.Progress]=None)