Skip to content

Commit

Permalink
adding blast support
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacozzuto committed Aug 23, 2018
1 parent 7ea70bf commit 19ab857
Showing 1 changed file with 94 additions and 52 deletions.
146 changes: 94 additions & 52 deletions lib/NGSaligner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
String annotation_file = ''
String id = ''
String index = ''
String dbtype = ''
String lib_type = ''
String reads = ''
Integer read_size = 0
Expand Down Expand Up @@ -56,6 +57,9 @@
case "shortStack":
this.alignWithShortStack()
break
case "blast":
this.alignWithBlast()
break
default:
break
}
Expand All @@ -75,7 +79,10 @@
break
case "bowtie":
this.indexWithBowtie()
break
break
case "blast":
this.indexWithBlast()
break
default:
break
}
Expand All @@ -98,10 +105,37 @@
}
}

/*******************************************************************
* INDEXING
********************************************************************/
/*
* Indexing a genome with STAR mapper. It reads both gzipped and plain fasta
*/

def private indexWithSTAR() {
"""
mkdir ${this.index}
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > `basename ${this.reference_file} .gz`
STAR --runMode genomeGenerate --genomeDir ${this.index} --runThreadN ${this.cpus} \
--genomeFastaFiles `basename ${this.reference_file} .gz` --sjdbGTFfile ${this.annotation_file} \
--sjdbOverhang ${this.read_size} --outFileNamePrefix ${this.index} \
${this.extrapars};
rm `basename ${this.reference_file} .gz`
else
STAR --runMode genomeGenerate --genomeDir ${this.index} --runThreadN ${this.cpus} \
--genomeFastaFiles ${this.reference_file} --sjdbGTFfile ${this.annotation_file} \
--sjdbOverhang ${this.read_size} --outFileNamePrefix ${this.index} \
${this.extrapars}
fi
"""
}


/*
* Mapping SE and PE reads with STAR. Reads can be both gzipped and plain fastq
*/

def private alignWithStar(){
"""
if [ `echo "${this.reads}"| cut -f 1 -d " " | grep ".gz"` ]; then gzipped=" --readFilesCommand zcat "; else gzipped=""; fi
Expand All @@ -123,28 +157,56 @@
"""
}

/*
* Indexing a genome with STAR mapper. It reads both gzipped and plain fasta
*/
def private indexWithSTAR() {
"""
mkdir ${this.index}
/*
* Indexing genomes with Bowtie2. Sequence can be both gzipped and plain fasta
*/

def private indexWithBowtie2() {

"""
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > `basename ${this.reference_file} .gz`
STAR --runMode genomeGenerate --genomeDir ${this.index} --runThreadN ${this.cpus} \
--genomeFastaFiles `basename ${this.reference_file} .gz` --sjdbGTFfile ${this.annotation_file} \
--sjdbOverhang ${this.read_size} --outFileNamePrefix ${this.index} \
${this.extrapars};
rm `basename ${this.reference_file} .gz`
else
STAR --runMode genomeGenerate --genomeDir ${this.index} --runThreadN ${this.cpus} \
--genomeFastaFiles ${this.reference_file} --sjdbGTFfile ${this.annotation_file} \
--sjdbOverhang ${this.read_size} --outFileNamePrefix ${this.index} \
${this.extrapars}
bowtie2-build --threads ${this.cpus} `basename ${this.reference_file} .gz` ${this.index} ${this.extrapars}
rm `basename ${this.reference_file} .gz`
else bowtie2-build --threads ${this.cpus} ${this.reference_file} ${this.index} ${this.extrapars}
fi
"""
"""
}

/*
* Indexing genome with Bowtie. Sequence can be both gzipped and plain fasta
*/

def private indexWithBowtie() {

"""
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > ${this.index}.fa
bowtie-build --threads ${this.cpus} ${this.index}.fa ${this.index} ${this.extrapars}
else ln -s ${this.reference_file} ${this.index}.fa
bowtie-build --threads ${this.cpus} ${this.index}.fa ${this.index} ${this.extrapars}
fi
"""
}

/*
* Indexing genome / proteome with Blast. Sequence can be both gzipped and plain fasta
*/

def private indexWithBlast() {

"""
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > ${this.index}
else ln -s ${this.reference_file} ${this.index}
fi
makeblastdb -in ${this.index} -dbtype ${this.dbtype} ${this.extrapars}
"""
}

/*******************************************************************
* MAPPING
********************************************************************/

/*
* Mapping SE and PE reads with Bowtie2. Reads can be both gzipped and plain fastq
Expand All @@ -159,23 +221,6 @@
"""
}


/*
*Indexing genomes with Bowtie2. Sequence can be both gzipped and plain fasta
*/

def private indexWithBowtie2() {

"""
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > `basename ${this.reference_file} .gz`
bowtie2-build --threads ${this.cpus} `basename ${this.reference_file} .gz` ${this.index} ${this.extrapars}
rm `basename ${this.reference_file} .gz`
else bowtie2-build --threads ${this.cpus} ${this.reference_file} ${this.index} ${this.extrapars}
fi
"""
}

/*
* Mapping SE and PE reads with Bowtie. Reads can be both gzipped and plain fastq
*/
Expand All @@ -190,22 +235,6 @@
"""
}

/*
* Indexing genome with Bowtie. Sequence can be both gzipped and plain fasta
*/

def private indexWithBowtie() {

"""
if [ `echo ${this.reference_file} | grep ".gz"` ]; then
zcat ${this.reference_file} > ${this.index}.fa
bowtie-build --threads ${this.cpus} ${this.index}.fa ${this.index} ${this.extrapars}
else ln -s ${this.reference_file} ${this.index}.fa
bowtie-build --threads ${this.cpus} ${this.index}.fa ${this.index} ${this.extrapars}
fi
"""
}

/*
* Mapping SE reads with ShortStack. This tool is wraps bowtie1.
*/
Expand All @@ -217,6 +246,19 @@
"""
}

/*
* Aligning sequences with Blast. Sequences can be both gzipped orr plain fasta file
*/

def private alignWithBlast() {
"""
blastn -out ${this.output} -db ${this.index} -query ${this.reads} -num_threads ${this.cpus} ${this.extrapars}
"""
}

/*******************************************************************
* OTHER
********************************************************************/

/*
* Get genome STATS from Bowtie2 index
Expand Down

0 comments on commit 19ab857

Please sign in to comment.