Пример #1
0
    def setUp(self):
        ff, csv = tempfile.mkstemp(prefix='rba_', suffix='_t1')
        os.close(ff)
        self.csv = csv

        ff, html = tempfile.mkstemp(prefix='rba_', suffix='_t2')
        os.close(ff)
        self.html = html

        ff, pandas_dump = tempfile.mkstemp(prefix='rba_', suffix='_t3')
        os.close(ff)
        self.pandas_dump = pandas_dump

        ff, json_file = tempfile.mkstemp(prefix='rba_', suffix='_t4')
        os.close(ff)
        self.json = json_file

        ff, fasta = tempfile.mkstemp(prefix='rba_', suffix='_t5')
        os.close(ff)
        self.fasta = fasta

        ff, fasta_structures = tempfile.mkstemp(prefix='rba_', suffix='_t6')
        os.close(ff)
        self.fasta_structures = fasta_structures

        self.args = Pseudoargs(
            blast_query,
            blast_in,
            blast_db,
            b_type='plain',
            prediction_method=['rnafold'],
            blast_regexp='(?<=\|)[A-Z0-9]*\.?\d*$',
            enable_overwrite=True,
            html=self.html,
        )
Пример #2
0
    def setUp(self):
        f = open(ref_json_file, 'r')
        mydata = json.load(f)
        f.close()
        bb = convert_classes.blastsearchrecomputefromdict(mydata)
        self.data = bb

        ff, csv = tempfile.mkstemp(prefix='rba_', suffix='_t1')
        os.close(ff)
        self.csv = csv

        ff, html = tempfile.mkstemp(prefix='rba_', suffix='_t2')
        os.close(ff)
        self.html = blast_query + 'test_html.html'

        ff, pandas_dump = tempfile.mkstemp(prefix='rba_', suffix='_t3')
        os.close(ff)
        self.pandas_dump = pandas_dump

        ff, json_file = tempfile.mkstemp(prefix='rba_', suffix='_t4')
        os.close(ff)
        self.json = json_file

        ff, fasta = tempfile.mkstemp(prefix='rba_', suffix='_t5')
        os.close(ff)
        self.fasta = fasta

        ff, allHits_fasta = tempfile.mkstemp(prefix='rba_', suffix='_t6')
        with os.fdopen(ff, 'w') as f:
            SeqIO.write([i.extension for i in self.data.hits], f, 'fasta')

        self.fasta_structures = allHits_fasta

        self.args = Pseudoargs(
            blast_query,
            blast_in,
            blast_db,
            b_type='plain',
            prediction_method=['rnafold'],
            blast_regexp=r'(?<=\|)[A-Z0-9]*\.?\d*$',
            enable_overwrite=True,
            html=self.html,
        )

        self.func_args = {
            'query': self.data.query,
            'seqs2predict_fasta': allHits_fasta,
            'pred_method_params': {},
            'all_hits_list': [i.extension for i in self.data.hits],
            'seqs2predict_list': [i.extension for i in self.data.hits],
            'use_cm_file': 'abc',
        }
        remove_files_with_try([blast_in + '.tmp_rboAnalyzer'])
Пример #3
0
    def setUp(self):
        self.args = Pseudoargs(
            blast_query,
            blast_in,
            blast_db,
            b_type='plain',
            prediction_method=['rnafold'],
            blast_regexp=r'(?<=\|)[A-Z0-9]*\.?\d*$',
            enable_overwrite=True,
            html=test_output_file,
        )

        with open(source_fasta, 'r') as fh:
            self.seqs = [s for s in SeqIO.parse(fh, format='fasta')]
    def test_if_missing_db_entry_is_reported(self):
        aa = Pseudoargs(blast_query=os.path.join(fwd, test_dir,
                                                 'RF00005_query.fasta'),
                        blast_in=os.path.join(fwd, test_dir,
                                              'RF00005.blastout'),
                        blast_db=os.path.join(fwd, test_dir, 'blastdb',
                                              'RF00001-art.blastdb'),
                        b_type='plain',
                        prediction_method=['rnafold'],
                        blast_regexp=r'(?<=\|)[A-Z0-9]*\.?\d*$',
                        enable_overwrite=True,
                        mode='locarna')

        with self.assertRaises(SystemExit):
            lunch_with_args(aa)
Пример #5
0
    def setUp(self):
        self.args = Pseudoargs(
            blast_query,
            blast_in,
            blast_db,
            b_type='plain',
            prediction_method=[
                'rnafold',
            ],
            blast_regexp=r'(?<=\|)[A-Z0-9]*\.?\d*$',
            enable_overwrite=True,
            mode='simple',
            html=test_output_file,
        )

        ff, csv = tempfile.mkstemp(prefix='rba_', suffix='_t1')
        os.close(ff)
        self.csv = csv

        ff, json_file = tempfile.mkstemp(prefix='rba_', suffix='_t4')
        os.close(ff)
        self.json = json_file

        ff, fasta = tempfile.mkstemp(prefix='rba_', suffix='_t5')
        os.close(ff)
        self.fasta = fasta

        ff, fasta_structures = tempfile.mkstemp(prefix='rba_', suffix='_t6')
        os.close(ff)
        self.fasta_structures = fasta_structures

        tp = tools_paths(
            os.path.join(os.path.dirname(os.path.dirname(__file__)),
                         'rna_blast_analyze', 'BR_core', 'config.txt'))

        CONFIG.override(tp)

        rfam = RfamInfo()
        self.sha1 = compute_args_hash(
            self.args, os.path.join(CONFIG.rfam_dir, rfam.gzname))
        self.test_backup_file = blast_in + '.r-' + self.sha1[:10]