示例#1
0
    def test_download_ascp_failed_use_cmd_instead(self, mock_execute, mock_os, mock_config, mock_options):
        series = Series('GSE31555', 'GSE31555_family.soft.subset')
        sample = Sample('GSM783253', series, url='ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByExp/sra/SRX/SRX093/SRX093321')
        outputs = ['some_outdir/rsem_output/GSE31555/some_species/GSM783253/SRX093321/SRR333831/SRR333831.sra',
                   'some_outdir/rsem_output/GSE31555/some_species/GSM1/SRR333831.sra.download.COMPLETE']
        mock_os.path.exists.return_value = False
        ascp_cmd = '''/path/to/ascp 
-i /path/to/.aspera/connect/etc/asperaweb_id_dsa.putty 
--ignore-host-key 
-QT 
-L some_outdir/GSE123456/some_species/GSM1/SRX135160/SRR453140/
-k2 
-l 300m 
[email protected]:/sra/sra-instant/reads/ByExp/sra/SRX/SRX093/SRX093321 some_outdir/rsem_output/GSE31555/some_species/GSM783253/SRX093321/SRR333831''',
        wget_cmd = '''wget ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByExp/sra/SRX/SRX093/SRX093321
-P some_outdir/rsem_output/GSE31555/some_species/GSM783253/SRX093321/SRR333831 -N'''
        mock_config.__getitem__().format.side_effect = [ascp_cmd, wget_cmd]
        mock_options.debug = False
        # assume ascp fails with 1, wget succeeds with 0
        mock_execute.side_effect = [1, 0]
        rp_run.download(None, outputs, sample)
        mock_execute.assert_has_calls([
            mock.call(ascp_cmd,
                      '<GSM783253 (0/0/0) of GSE31555 at None>',
                      'some_outdir/rsem_output/GSE31555/some_species/GSM1/SRR333831.sra.download.COMPLETE',
                      False),
            mock.call(wget_cmd,
                      '<GSM783253 (0/0/0) of GSE31555 at None>',
                      'some_outdir/rsem_output/GSE31555/some_species/GSM1/SRR333831.sra.download.COMPLETE',
                      False)])
示例#2
0
    def test_download(self, mock_execute, mock_os, mock_config, mock_options):
        series = Series('GSE31555', 'GSE31555_family.soft.subset')
        sample = Sample('GSM783253', series, url='ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByExp/sra/SRX/SRX093/SRX093321')
        outputs = ['some_outdir/rsem_output/GSE31555/some_species/GSM783253/SRX093321/SRR333831/SRR333831.sra',
                   'some_outdir/rsem_output/GSE31555/some_species/GSM1/SRR333831.sra.download.COMPLETE']
        mock_os.path.exists.return_value = False
        cmd = '''/path/to/ascp 
-i /path/to/.aspera/connect/etc/asperaweb_id_dsa.putty 
--ignore-host-key 
-QT 
-L some_outdir/GSE123456/some_species/GSM1/SRX135160/SRR453140/
-k2 
-l 300m 
[email protected]:/sra/sra-instant/reads/ByExp/sra/SRX/SRX093/SRX093321 some_outdir/rsem_output/GSE31555/some_species/GSM783253/SRX093321/SRR333831''',
        mock_config.__getitem__().format.return_value = cmd
        mock_options.debug = False
        mock_execute.return_value = 0
        rp_run.download(None, outputs, sample)
        mock_execute.assert_called_once_with(
            cmd,
            '<GSM783253 (0/0/0) of GSE31555 at None>',
            'some_outdir/rsem_output/GSE31555/some_species/GSM1/SRR333831.sra.download.COMPLETE',
            False)