gws_gena

Introduction
Getting Started
ID Card
Use Cases
Technical documentations
Version

NetworkFile

RESOURCE
Typing name :  RESOURCE.gws_gena.NetworkFile Brick :  gws_gena
Parent :
File

Metabolic network file

File class.

/!\ The class that extend file can only have a path and file_store_id attributes. Other attributes will not be provided when creating the resource

Views
DEFAULT VIEWDefault view
View the file with automatic view
VIEW AS JSON
View the complete resource as json
NETWORK
REACTION TABLE
VIEW FILE CONTENT
View the file content as string
Functions
__init__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.

path : str - ''
add_technical_info

Add technical information on the resource. Technical info are useful to set additional information on the resource.

technical_info : TechnicalInfo
technical information to add (key, value)
check_resource

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type : Union[str, NoneType]
clone

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type : ResourceType
copy_to_directory

Copy the node to the directory and keep the same base name

destination : str
_description_
Return type : str
copy_to_path

Copy the file to the target path

destination : str
Return type : str
detect_file_encoding
default_encoding : str - utf-8
Return type : str
exists
get_base_name
Return type : str
get_default_name

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type : str
get_default_view
page : int - 1
Return type : View
get_size
Return type : int
get_technical_info

Get the technical information of the resource

key : str
key of the technical information
Return type : TechnicalInfo
get_view_by_lines
start_line : int - 1
Return type : SimpleTextView
init

This can be overwritten to perform custom initialization of the resource. This method is called just after the init (constructor) of the resource. The default values of RFields are set before this method is called.

is_csv
is_empty
Return type : bool
is_image
is_jpg
is_json
is_large
is_png
is_readable
Return type : bool
is_txt
open

Open the file

mode : str
encoding : str - None
Return type : Any
read
size : int - -1
Return type : AnyStr
read_part
from_line : int - 0
to_line : int - 10
Return type : str
write

Write in the file

data : str