Commit a5656b8e authored by Penom Nom's avatar Penom Nom
Browse files

Replace tophat aligner with star. A little correction has been made on the line chart drawing

parent 9a4ccd3a
......@@ -84,6 +84,7 @@ tmp_directory = <path>/tmp
#usearch = /usr/bin/usearch
#cdhit = /usr/bin/cd-hit
#gaas = /usr/bin/gaas
#STAR = /usr/bin/STAR
# Set cluster parameters to some components
[components]
......
......@@ -259,9 +259,6 @@ $(function () {
credits: { enabled: false },
xAxis: xAxis,
yAxis: yAxis,
legend: {
enabled: false
},
plotOptions: {
bar: {
dataLabels: {
......
#
# 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/>.
#
import os
from jflow.iotypes import OutputFile, OutputFileList, InputFile, InputFileList, Formats
from ng6.analysis import Analysis
from weaver.function import ShellFunction
class STAR (Analysis):
def define_parameters(self, fasta_file, read1, read2 = None, keep_bam = True):
self.fasta_file = InputFile(fasta_file)
self.read1 = InputFileList(read1)
self.read2 = None
self.keep_bam = keep_bam
if read2 :
self.read2 = InputFileList(read2)
self.fasta_file_link = OutputFile(os.path.join(self.output_directory, os.path.basename(self.fasta_file)))
self.output_prefix = os.path.join(self.output_directory, 'prefix.')
self.genome_dir = OutputFile(os.path.join(self.output_directory, 'genome'))
self.output_sam_no_md = OutputFileList(self.output_prefix + 'Aligned.out.sam')
self.output_bam = OutputFileList(self.output_prefix + 'Aligned.out.bam', Formats.BAM)
def get_version(self):
return "2.3.0"
def define_analysis(self):
self.name = "STAR Alignment"
self.description = "Reads Alignment using STAR software"
self.software = "STAR"
self.options = "default options ..."
def process(self):
link_fasta = ShellFunction( "ln -s $1 $2" , cmd_format="{EXE} {IN} {OUT}")
link_fasta(inputs = self.fasta_file, outputs = self.fasta_file_link)
genomeBuild = ShellFunction( "mkdir $2 ; " + self.get_exec_path("STAR") + " --runMode genomeGenerate --genomeFastaFiles $1 --genomeDir $2",
cmd_format='{EXE} {IN} {OUT}' )
genomeBuild(inputs = self.fasta_file_link, outputs = self.genome_dir)
command = [self.get_exec_path("STAR"), "--outFileNamePrefix", "$1", "--readFilesCommand", "zcat", "--genomeDir", "$2", "--readFilesIn", "$3" ]
inputs = [self.genome_dir, self.read1]
if self.read2 :
command.append("$4")
inputs.append(self.read2)
star = ShellFunction( ' '.join(command), cmd_format='{EXE} {ARG} {IN} {OUT}')
star( arguments = self.output_prefix, inputs = inputs, outputs = self.output_sam_no_md)
#calmd and convert to bam
calmd = ShellFunction( self.get_exec_path("samtools") + ' calmd -S -b $1 $2 > $3' , cmd_format='{EXE} {IN} {OUT}')
calmd( inputs = [self.output_sam_no_md, self.fasta_file_link], outputs = [self.output_bam])
def post_process(self):
if self.keep_bam:
self._save_files(self.output_bam)
\ No newline at end of file
......@@ -114,12 +114,6 @@ class RnaSeqQualityCheck (NG6Workflow):
alignmentstats = self.add_component("AlignmentStats", [bwa.bam_files, is_paired_end], parent = bwa, component_prefix="bwa")
if self.args["reference_genome"] is not None :
# index the reference genome
bowtie_index = os.path.splitext(self.args["reference_genome"])[0]
if not os.path.exists( bowtie_index + ".1.bt2" ):
bowtie2build = self.add_component("BowtieBuild", [self.args["reference_genome"]])
bowtie_index = bowtie2build.databank
# spliced alignment of reads against indexed genome
if is_paired_end and (group_prefix is not None):
# split read 1 and read 2 from filtered files list
......@@ -132,11 +126,12 @@ class RnaSeqQualityCheck (NG6Workflow):
concat_read2_files = filtered_read2_files
concat_read1_files = sorted(concat_read1_files)
concat_read2_files = sorted(concat_read2_files)
tophat = self.add_component("TopHat", [bowtie_index, concat_read1_files, concat_read2_files, not self.args["delete_bam"]], parent = fastqilluminafilter)
star = self.add_component("STAR", [self.args["reference_genome"], concat_read1_files, concat_read2_files, not self.args["delete_bam"]], parent = fastqilluminafilter)
# make some statistic on the alignement
alignmentstats = self.add_component("AlignmentStats", [tophat.accepted_hits, is_paired_end], parent = tophat, component_prefix="tophat")
alignmentstats = self.add_component("AlignmentStats", [star.output_bam, is_paired_end], parent = star, component_prefix="star")
#Quality RNA Seq analysis
if self.args["annotation"] is not None:
rseqc = self.add_component("RSeQC", [tophat.accepted_hits, self.args["annotation"]], parent = tophat)
\ No newline at end of file
rseqc = self.add_component("RSeQC", [star.output_bam, self.args["annotation"]], parent = star)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment