# HG changeset patch # User sanbi-uwc # Date 1457643224 18000 # Node ID 905996402f3c677596c27e88a9f327f104739411 # Parent 2cadfddb73cd83c11f937e7e61545a1fec4ce21a planemo upload for repository https://github.com/zipho/novo_align commit 09e64885cb6efcc9aaacd6a4fd897ba928981359 diff -r 2cadfddb73cd -r 905996402f3c novo_align.py --- a/novo_align.py Wed Mar 09 05:42:36 2016 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function -import argparse -from subprocess import check_call, CalledProcessError -from json import load, dump, dumps -from os import environ, mkdir, makedirs, path -from os.path import isdir, exists -import shlex -import sys -import logging -log = logging.getLogger( __name__ ) - -def novo_align(output_filename, index_filename, fwd_file, rev_file ): - #novoalign -c 8 -k -d /cip0/research/ajayi/RNA-seq_Analysis_Project_Case_Study/reference/Homo_Sapiens/out/TB_H37Rv.nix - # -f X165_820L8_.R1_val_1.fq X165_820L8_.R2_val_2.fq -i PE 250,100 - # -o SAM '@RG\tID:readgroup\tPU:platform unit\tLB:library' | samtools view -bS - > `pwd`/out/X165_820L8.bam - #output_filename = path.join(output_directory, fwd_file.split(".")[0] + ".bam") - param = r'@RG\tID:readgroup\tPU:platform unit\tLB:library' - cmdline_str = "novoalign -c 8 -k -d {} -f {} {} -i PE 250, 100 -o SAM '{}' | samtools view -bS - > {}".format( - index_filename, - fwd_file, - rev_file, - param, - output_filename) - cmdline = newSplit(cmdline_str) - try: - check_call(cmdline) - except CalledProcessError: - print("Error running the nova-align", file=sys.stderr) - -def newSplit(value): - lex = shlex.shlex(value) - lex.quotes = '"' - lex.whitespace_split = True - lex.commenters = '' - return list(lex) - -def main(): - parser = argparse.ArgumentParser(description="Generate a BAM file from the Novo Align tool") - parser.add_argument('output_filename') - parser.add_argument('--index_filename') - parser.add_argument('--forward_filename') - parser.add_argument('--reverse_filename') - args = parser.parse_args() - - #a dirty way of referencing the file - index_file_path = args.index_filename + "/" + args.index_filename.split("/")[-1] - - novo_align(args.output_filename, index_file_path, args.forward_filename, args.reverse_filename) - -if __name__ == "__main__": main() diff -r 2cadfddb73cd -r 905996402f3c novo_align.xml --- a/novo_align.xml Wed Mar 09 05:42:36 2016 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ - - - Tool to run the Novo Align mapping tool - - samtools - - - - - - - novo_align.py '${out_file}' --index_file ${index1.fields.path} --forward_file ${fastq_input1} --reverse_file ${fastq_input2} - - - - - - - - - - - - Help! - - - - - - - - diff -r 2cadfddb73cd -r 905996402f3c novo_sort.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/novo_sort.py Thu Mar 10 15:53:44 2016 -0500 @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +from __future__ import print_function +import argparse +from subprocess import check_call, CalledProcessError +from json import load, dump, dumps +from os import environ, mkdir, makedirs, path +from os.path import isdir, exists +import shlex +import sys +import logging +log = logging.getLogger( __name__ ) + +def novo_sort( bam_filename ): + #novosort -c 8 -m 8G -s-f $i > $i".sorted"; done + cmdline_str = "novosort -c 8 -m 8G -s -f {}".format( bam_filename ) + cmdline = newSplit(cmdline_str) + try: + check_call(cmdline) + except CalledProcessError: + print("Error running the nova-align", file=sys.stderr) + +def newSplit(value): + lex = shlex.shlex(value) + lex.quotes = '"' + lex.whitespace_split = True + lex.commenters = '' + return list(lex) + +def main(): + parser = argparse.ArgumentParser(description="Generate a BAM file from the Novo Align tool") + parser.add_argument('output_filename') + parser.add_argument('--bam_filename') + args = parser.parse_args() + + novo_sort(args.bam_filename) + +if __name__ == "__main__": main() diff -r 2cadfddb73cd -r 905996402f3c novo_sort.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/novo_sort.xml Thu Mar 10 15:53:44 2016 -0500 @@ -0,0 +1,28 @@ + + + Tool to run the Novo Sort mapping tool + + samtools + + + + + + + novo_sort.py '${out_file}' --bam_filename ${input1} + + + + + + + + Help! + + + + + + + +