# Path: egasub/ega/entities/analysis.py
# class Analysis(object):
#     def __init__(self, alias, title, description, study_id, sample_references, analysis_center, analysis_date,
#                  analysis_type_id, files, attributes, genome_id, chromosome_references, experiment_type_id,platform,status=None, id_=None,ega_accession_id=None):
#         self.title = title
#         self.description = description
#         self.study_id = study_id
#         self.sample_references = sample_references
#         self.analysis_center = analysis_center
#         self.analysis_date = analysis_date
#         self.analysis_type_id = analysis_type_id
#         self.files = files
#         self.attributes = attributes
#         self.genome_id = genome_id
#         self.chromosome_references = chromosome_references
#         self.experiment_type_id = experiment_type_id
#         self.platform = platform
#         self.alias = alias
#         self.status = status
#         self.id = id_
#         self.ega_accession_id = ega_accession_id
# 
#     def to_dict(self):
#         return {
#             'title' : self.title,
#             'description' : self.description,
#             'studyId' : self.study_id,
#             'sampleReferences' : map(lambda ref: ref.to_dict(), self.sample_references),
#             'analysisCenter' : self.analysis_center,
#             'analysisDate' : self.analysis_date,
#             'analysisTypeId' : self.analysis_type_id,
#             'files' : map(lambda file: file.to_dict(), self.files),
#             'attributes' : map(lambda att: att.to_dict(), self.attributes),
#             'genomeId' : self.genome_id,
#             'chromosomeReferences' : [ ref.to_dict() for ref in self.chromosome_references],
#             'experimentTypeId' : self.experiment_type_id,
#             'platform' : self.platform,
#             'alias' : self.alias,
#             'status': self.status,
#             'egaAccessionId': self.ega_accession_id
#             }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(analysis_dict):
#         return Analysis(
#                 analysis_dict.get('alias'),
#                 analysis_dict.get('title'),
#                 analysis_dict.get('description'),
#                 analysis_dict.get('studyId'),
#                 [], # sampleReferences
#                 analysis_dict.get('analysisCenter'),
#                 analysis_dict.get('analysisDate'),
#                 analysis_dict.get('analysisTypeId'),
#                 [] if not analysis_dict.get('files') else [ File.from_dict(file_dict) for file_dict in analysis_dict.get('files')],
#                 [], # attribute
#                 analysis_dict.get('genomeId'),
#                 [] if not analysis_dict.get('chromosomeReferences') else [ChromosomeReference(tag) for tag in analysis_dict.get('chromosomeReferences')],
#                 analysis_dict.get('experimentTypeId'),
#                 analysis_dict.get('platform')
#             )
# 
# Path: egasub/ega/entities/file.py
# class File(object):
#     def __init__(self,file_id,file_name,checksum,unencrypted_checksum,checksum_method):
#         self.file_id = file_id
#         self.file_name = file_name
#         self.checksum = checksum
#         self.unencrypted_checksum = unencrypted_checksum
#         self.checksum_method = checksum_method
# 
#     def to_dict(self):
#         return {
#             'fileId': self.file_id,
#             'fileName': self.file_name,
#             'checksum': self.checksum,
#             'unencryptedChecksum' : self.unencrypted_checksum,
#             'checksumMethod' : self.checksum_method
#         }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(file_dict):
#         return File(
#                 None,
#                 file_dict.get('fileName'),
#                 file_dict.get('checksum'),
#                 file_dict.get('unencryptedChecksum'),
#                 file_dict.get('checksumMethod')
#             )
# 
# Path: egasub/ega/entities/chromosome_reference.py
# class ChromosomeReference(object):
#     def __init__(self,value,label=None):
#         self.value=value
#         self.label=label
# 
#     def to_dict(self):
#         return {
#             'value' : self.value,
#             'label' : self.label
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/sample_reference.py
# class SampleReference(object):
#     def __init__(self,value,label):
#         self.value = value
#         self.label = label
# 
#     def to_dict(self):
#         return {
#             'value' : self.value,
#             'label' : self.label
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/attribute.py
# class Attribute(object):
#     def __init__(self, tag, value="", unit=None):
#         self.tag = tag
#         self.value = value
#         self.unit = unit
# 
# 
#     def to_dict(self):
#         return {
#             "tag": self.tag,
#             "value": self.value,
#             "unit": self.unit
#         }
# 
# 
#     def to_xml(self):
#         xml_string = "<TAG>%s</TAG>\n<VALUE>%s</VALUE>\n" % (self.tag, self.value)
#         if self.unit is not None:
#             xml_string += "<UNIT>%s</UNIT>\n" % (self.unit)
#         return xml_string
# 
#     @staticmethod
#     def from_dict(attr_dict):
#         return Attribute(attr_dict.get('tag'),attr_dict.get('value'),attr_dict.get('unit'))


from egasub.ega.entities.analysis import Analysis
from egasub.ega.entities.file import File
from egasub.ega.entities.chromosome_reference import ChromosomeReference
from egasub.ega.entities.sample_reference import SampleReference
from egasub.ega.entities.attribute import Attribute

files = [File(32,'file name1','CheckSum1','UnencryptedChecksum1','md5'),
         File(33,'file name2','CheckSum2','UnencryptedChecksum2','md5')]
attributes = [Attribute('The tag 1','The value 1','an unit'),Attribute('The tag 2','The value 2','an unit')]

# Path: egasub/ega/entities/analysis.py
# class Analysis(object):
#     def __init__(self, alias, title, description, study_id, sample_references, analysis_center, analysis_date,
#                  analysis_type_id, files, attributes, genome_id, chromosome_references, experiment_type_id,platform,status=None, id_=None,ega_accession_id=None):
#         self.title = title
#         self.description = description
#         self.study_id = study_id
#         self.sample_references = sample_references
#         self.analysis_center = analysis_center
#         self.analysis_date = analysis_date
#         self.analysis_type_id = analysis_type_id
#         self.files = files
#         self.attributes = attributes
#         self.genome_id = genome_id
#         self.chromosome_references = chromosome_references
#         self.experiment_type_id = experiment_type_id
#         self.platform = platform
#         self.alias = alias
#         self.status = status
#         self.id = id_
#         self.ega_accession_id = ega_accession_id
# 
#     def to_dict(self):
#         return {
#             'title' : self.title,
#             'description' : self.description,
#             'studyId' : self.study_id,
#             'sampleReferences' : map(lambda ref: ref.to_dict(), self.sample_references),
#             'analysisCenter' : self.analysis_center,
#             'analysisDate' : self.analysis_date,
#             'analysisTypeId' : self.analysis_type_id,
#             'files' : map(lambda file: file.to_dict(), self.files),
#             'attributes' : map(lambda att: att.to_dict(), self.attributes),
#             'genomeId' : self.genome_id,
#             'chromosomeReferences' : [ ref.to_dict() for ref in self.chromosome_references],
#             'experimentTypeId' : self.experiment_type_id,
#             'platform' : self.platform,
#             'alias' : self.alias,
#             'status': self.status,
#             'egaAccessionId': self.ega_accession_id
#             }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(analysis_dict):
#         return Analysis(
#                 analysis_dict.get('alias'),
#                 analysis_dict.get('title'),
#                 analysis_dict.get('description'),
#                 analysis_dict.get('studyId'),
#                 [], # sampleReferences
#                 analysis_dict.get('analysisCenter'),
#                 analysis_dict.get('analysisDate'),
#                 analysis_dict.get('analysisTypeId'),
#                 [] if not analysis_dict.get('files') else [ File.from_dict(file_dict) for file_dict in analysis_dict.get('files')],
#                 [], # attribute
#                 analysis_dict.get('genomeId'),
#                 [] if not analysis_dict.get('chromosomeReferences') else [ChromosomeReference(tag) for tag in analysis_dict.get('chromosomeReferences')],
#                 analysis_dict.get('experimentTypeId'),
#                 analysis_dict.get('platform')
#             )
# 
# Path: egasub/ega/entities/file.py
# class File(object):
#     def __init__(self,file_id,file_name,checksum,unencrypted_checksum,checksum_method):
#         self.file_id = file_id
#         self.file_name = file_name
#         self.checksum = checksum
#         self.unencrypted_checksum = unencrypted_checksum
#         self.checksum_method = checksum_method
# 
#     def to_dict(self):
#         return {
#             'fileId': self.file_id,
#             'fileName': self.file_name,
#             'checksum': self.checksum,
#             'unencryptedChecksum' : self.unencrypted_checksum,
#             'checksumMethod' : self.checksum_method
#         }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(file_dict):
#         return File(
#                 None,
#                 file_dict.get('fileName'),
#                 file_dict.get('checksum'),
#                 file_dict.get('unencryptedChecksum'),
#                 file_dict.get('checksumMethod')
#             )
# 
# Path: egasub/ega/entities/chromosome_reference.py
# class ChromosomeReference(object):
#     def __init__(self,value,label=None):
#         self.value=value
#         self.label=label
# 
#     def to_dict(self):
#         return {
#             'value' : self.value,
#             'label' : self.label
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/sample_reference.py
# class SampleReference(object):
#     def __init__(self,value,label):
#         self.value = value
#         self.label = label
# 
#     def to_dict(self):
#         return {
#             'value' : self.value,
#             'label' : self.label
#             }
# 
#     def to_xml(self):
#         pass
# 
# Path: egasub/ega/entities/attribute.py
# class Attribute(object):
#     def __init__(self, tag, value="", unit=None):
#         self.tag = tag
#         self.value = value
#         self.unit = unit
# 
# 
#     def to_dict(self):
#         return {
#             "tag": self.tag,
#             "value": self.value,
#             "unit": self.unit
#         }
# 
# 
#     def to_xml(self):
#         xml_string = "<TAG>%s</TAG>\n<VALUE>%s</VALUE>\n" % (self.tag, self.value)
#         if self.unit is not None:
#             xml_string += "<UNIT>%s</UNIT>\n" % (self.unit)
#         return xml_string
# 
#     @staticmethod
#     def from_dict(attr_dict):
#         return Attribute(attr_dict.get('tag'),attr_dict.get('value'),attr_dict.get('unit'))


# Path: tests/submission/test_analysis.py
from egasub.ega.entities.analysis import Analysis
from egasub.ega.entities.file import File
from egasub.ega.entities.chromosome_reference import ChromosomeReference
from egasub.ega.entities.sample_reference import SampleReference
from egasub.ega.entities.attribute import Attribute


files = [File(32,'file name1','CheckSum1','UnencryptedChecksum1','md5'),
         File(33,'file name2','CheckSum2','UnencryptedChecksum2','md5')]
attributes = [Attribute('The tag 1','The value 1','an unit'),Attribute('The tag 2','The value 2','an unit')]

chromosome_references = [ChromosomeReference('the value1','the label2'),ChromosomeReference('the value2','the label2')]