예제 #1
0
    def setUp(self):
        """Set up a workflow.

        """
        fqqf = FastqQualityFilter(
            name="quality_filter", args={"-i": "fastq.fq", "-o": "qfastq.fq", "-Q": "33", "-q": "20", "-p": "90"}
        )
        fq2a = FastqToFasta(name="fastq_to_fasta", args={"-i": "qfastq.fq", "-o": "qfasta.fa"})
        fq2a.add_dependencies(done=[fqqf])

        self.wf = WorkFlow([fqqf, fq2a])
        self.fqqf = fqqf
        self.fq2a = fq2a
예제 #2
0

# data init
data_dir = '/home/karl/data/tfpipe/'


# build first job
job1 = galaxy.FastqToFasta(args={'-i':data_dir + 'rep2.fastq',
                                 '-o': data_dir + 'rep2.fasta',
                                 '-Q': '33'}, 
                           name='myfastq2a')


# build second job
job2 = galaxy.FastxClipper()
job2.add_argument('-i', data_dir + 'rep2.fasta')
job2.add_argument('-o', data_dir + 'newoutfile.fa')
job2.add_argument('-C')
job2.add_jobname("myFastxClipper")
job2.add_adapter_file('/home/karl/data/tfpipe/adapters')
job2.add_dependencies(done=[job1,])


job3 = CLI(cmd="ls -l")


# add jobs to workflow
wf = WorkFlow([job1, job2, job3], lsf=False)
wf.show()

예제 #3
0
class WorkFlowTest(unittest.TestCase):
    """Test functionality of workflow with sample jobs.

    """

    def setUp(self):
        """Set up a workflow.

        """
        fqqf = FastqQualityFilter(
            name="quality_filter", args={"-i": "fastq.fq", "-o": "qfastq.fq", "-Q": "33", "-q": "20", "-p": "90"}
        )
        fq2a = FastqToFasta(name="fastq_to_fasta", args={"-i": "qfastq.fq", "-o": "qfasta.fa"})
        fq2a.add_dependencies(done=[fqqf])

        self.wf = WorkFlow([fqqf, fq2a])
        self.fqqf = fqqf
        self.fq2a = fq2a

    def test_workflow_create_submit_str(self):
        """Display workflow submission commands.

        """
        job_list = [
            "bsub -J quality_filter -o quality_filter.out fastq_quality_filter -Q 33 -o qfastq.fq -i fastq.fq -p 90 -q 20",
            'bsub -J fastq_to_fasta -w "done(quality_filter)" -o fastq_to_fasta.out fastq_to_fasta -o qfasta.fa -i qfastq.fq',
        ]
        for job, jl in zip(self.wf.jobs, job_list):
            self.assertEqual(self.wf._create_submit_str(job), jl)

    def test_check_jobnames(self):
        """Method makes sure job names are unique.

        Raises DuplicateJobNames exception if jobnames are not unique.

        """
        qf = FastqQualityFilter(name="job")
        qa = FastqToFasta(name="job")
        self.assertRaises(DuplicateJobNames, wf=WorkFlow([qf, qa]))

    def test_build_bsub(self):
        """_build_bsub is a hidden method building lsf requirement.

        """
        bsub_list = [
            "bsub -J quality_filter -o quality_filter.out",
            'bsub -J fastq_to_fasta -w "done(quality_filter)" -o fastq_to_fasta.out',
        ]
        for job, bl in zip(self.wf.jobs, bsub_list):
            self.assertEqual(self.wf._build_bsub(job), bl)

    def test_lsf(self):
        """lsf attribute should be true based on setUP.

        """
        self.assertTrue(self.wf.lsf)

    def test_jobs_attribute(self):
        """setUp initialized two jobs: fqqf + fq2a

        """
        self.assertEqual([self.fqqf, self.fq2a], self.wf.jobs)