# HG changeset patch # User devteam # Date 1390832782 18000 # Node ID 2cd5ee197ec739b7daca0fc4da722c0520bdeeb4 Imported from capsule None diff -r 000000000000 -r 2cd5ee197ec7 GMAJ.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GMAJ.py Mon Jan 27 09:26:22 2014 -0500 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +""" +Script that Creates a zip file for use by GMAJ +""" +import sys, zipfile + +def __main__(): + #create a new zip file + out_file = zipfile.ZipFile( sys.argv[1], "w" ) + #add info files + out_file.write( sys.argv[3], "input.gmaj" ) #THIS FILE MUST BE ADDED FIRST + out_file.write( sys.argv[2], "input.maf" ) + + #add annotation files + for line in open( sys.argv[4] ): + try: + out_file.write( *[ field.strip() for field in line.split( "=", 1 ) ] ) + except: + continue + out_file.close() + +if __name__ == "__main__": __main__() diff -r 000000000000 -r 2cd5ee197ec7 GMAJ.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GMAJ.xml Mon Jan 27 09:26:22 2014 -0500 @@ -0,0 +1,210 @@ + +Multiple Alignment Viewer + GMAJ.py $out_file1 $maf_input $gmaj_file $filenames_file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:gmaj + +title = "Galaxy: $maf_input.name" +alignfile = input.maf +refseq = $refseq +tabext = .bed .gff .gtf +#if $nowarn.value: +nowarn = $nowarn +#end if + +#set $seq_count = 0 +#for $annotation_count, $annotation in $enumerate( $annotations ): +#if $annotation.annotation_style.style == "galaxy": +#set $species_chromosomes = {} +#if $maf_input.dataset.metadata.species_chromosomes: +#for $line in open( $maf_input.dataset.metadata.species_chromosomes.file_name ): +#set $fields = $line.split( "\t" ) +#if $fields: +#set $spec = $fields.pop( 0 ) +#set $species_chromosomes[spec] = $fields +#end if +#end for +#end if +#if $species_chromosomes and $annotation.annotation_style['species'].value in $species_chromosomes and $species_chromosomes[$annotation.annotation_style['species'].value]: +#set $seq_names = [ "%s.%s" % ( $annotation.annotation_style['species'].value, $chrom ) for $chrom in $species_chromosomes[$annotation.annotation_style['species'].value]] +#else: +#set $seq_names = [$annotation.annotation_style['species']] +#end if +#else: +#set $seq_names = [$annotation.annotation_style['seq_name']] +#end if +#for $seq_name in $seq_names: +seq ${seq_count}: +seqname = $seq_name +#if $annotation.annotation_style['exons_file'].dataset: +exons = ${annotation_count}.exons.${annotation.annotation_style['exons_file'].extension} +#end if +#if $annotation.annotation_style['repeats_file'].dataset: +repeats = ${annotation_count}.repeats.${annotation.annotation_style['repeats_file'].extension} +#end if +#if $annotation.annotation_style['links_file'].dataset: +links = ${annotation_count}.links.${annotation.annotation_style['links_file'].extension} +#end if +#if $annotation.annotation_style['underlays_file'].dataset: +underlays = ${annotation_count}.underlays.${annotation.annotation_style['underlays_file'].extension} +#end if +#if $annotation.annotation_style['highlights_file'].dataset: +highlights = ${annotation_count}.highlights.${annotation.annotation_style['highlights_file'].extension} +#end if +#if $annotation.annotation_style.style == "basic": +offset = $annotation.annotation_style['offset'] +#end if + +#set $seq_count = $seq_count + 1 +#end for +#end for + + +#for $annotation_count, $annotation in $enumerate( $annotations ): +#if $annotation.annotation_style['exons_file'].dataset: +$annotation.annotation_style['exons_file'] = ${annotation_count}.exons.${annotation.annotation_style['exons_file'].extension} +#end if +#if $annotation.annotation_style['repeats_file'].dataset: +$annotation.annotation_style['repeats_file'] = ${annotation_count}.repeats.${annotation.annotation_style['repeats_file'].extension} +#end if +#if $annotation.annotation_style['links_file'].dataset: +$annotation.annotation_style['links_file'] = ${annotation_count}.links.${annotation.annotation_style['links_file'].extension} +#end if +#if $annotation.annotation_style['underlays_file'].dataset: +$annotation.annotation_style['underlays_file'] = ${annotation_count}.underlays.${annotation.annotation_style['underlays_file'].extension} +#end if +#if $annotation.annotation_style['highlights_file'].dataset: +$annotation.annotation_style['highlights_file'] = ${annotation_count}.highlights.${annotation.annotation_style['highlights_file'].extension} +#end if +#end for + + + + + + +.. class:: infomark + +**Reference Sequence:** +The default option, "First sequence in each block", is the correct choice for the vast majority of MAF alignments. The alternative, "Any sequence", will allow you to flip the blocks to view them with any of the MAF sequences as the reference, but this is only appropriate if the file was generated by a sequence-symmetric alignment program such as TBA_. Using "Any sequence" with an ordinary MAF will **not** give the same results as if that alignment had been run with a different reference sequence. + +.. class:: infomark + +**Annotation Style:** +The default style, "Galaxy", specifies one set of annotations for each species in the MAF file; it assumes that if you have, say, exons for several chromosomes of one species, they are all together in one file. The other style, "Basic", is more flexible but cumbersome: a separate set of files is specified for each sequence (e.g. chromosome), and you must fill in the full sequence name as it appears in the MAF. The Basic style also allows you to provide a display offset that GMAJ will add to all of the position labels for that sequence. With either style, specifying more than one set of annotations for the same sequence will result in an error message from GMAJ. + +---- + +**What it does** + +GMAJ is an interactive viewer for MAF alignments, with support for optional annotation data. In addition to browsing the alignments, you can select and export them according to a variety of criteria and send the output back to your Galaxy history. + +For detailed information on GMAJ, click here_. + + +------ + +**Citation** + +If you use GMAJ, please cite `Blanchette M, Kent WJ, Riemer C, Elnitski L, Smit AF, Roskin KM, Baertsch R, Rosenbloom K, Clawson H, Green ED, Haussler D, Miller W. Aligning multiple genomic sequences with the threaded blockset aligner. Genome Res. 2004 Apr;14(4):708-15. <http://www.ncbi.nlm.nih.gov/pubmed/15060014>`_ and http://globin.cse.psu.edu/dist/gmaj/. + +If you use this tool in Galaxy, please cite `Blankenberg D, Taylor J, Nekrutenko A; The Galaxy Team. Making whole genome multiple alignments usable for biologists. Bioinformatics. 2011 Sep 1;27(17):2426-2428. <http://www.ncbi.nlm.nih.gov/pubmed/21775304>`_ + + +.. _here: /static/gmaj/docs/gmaj_readme.html +.. _TBA: http://www.bx.psu.edu/miller_lab/ + +