2 from ost
import seq, mol, io
4 def SaveToTempDir(objects, seq_format='fasta', structure_format='pdb'):
6 Take all objects and saves them to a temporary directory. The paths of the
7 saved files will be returned as a tuple. This works for alignments, and
8 structure files. The output format for sequence files and structure files can
9 be changed by setting to seq_format and structure_format parameters
13 tmp_dir_name=tempfile.mkdtemp()
15 for index, obj
in enumerate(objects):
17 name=os.path.join(tmp_dir_name,
'aln%02d.fasta' % (index+1))
18 io.SaveAlignment(obj, name, seq_format)
19 file_names.append(name)
22 name=os.path.join(tmp_dir_name,
'seq%02d.fasta' % (index+1))
23 io.SaveSequence(obj, name, seq_format)
24 file_names.append(name)
27 name=os.path.join(tmp_dir_name,
'sql%02d.fasta' % (index+1))
28 io.SaveSequenceList(obj, name, seq_format)
29 file_names.append(name)
32 name=os.path.join(tmp_dir_name, tmp_dir_name,
'mol%02d.pdb' % (index+1))
33 io.SaveEntity(model, name, structure_format)
34 file_names.append(name)
39 def __init__(self, objects, seq_format='fasta', structure_format='pdb'):
41 structure_format=structure_format)