def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd()
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = component_reqs.requirements['R'] + ' --no-save --args'
        real_command_args = [
            '/share/lustre/dgrewal/Miscellaneous/component_tests/plot_titan/component_test/infile',
            './component_test/plots', '1', '1', '1', '<',
            os.path.abspath('./component_seed') + '/plot_titan.R'
        ]

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        print cmd_args
        print real_command_args
        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(
                    True, False,
                    'Please recheck the cmd_args list in make_cmd')
Exemple #2
0
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd(chunk=None)
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = os.path.join(os.path.abspath('./component_seed'),
                                    'classify.py')
        real_command_args = []

        print '*' * 50
        print cmd_args
        print '*' * 50

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(
                    True, False,
                    'Please recheck the cmd_args list in make_cmd')
Exemple #3
0
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd(chunk=None)
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = component_reqs.requirements[
            'python'] + ' ' + os.path.join(os.path.abspath('./component_seed'),
                                           'split_fastq.py')

        real_command_args = [
            '--input /share/lustre/dgrewal/Miscellaneous/component_tests/split_fastq/component_test/infile',
            '--output ./component_test/output', '--range 0:3999'
        ]

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        print cmd_args
        print real_command_args
        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(
                    True, False,
                    'Please recheck the cmd_args list in make_cmd')
Exemple #4
0
 def test_make_cmd(self):
     comp = component_main.Component()
     comp.args = self.args
     cmd,cmd_args = comp.make_cmd()
     cmd_args = ' '.join(map(str,cmd_args))
     
     #The actual resulting command:
     real_command = component_reqs.requirements['R']+' --no-save --args' 
     real_command_args = ['1','./component_test/infile',
                          './component_test/cnfile',
                          '/share/lustre/dgrewal/Miscellaneous/component_tests/test_bam/GRCh37-lite.map.ws_1000.wig',
                          '1','4','2','./component_test/outfile',
                          './component_test/params',
                          '0','TRUE','1','map','5','1e-300','1e9','1e9','2500','20000','8', 'TRUE',
                          './component_test/obj',
                          '<',os.path.abspath('./component_seed')+'/titan.R']
     
     real_command_args = ' '.join(real_command_args)
     
     print cmd_args
     print real_command_args
     #Ensure that the commands match exactly
     self.assertEqual(real_command, cmd, 'Please recheck the cmd variable in make_cmd')
     
     #Ensure that each of the args are present in the command args list
     #Exact match not possible since order can change 
     self.assertEqual(real_command_args, cmd_args , 'Please recheck the cmd_args list in make_cmd')
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd(chunk=None)
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command =  component_reqs.requirements['java'] +' -Xmx4G -jar ' +\
                        component_reqs.requirements['MarkDuplicates']

        real_command_args = [
            'INPUT=/sample/path/checks/make_cmd/input.bam',
            'OUTPUT=/sample/path/checks/make_cmd/output.bam',
            'METRICS=/sample/path/checks/make_cmd/metrics',
            'ASSUME_SORTED=TRUE',
            'READ_NAME_REGEX="[a-zA-Z0-9]+_[0-9]+:[0-9]+:([0-9]+):([0-9]+):([0-9]+).*"',
            'OPTICAL_DUPLICATE_PIXEL_DISTANCE=16',
            'MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=1000',
            'VALIDATION_STRINGENCY=LENIENCY',
            'TMP_DIR=/sample/path/checks/make_cmd/tmp_dir'
        ]

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(
                    True, False,
                    'Please recheck the cmd_args list in make_cmd')
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd(chunk=None)
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = 'sh'
        real_command_args = [component_reqs.requirements['bowtie2']
                             '/sample/path/checks/make_cmd/ref.fa',
                             '/sample/path/checks/make_cmd/1.fastq',
                             '/sample/path/checks/make_cmd/2.fastq',
                             'inputformat=bam',
                             'filename=/sample/path/checks/make_cmd/input.bam',
                             'exclude=QCFAIL']

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd, 'Please recheck the cmd variable in make_cmd')
        print real_command_args
        print cmd_args
        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(True, False, 'Please recheck the cmd_args list in make_cmd')
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd()
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = component_reqs.requirements[
            'python'] + ' ' + os.path.abspath(
                './component_seed') + '/transform_vcf_to_counts.py'
        real_command_args = [
            '--infile ./component_test/infile',
            '--outfile ./component_test/outfile'
        ]

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        for val in real_command_args:
            if not val in cmd_args:
                self.assertEqual(
                    True, False,
                    'Please recheck the cmd_args list in make_cmd')
 def setup_component(self, args):
     """
     Create uniform Component instances.
     """
     component = component_main.Component()
     component.requirements = component_reqs.requirements
     component.args = args
     return component
    def test_component(self):
        component = component_main.Component()
        component.args = self.args
        component.run()

        import filecmp
        filecmp.cmp(self.args.outfile, '/share/lustre/dgrewal/Miscellaneous/component_tests/calc_correctreads_wig/component_test/outfile_ref')

        os.remove(self.args.outfile)
    def test_component(self):
        component = component_main.Component()
        component.args = self.args
        component.run()

        import filecmp
        filecmp.cmp('./component_test/outfile', './component_test/outfile_ref')

        os.remove(self.args.out)
Exemple #11
0
    def test_component(self):
        component = component_main.Component()
        component.args = self.args
        component.run()

        import filecmp
        filecmp.cmp(
            self.args.output,
            '/share/lustre/dgrewal/Miscellaneous/component_tests/split_fastq/component_test/output_ref'
        )

        os.remove(self.args.output)
 def setUp(self):
     """
     Set a few common variables.
     """
     # Obtain component_test directory
     current_dir = os.path.dirname(os.path.abspath(__file__))
     self.test_dir = current_dir + "/component_test/"
     # Create a tmp directory
     comp = component_main.Component()
     random_num = int(random.random() * 1000)
     self.tmp_dir = "/tmp/test_{{}}_{{}}/".format(comp.component_name, random_num)
     os.mkdir(self.tmp_dir)
    def test_component(self):
        component = component_main.Component()
        component.args = self.args
        component.run()

        import filecmp
        filecmp.cmp('./component_test/outfile_seg',
                    './component_test/outfile.test.seg')
        filecmp.cmp('./component_test/outfile_igv',
                    './component_test/outfile.test.txt')

        os.remove(self.args.outfile)
        os.remove(self.args.outigv)
Exemple #14
0
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd(chunk=None)
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_cmd = component_reqs.requirements['python'] + ' ' + os.path.join(
            os.path.abspath('./component_seed/'), 'addPrefixToFastq.py')

        real_cmd_args = '--infile ' + self.args.input + ' --outfile ' + self.args.output + ' --prefix ' + self.args.prefix

        #Ensure that the commands match exactly
        self.assertEqual(real_cmd, cmd,
                         'Please recheck the cmd variable in make_cmd')

        #Ensure that each of the args are present in the command args list
        self.assertEqual(real_cmd_args, cmd_args,
                         'Please recheck the cmd_args list in make_cmd')
 def test_make_cmd(self):
     comp = component_main.Component()
     comp.args = self.args
     cmd,cmd_args = comp.make_cmd()
     cmd_args = ' '.join(map(str,cmd_args))
     
     #The actual resulting command:
     real_command = component_reqs.requirements['R']+' --no-save --args' 
     
     real_command_args = ['1', './component_test/tumour.wig', 
                          './component_test/normal.wig',
                          '/share/lustre/dgrewal/Miscellaneous/component_tests/calc_correctreads_wig/component_test/gc.wig',
                          '/share/lustre/dgrewal/Miscellaneous/component_tests/calc_correctreads_wig/component_test/map.wig', 
                          './component_test/output.txt', '<', 
                          os.path.abspath('./component_seed')+'/correctReads.R']
     real_command_args = ' '.join(real_command_args)
     
     #Ensure that the commands match exactly
     self.assertEqual(real_command, cmd, 'Please recheck the cmd variable in make_cmd')
     self.assertEqual(real_command_args, cmd_args, 'Please recheck the cmd_args list in make_cmd')
 def test_make_cmd(self):
     comp = component_main.Component()
     comp.args = self.args
     cmd,cmd_args = comp.make_cmd(chunk=None)
     cmd_args = ' '.join(map(str,cmd_args))
     
     #The actual resulting command:
     real_cmd = component_reqs.requirements['python']+' '+ os.path.join(os.path.abspath('./component_seed'),'pygene_annotation.py')
     real_cmd_args = ['--infile ./component_test/infile', '--outfile ./component_test/outfile', '--gene_sets_gtf_bin /share/lustre/dgrewal/Miscellaneous/component_tests/annot_pygenes_titan/component_test/Homo_sapiens.GRCh37.73.gtf.gene_models.binary']
    
     print cmd
     print real_cmd 
     #Ensure that the commands match exactly
     self.assertEqual(real_cmd, cmd, 'Please recheck the cmd variable in make_cmd')
     
     #Ensure that each of the args are present in the command args list
     #Exact match not possible since order can change 
     for val in real_cmd_args:
         if not val in cmd_args:
             self.assertEqual(True, False, 'Please recheck the cmd_args list in make_cmd')
    def test_make_cmd(self):
        comp = component_main.Component()
        comp.args = self.args
        cmd, cmd_args = comp.make_cmd()
        cmd_args = ' '.join(map(str, cmd_args))

        #The actual resulting command:
        real_command = os.path.abspath('./component_seed') + '/readCounter'
        real_command_args = '/share/lustre/dgrewal/Miscellaneous/component_tests/test_bam/DG1136a_5Mbp.bam'+\
                            ' -w1000'+' -q0'+' | '+component_reqs.requirements['python']+\
                            ' '+os.path.abspath('./component_seed')+'/filter_chromosomes.py'+\
                            ' ./component_test/outfile'

        #Ensure that the commands match exactly
        self.assertEqual(real_command, cmd,
                         'Please recheck the cmd variable in make_cmd')

        print cmd_args
        print real_command_args
        #Ensure that each of the args are present in the command args list
        #Exact match not possible since order can change
        self.assertEqual(real_command_args, cmd_args,
                         'Please recheck the cmd_args list in make_cmd')
 def test_make_cmd(self):
     comp = component_main.Component()
     comp.args = self.args
     cmd,cmd_args = comp.make_cmd(None)
     cmd_args = ' '.join(map(str,cmd_args))
     
     #The actual resulting command:
     real_command = component_reqs.requirements['python'] + ' ' + os.path.abspath('./component_seed')+'/flagPos.py'
     
     real_command_args = ['--infile '+self.args.infile,
                          '--db '+self.args.db,
                          '--out '+self.args.out,
                          '--string '+self.args.string
                          ]
     
     real_command_args = ' '.join(real_command_args)
     
     #Ensure that the commands match exactly
     self.assertEqual(real_command, cmd, 'Please recheck the cmd variable in make_cmd')
     
     #Ensure that each of the args are present in the command args list
     #Exact match not possible since order can change 
     self.assertEqual(cmd_args, real_command_args, 'Please recheck the cmd_args variable in make_cmd')
    def test_component(self):
        component = component_main.Component()
        component.args = self.args
        component.run()

        shutil.rmtree(self.args.outdir)
 def setUp(self):
     self.component = component_main.Component()