From f94017c2f1aac3dd7cd13f21bcf1844001872cee Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Wed, 22 May 2024 11:27:34 +0200
Subject: [PATCH] Add to comments

---
 src/bioflowinsighterror.py |  9 +++++++
 src/channel.py             | 52 ++++++++++++++++++++++++++++++++++++++
 src/workflow.py            | 50 ++++++++++++++++++------------------
 3 files changed, 86 insertions(+), 25 deletions(-)

diff --git a/src/bioflowinsighterror.py b/src/bioflowinsighterror.py
index 0dfc769..e5936fa 100644
--- a/src/bioflowinsighterror.py
+++ b/src/bioflowinsighterror.py
@@ -1,5 +1,14 @@
 # creating a custom exception
 class BioFlowInsightError(Exception):
+    """
+    This is the custom BioFlow-Insight error class, from this class, errors can be made.
+
+    Attributes:
+        error: A string indicating the error message to the user
+        num: An integers indicating the type of error (see below)
+        origin: A "Nextflow Building Bloc" derived type object, from this the file address can be given to the user
+        
+    """
     def __init__(self, error, num, origin = None):
         self.origin = origin
         #TODO -> add message at the end
diff --git a/src/channel.py b/src/channel.py
index 244cef9..fecaa77 100644
--- a/src/channel.py
+++ b/src/channel.py
@@ -1,7 +1,18 @@
+#Import dependencies
+#Local
 from .nextflow_building_blocks import Nextflow_Building_Blocks
 from .bioflowinsighterror import BioFlowInsightError
 
 class Channel(Nextflow_Building_Blocks):
+    """
+    This is the channel class, from this class, channels can be made and manipulated.
+
+    Attributes:
+        name: A string indicating the error message to the user
+        origin: A "Nextflow Building Bloc" derived type object, indicating from what the channel originated from 
+        
+    """
+
     def __init__(self, name, origin):
         self.name = name
         self.origin = origin
@@ -13,36 +24,77 @@ class Channel(Nextflow_Building_Blocks):
 
 
     def get_code(self):
+        """Method that returns the channels code
+
+        Keyword arguments:
+        
+        """
         return self.name.strip()
 
     def add_source(self, source):
+        """Method that adds an element to the channel's source
+
+        Keyword arguments:
+            source: element which is gonna be added to the list of sources
+        """
         self.source.append(source)
 
     def add_sink(self, sink):
+        """Method that adds an element to the channel's sink
+
+        Keyword arguments:
+            sink: element which is gonna be added to the list of sinks
+        """
         self.sink.append(sink)
 
     def set_sink_null(self):
+        """Method that sets the channel's sink to an empty list
+        """
         self.sink = []
 
     def get_type(self):
+        """Method that returns the channel's type which is "Channel"
+        """
         return "Channel"
 
     def equal(self, channel):
+        """Method that checks if two channels are equal
+
+        Keyword arguments:
+            channel: element (preferably of channel type) which is gonna be tested against the channel
+        """
         return (self.name==channel.name and self.origin==self.origin)
     
     def get_source(self):
+        """Method that returns the channel's sources
+        """
         return self.source
 
     def remove_element_from_sink(self, ele):
+        """Method that removes an element from the channel's sink
+
+        Keyword arguments:
+            channel: element which is gonna be removed
+        """
         self.sink.remove(ele)
 
     def get_sink(self):
+        """Method that returns the channel's sink
+        """
         return self.sink
     
     def get_name(self):
+        """Method that returns the channel's name
+        """
         return self.name
     
     def get_structure(self, dico, B):
+        """Method that adds the channel to the structure 
+
+        Keyword arguments:
+            dico: dictionnary which is decribing the workflow strutcure
+            B: element which should be connected to the channel, so that for every source element in the channels source, there is source->B
+        """
         for source in self.get_source():
             dico["edges"].append({'A':str(source), 'B':str(B), "label":self.get_name()})
 
diff --git a/src/workflow.py b/src/workflow.py
index 7e0243e..c3b6dae 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -90,7 +90,7 @@ class Workflow:
         self.get_dico()
 
     def get_repo_adress(self):
-        """Function that returns the adress of the workflow repository 
+        """Method that returns the adress of the workflow repository 
 
         Keyword arguments:
         
@@ -102,7 +102,7 @@ class Workflow:
         return repo
 
     def get_processes_annotation(self):
-        """Function the dictionnary of the process annotations
+        """Method the dictionnary of the process annotations
 
         Keyword arguments:
         
@@ -110,7 +110,7 @@ class Workflow:
         return self.processes_annotation
 
     def fill_log(self):
-        """Function that reads the git log and saves it
+        """Method that reads the git log and saves it
 
         Keyword arguments:
         
@@ -127,7 +127,7 @@ class Workflow:
         os.chdir(current_directory)
 
     def get_address(self):
-        """Function that returns the adress of the workflow main
+        """Method that returns the adress of the workflow main
 
         Keyword arguments:
         
@@ -135,7 +135,7 @@ class Workflow:
         return self.address
 
     def set_address(self):
-        """Function that sets the adress of the workflow main
+        """Method that sets the adress of the workflow main
 
         Keyword arguments:
         
@@ -154,7 +154,7 @@ class Workflow:
             self.address = match.group(1)
 
     def get_dico(self):
-        """Function that returns a dictionnary containg information regarding the github repository
+        """Method that returns a dictionnary containg information regarding the github repository
 
         Keyword arguments:
         
@@ -174,7 +174,7 @@ class Workflow:
 
 
     def get_name(self):
-        """Function that returns the name of the workflow
+        """Method that returns the name of the workflow
 
         Keyword arguments:
         
@@ -187,7 +187,7 @@ class Workflow:
     #Format yyyy-mm-dd
     #Here i return the first commit date
     def get_datePublished(self):
-        """Function that returns the date of publication
+        """Method that returns the date of publication
 
         Keyword arguments:
         
@@ -203,7 +203,7 @@ class Workflow:
         
 
     def get_description(self):
-        """Function that returns the description
+        """Method that returns the description
 
         Keyword arguments:
         
@@ -220,7 +220,7 @@ class Workflow:
     
 
     def get_main_file(self):
-        """Function that returns the name of the main file
+        """Method that returns the name of the main file
 
         Keyword arguments:
         
@@ -229,7 +229,7 @@ class Workflow:
 
 
     def get_license(self):
-        """Function that returns the license
+        """Method that returns the license
 
         Keyword arguments:
         
@@ -254,7 +254,7 @@ class Workflow:
 
 
     def get_authors(self):
-        """Function that returns a list of the authors
+        """Method that returns a list of the authors
 
         Keyword arguments:
         
@@ -278,7 +278,7 @@ class Workflow:
 
     #Need to follow this format : "rna-seq, nextflow, bioinformatics, reproducibility, workflow, reproducible-research, bioinformatics-pipeline"
     def get_keywords(self):
-        """Function that returns the keywords
+        """Method that returns the keywords
 
         Keyword arguments:
         
@@ -295,7 +295,7 @@ class Workflow:
     
 
     def get_producer(self):
-        """Function that returns the producer
+        """Method that returns the producer
 
         Keyword arguments:
         
@@ -311,7 +311,7 @@ class Workflow:
     
 
     def get_publisher(self):
-        """Function that returns the publisher
+        """Method that returns the publisher
 
         Keyword arguments:
         
@@ -322,7 +322,7 @@ class Workflow:
             return None
     
     def get_output_dir(self):
-        """Function that returns the output directory
+        """Method that returns the output directory
 
         Keyword arguments:
         
@@ -330,7 +330,7 @@ class Workflow:
         return self.nextflow_file.get_output_dir()
 
     def get_file_address(self):
-        """Function that returns the adress of the workflow main
+        """Method that returns the adress of the workflow main
 
         Keyword arguments:
         
@@ -343,7 +343,7 @@ class Workflow:
         self.nextflow_file.add_2_rocrate(dico)
 
     def get_processes_defined(self):
-        """Function that returns a list of the processes defined 
+        """Method that returns a list of the processes defined 
 
         Keyword arguments:
         
@@ -352,7 +352,7 @@ class Workflow:
         return list(processes)
     
     def get_processes_called(self):
-        """Function that returns a list of the processes called/used during the workflow execution
+        """Method that returns a list of the processes called/used during the workflow execution
 
         Keyword arguments:
         
@@ -360,7 +360,7 @@ class Workflow:
         return self.nextflow_file.get_processes_called()
 
     def get_tools(self):
-        """Function that returns a list of the tools used by the workflow
+        """Method that returns a list of the tools used by the workflow
 
         Keyword arguments:
         
@@ -372,7 +372,7 @@ class Workflow:
         return list(set(tab))
     
     def get_commands(self):
-        """Function that returns a list of the commands used by the workflow
+        """Method that returns a list of the commands used by the workflow
 
         Keyword arguments:
         
@@ -384,7 +384,7 @@ class Workflow:
         return list(set(tab))
     
     def get_modules(self):
-        """Function that returns a list of the modules used by the workflow
+        """Method that returns a list of the modules used by the workflow
 
         Keyword arguments:
         
@@ -396,7 +396,7 @@ class Workflow:
         return list(set(tab))
 
     def initialise_rocrate(self):
-        """Function that initialises the RO-Crate file
+        """Method that initialises the RO-Crate file
 
         Keyword arguments:
         
@@ -481,7 +481,7 @@ class Workflow:
                 
 
     def initialise(self, create_rocrate = True):
-        """Function that initialises the analysis of the worflow
+        """Method that initialises the analysis of the worflow
 
         Keyword arguments:
         
@@ -491,7 +491,7 @@ class Workflow:
             self.initialise_rocrate()
 
     def generate_all_graphs(self, render_graphs = True):
-        """Function that generates all graphs representing the workflow
+        """Method that generates all graphs representing the workflow
 
         Keyword arguments:
         
-- 
GitLab