mdvtools.mdvproject
Module Contents
Classes
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Attributes
- class mdvtools.mdvproject.MDVProject(dir, delete_existing=False)[source]
-
- set_interactions(interaction_ds, parent_ds, pivot_column='sample_id', parent_column='annotation', is_single_region=True, interaction_columns=['Cell Type 1', 'Cell Type 2'], default_parameter='Cross PCF gr20', node_size='cell 1 number', add_view=True)[source]
- set_column_with_raw_data(datasource, column, raw_data)[source]
Adds or updates a column with raw data :param datasource: The name of the datasource. :type datasource: str :param column: The complete metadata for the column :type column: dict :param raw_data: The raw binary data for the column :type raw_data: list|array
- set_column(datasource, column, data)[source]
Adds (or replaces an existing column) with the data supplied
- Parameters:
datasource (str) – The name of the datasource.
column (str|dict) – metadata for the column. Can be a string with the column’s name, although datatype should also be included as the inferred datatype is not always correct
raw_data (list|array) – Anything that can be converted into a pandas Series
order (The data should be in the correct) –
- remove_column(datasource, column)[source]
Removes the specified column
- Parameters:
datasource (str) – The name of the data source.
column (str) – The id (field) of the column.
- add_annotations(datasource, data, separator='\t', missing_value='ND', columns=None, supplied_columns_only=False)[source]
Adds annotations based on an existing column
- Parameters:
datasource (str) – The name of the data source.
data (dataframe|str) – Either a pandas dataframe or a text file. The first column should be the ‘index’ column and match a column in the datasource. The other columns should contain the annotations to add.
separator (str,optional) – The delimiter if a text file is supplied (tab by default)
missing_value (str,optional) – The value to put if the index value is missing in the input data. Default is ‘ND’
- set_column_group(datasource, groupname, columns)[source]
Adds (or changes) a column group
- Parameters:
datasource (string) – The name of the datasource
groupname (string) – The name of the column group
columns (list) – The field names of columns in the group. If None, then the column group will be removed
- add_datasource(name, dataframe, columns=None, supplied_columns_only=False, replace_data=False, add_to_view='default', separator='\t')[source]
Adds a pandas dataframe to the project. Each column’s datatype, will be deduced by the data it contains, but this is not always accurate. Hence, you can supply a list of column metadata, which will override the names/types deduced from the dataframe.
- Parameters:
name (string) – The name of datasource
dataframe (dataframe|str) – Either a pandas dataframe or the path of a text file
columns (list, optional) – A list of objects containing the column name and datatype. e.g. [{“name”:”column_1”,”datatype”:”double”},]. If you want the column to have a different label, the object requires a field (the column name in the dataframe) and a name (the label seen by the user) e.g. {“field”:”column_1”,”datatype”:”double”,”name”:”My Column 1”}
supplied_columns_only (bool, optional) – If True, only the the subset of columns in the columns argument will be added to the datasource. Default is False
replace_data (bool, optional) – If True, the existing datasource will be overwritten, Default is False, in which case, trying to add a datasource which already exists, will throw an error.
add_to_view (string, optional) – The datasource will be added to the specified view. The view will be created if it does not exist. The default is ‘default’. If None, then it will not be added to a view.
separator (str, optional) – If a path to text file is supplied, then this should be the file’s delimiter. Defaults to a tab.
- add_rows_as_columns_subgroup(row_ds, col_ds, stub, data, name=None, label=None, sparse=False)[source]
- add_image_set(datasource, setname, column, folder, type='png')[source]
Adds a set of images to a datasource. The images should be in a folder, with the same name as the column :param datasource: The name of the datasource. :type datasource: str :param column: The name of the column. :type column: str :param folder: The path to the folder containing the images. :type folder: str