Esempio 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()
Esempio 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()
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)