__init__.py 1.61 KB
Newer Older
Jerome Mariette's avatar
Jerome Mariette committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# Copyright (C) 2012 INRA
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

Jerome Mariette's avatar
Jerome Mariette committed
18
from jflow.workflow import Workflow
19
from jflow.parameter import InputFileList, InputFile
Jerome Mariette's avatar
Jerome Mariette committed
20
21
from workflows.formats import Formats

Jerome Mariette's avatar
Jerome Mariette committed
22
23

class Alignment (Workflow):
24
25
    
    def get_description(self):
Jerome Mariette's avatar
Jerome Mariette committed
26
        return "Align reads against a reference genome"
27

28
    def define_parameters(self, function="process"):
Jerome Mariette's avatar
Jerome Mariette committed
29
30
31
        self.add_input_file_list("read_1", "Which read1 files should be used", file_format=Formats.FASTQ, required=True)
        self.add_input_file_list("read_2", "Which read2 files should be used (if single end, leave empty)", file_format=Formats.FASTQ)
        self.add_input_file("reference_genome", "Which genome should the read being align on", required=True, file_format=Formats.FASTA)
Jerome Mariette's avatar
Jerome Mariette committed
32

Jerome Mariette's avatar
Jerome Mariette committed
33
    def process(self):        
Jerome Mariette's avatar
Jerome Mariette committed
34
        # index the reference genome
Jerome Mariette's avatar
Jerome Mariette committed
35
        bwaindex = self.add_component("BWAIndex", [self.reference_genome])
Jerome Mariette's avatar
Jerome Mariette committed
36
        # align reads against indexed genome
Jerome Mariette's avatar
Jerome Mariette committed
37
        bwa = self.add_component("BWA", [bwaindex.databank, self.read_1, self.read_2])
38