cirro.sdk.reference
1from typing import List 2 3from cirro_api_client.v1.models import Reference 4 5from cirro.cirro_client import CirroApi 6from cirro.models.file import File 7from cirro.sdk.asset import DataPortalAssets, DataPortalAsset 8from cirro.sdk.file import DataPortalFile 9 10 11class DataPortalReference(DataPortalAsset): 12 """ 13 Reference data object containing files which can be used for analysis in a particular project. 14 """ 15 def __init__(self, ref: Reference, project_id: str, client: CirroApi): 16 """ 17 Instantiate by listing the references which have been added to a particular project 18 ```python 19 from cirro import DataPortal() 20 portal = DataPortal() 21 project = portal.get_project_by_name("Project Name") 22 references = project.list_references() 23 ``` 24 """ 25 self._data = ref 26 self._files = [ 27 DataPortalFile(File.from_file_entry(f, project_id), client) for f in ref.files 28 ] 29 30 @property 31 def files(self) -> List[DataPortalFile]: 32 """File(s) contained in the reference""" 33 return self._files 34 35 @property 36 def name(self) -> str: 37 """Reference name""" 38 return self._data.name 39 40 @property 41 def type(self) -> str: 42 """Type of reference data (e.g. genome_fasta)""" 43 return self._data.type 44 45 @property 46 def absolute_path(self): 47 if len(self._files) == 0: 48 return None 49 return self._files[0].absolute_path 50 51 def __str__(self): 52 return self.name 53 54 55class DataPortalReferences(DataPortalAssets[DataPortalReference]): 56 """Collection of DataPortalReference objects.""" 57 asset_name = "reference" 58 59 def get_by_id(self, _id: str) -> DataPortalReference: 60 raise NotImplementedError("Filtering by ID is not supported, use get_by_name")
12class DataPortalReference(DataPortalAsset): 13 """ 14 Reference data object containing files which can be used for analysis in a particular project. 15 """ 16 def __init__(self, ref: Reference, project_id: str, client: CirroApi): 17 """ 18 Instantiate by listing the references which have been added to a particular project 19 ```python 20 from cirro import DataPortal() 21 portal = DataPortal() 22 project = portal.get_project_by_name("Project Name") 23 references = project.list_references() 24 ``` 25 """ 26 self._data = ref 27 self._files = [ 28 DataPortalFile(File.from_file_entry(f, project_id), client) for f in ref.files 29 ] 30 31 @property 32 def files(self) -> List[DataPortalFile]: 33 """File(s) contained in the reference""" 34 return self._files 35 36 @property 37 def name(self) -> str: 38 """Reference name""" 39 return self._data.name 40 41 @property 42 def type(self) -> str: 43 """Type of reference data (e.g. genome_fasta)""" 44 return self._data.type 45 46 @property 47 def absolute_path(self): 48 if len(self._files) == 0: 49 return None 50 return self._files[0].absolute_path 51 52 def __str__(self): 53 return self.name
Reference data object containing files which can be used for analysis in a particular project.
DataPortalReference( ref: cirro_api_client.v1.models.Reference, project_id: str, client: cirro.CirroApi)
16 def __init__(self, ref: Reference, project_id: str, client: CirroApi): 17 """ 18 Instantiate by listing the references which have been added to a particular project 19 ```python 20 from cirro import DataPortal() 21 portal = DataPortal() 22 project = portal.get_project_by_name("Project Name") 23 references = project.list_references() 24 ``` 25 """ 26 self._data = ref 27 self._files = [ 28 DataPortalFile(File.from_file_entry(f, project_id), client) for f in ref.files 29 ]
Instantiate by listing the references which have been added to a particular project
from cirro import DataPortal()
portal = DataPortal()
project = portal.get_project_by_name("Project Name")
references = project.list_references()
files: List[cirro.sdk.file.DataPortalFile]
31 @property 32 def files(self) -> List[DataPortalFile]: 33 """File(s) contained in the reference""" 34 return self._files
File(s) contained in the reference
class
DataPortalReferences(cirro.sdk.asset.DataPortalAssets[cirro.sdk.reference.DataPortalReference]):
56class DataPortalReferences(DataPortalAssets[DataPortalReference]): 57 """Collection of DataPortalReference objects.""" 58 asset_name = "reference" 59 60 def get_by_id(self, _id: str) -> DataPortalReference: 61 raise NotImplementedError("Filtering by ID is not supported, use get_by_name")
Collection of DataPortalReference objects.
60 def get_by_id(self, _id: str) -> DataPortalReference: 61 raise NotImplementedError("Filtering by ID is not supported, use get_by_name")
Return the item which matches by id attribute.
Inherited Members
- builtins.list
- clear
- copy
- append
- insert
- extend
- pop
- remove
- index
- count
- reverse
- sort