Exemplo n.º 1
0
 def test_rev_comp_gappy_muscle(self):
     if not functions.which('muscle'):
         _LOG.warning('muscle not found... skipping tests.')
         return
     self.rc_seqs = dataio.get_buffered_seq_iter([self.gappy_path])
     d, e = seqsum.summarize_distances(self.rc_seqs,
                                       sample_size=5,
                                       per_site=False,
                                       aligned=False,
                                       ignore_gaps=True,
                                       do_full_alignment=False,
                                       aligner_tools=['muscle'],
                                       full_aligner_tools=None)
     self.assertTrue(len(e) < 1)
     self.assertEqual(len(d), 31)
Exemplo n.º 2
0
 def align(self, seq_iter):
     with TemporaryFilePath() as tmp_path:
         with OpenFile(tmp_path, 'w') as tmp:
             for seq in seq_iter:
                 tmp.write(seq.format('fasta'))
         self.kwargs['input'] = tmp_path
         mafft_command = MafftCommandline(self.exe, **self.kwargs)
         self.cmd = str(mafft_command)
         _LOG.debug('{0}: Executing command {1!r}'.format(
             self.name, self.cmd))
         stdout, stderr = mafft_command()
         if self.out_path:
             self.out_path = functions.get_new_path(self.out_path)
             with OpenFile(self.out_path, 'w') as out:
                 out.write(stdout)
     return dataio.get_buffered_seq_iter([StringIO(stdout)], format='fasta')
Exemplo n.º 3
0
 def align(self, seq_iter):
     with TemporaryFilePath() as tmp_path:
         with OpenFile(tmp_path, 'w') as tmp:
             for seq in seq_iter:
                 tmp.write(seq.format('fasta'))
         self.kwargs['input'] = tmp_path
         mafft_command = MafftCommandline(self.exe, **self.kwargs)
         self.cmd = str(mafft_command)
         _LOG.debug('{0}: Executing command {1!r}'.format(self.name,
                 self.cmd))
         stdout, stderr = mafft_command()
         if self.out_path:
             self.out_path = functions.get_new_path(self.out_path)
             with OpenFile(self.out_path, 'w') as out:
                 out.write(stdout)
     return dataio.get_buffered_seq_iter([StringIO(stdout)], format='fasta')
Exemplo n.º 4
0
 def test_rev_comp_error_mafft_full(self):
     if not functions.which('mafft'):
         _LOG.warning('mafft not found... skipping tests.')
         return
     self.rc_seqs = dataio.get_buffered_seq_iter([self.rc_path])
     d, e = seqsum.summarize_distances(self.rc_seqs,
                                       sample_size=0,
                                       per_site=False,
                                       aligned=False,
                                       ignore_gaps=False,
                                       do_full_alignment=True,
                                       aligner_tools=['mafft'],
                                       full_aligner_tools=['mafft'])
     self.assertEqual(len(e), 11)
     for rce in e:
         self.assertTrue('Homo_sapiens' in rce)
     self.assertEqual(len(d), 12)
Exemplo n.º 5
0
 def align(self, seq_iter):
     with TemporaryFilePath() as in_path:
         with OpenFile(in_path, 'w') as tmp:
             for seq in seq_iter:
                 tmp.write(seq.format('fasta'))
         self.kwargs['input'] = in_path
         with TemporaryFilePath() as tmp_out_path:
             self.kwargs['out'] = tmp_out_path
             muscle_command = MuscleCommandline(self.exe, **self.kwargs)
             self.cmd = str(muscle_command)
             _LOG.debug('{0}: Executing command {1!r}'.format(
                 self.name, self.cmd))
             stdout, stderr = muscle_command()
             results = dataio.get_buffered_seq_iter([tmp_out_path],
                                                    format='fasta')
             if self.out_path:
                 self.out_path = functions.get_new_path(self.out_path)
                 shutil.move(tmp_out_path, self.out_path)
     return results
Exemplo n.º 6
0
 def align(self, seq_iter):
     with TemporaryFilePath() as in_path:
         with OpenFile(in_path, 'w') as tmp:
             for seq in seq_iter:
                 tmp.write(seq.format('fasta'))
         self.kwargs['input'] = in_path
         with TemporaryFilePath() as tmp_out_path:
             self.kwargs['out'] = tmp_out_path
             muscle_command = MuscleCommandline(self.exe, **self.kwargs)
             self.cmd = str(muscle_command)
             _LOG.debug('{0}: Executing command {1!r}'.format(self.name,
                     self.cmd))
             stdout, stderr = muscle_command()
             results = dataio.get_buffered_seq_iter([tmp_out_path],
                     format='fasta')
             if self.out_path:
                 self.out_path = functions.get_new_path(self.out_path)
                 shutil.move(tmp_out_path, self.out_path)
     return results