Exemplo n.º 1
0
    def save(self):
        assert(self.root_dir)

        # create root dir, if not there yet
        if not(os.path.exists(self.root_dir)):
            os.makedirs(self.root_dir)

        # save protein ids, if available already
        if(self.proteins):

            # write protein ids to file
            file_io.write_ids(self.protein_ids_f(), self.get_protein_ids())

            # write mutation data to file, if any
            muts = [m.tuple_representation() for m in self.get_mutations()]
            if(muts):
                file_io.write_mutation(self.mutation_f(), muts)

        # save the data sources
        for ds in self.data_sources:
            ds.save()
Exemplo n.º 2
0
    def save(self):
        assert (self.root_dir)

        # create root dir, if not there yet
        if not (os.path.exists(self.root_dir)):
            os.makedirs(self.root_dir)

        # save protein ids, if available already
        if (self.proteins):

            # write protein ids to file
            file_io.write_ids(self.protein_ids_f(), self.get_protein_ids())

            # write mutation data to file, if any
            muts = [m.tuple_representation() for m in self.get_mutations()]
            if (muts):
                file_io.write_mutation(self.mutation_f(), muts)

        # save the data sources
        for ds in self.data_sources:
            ds.save()
Exemplo n.º 3
0
 def _save_feature_ids(self, f):
     if not(self.feature_ids is None):
         with open(f, 'w') as fout:
             file_io.write_ids(fout, self.feature_ids)
     elif(os.path.exists(f)):
         os.remove(f)
Exemplo n.º 4
0
 def _save_object_ids(self, f):
     if(self.object_ids):
         with open(f, 'w') as fout:
             file_io.write_ids(fout, self.object_ids)
Exemplo n.º 5
0
 def _save_feature_ids(self, f):
     if not (self.feature_ids is None):
         with open(f, 'w') as fout:
             file_io.write_ids(fout, self.feature_ids)
     elif (os.path.exists(f)):
         os.remove(f)
Exemplo n.º 6
0
 def _save_object_ids(self, f):
     if (self.object_ids):
         with open(f, 'w') as fout:
             file_io.write_ids(fout, self.object_ids)