Mercurial > repos > cpt > cpt_convert_trnascan_se
changeset 0:b4134ad44443 draft
Uploaded
author | cpt |
---|---|
date | Fri, 13 May 2022 18:03:32 +0000 |
parents | |
children | 7bf46fd8d62e |
files | cpt_trnascanse_to_gff/cpt-macros.xml cpt_trnascanse_to_gff/macros.xml cpt_trnascanse_to_gff/tRNAscan_to_gff_SE_format.py cpt_trnascanse_to_gff/tRNAscan_to_gff_SE_format.xml cpt_trnascanse_to_gff/test-data/ConvTrnaSe_In.tabular cpt_trnascanse_to_gff/test-data/ConvTrnaSe_Out.gff3 |
diffstat | 6 files changed, 260 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_trnascanse_to_gff/cpt-macros.xml Fri May 13 18:03:32 2022 +0000 @@ -0,0 +1,115 @@ +<?xml version="1.0"?> +<macros> + <xml name="gff_requirements"> + <requirements> + <requirement type="package" version="2.7">python</requirement> + <requirement type="package" version="1.65">biopython</requirement> + <requirement type="package" version="2.12.1">requests</requirement> + <yield/> + </requirements> + <version_command> + <![CDATA[ + cd $__tool_directory__ && git rev-parse HEAD + ]]> + </version_command> + </xml> + <xml name="citation/mijalisrasche"> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex">@unpublished{galaxyTools, + author = {E. Mijalis, H. Rasche}, + title = {CPT Galaxy Tools}, + year = {2013-2017}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + </xml> + <xml name="citations"> + <citations> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {E. Mijalis, H. Rasche}, + title = {CPT Galaxy Tools}, + year = {2013-2017}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </citations> + </xml> + <xml name="citations-crr"> + <citations> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {C. Ross}, + title = {CPT Galaxy Tools}, + year = {2020-}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </citations> + </xml> + <xml name="citations-2020"> + <citations> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {E. Mijalis, H. Rasche}, + title = {CPT Galaxy Tools}, + year = {2013-2017}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {A. Criscione}, + title = {CPT Galaxy Tools}, + year = {2019-2021}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </citations> + </xml> + <xml name="citations-2020-AJC-solo"> + <citations> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {A. Criscione}, + title = {CPT Galaxy Tools}, + year = {2019-2021}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </citations> + </xml> + <xml name="citations-clm"> + <citations> + <citation type="doi">10.1371/journal.pcbi.1008214</citation> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {C. Maughmer}, + title = {CPT Galaxy Tools}, + year = {2017-2020}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </citations> + </xml> + <xml name="sl-citations-clm"> + <citation type="bibtex"> + @unpublished{galaxyTools, + author = {C. Maughmer}, + title = {CPT Galaxy Tools}, + year = {2017-2020}, + note = {https://github.com/tamu-cpt/galaxy-tools/} + } + </citation> + <yield/> + </xml> +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_trnascanse_to_gff/macros.xml Fri May 13 18:03:32 2022 +0000 @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<macros> + <xml name="requirements"> + <requirements> + <requirement type="package" version="3.7">python</requirement> + <requirement type="package" version="1.77">biopython</requirement> + <requirement type="package" version="1.1.3">cpt_gffparser</requirement> + <yield/> + </requirements> + </xml> + <xml name="genome_selector"> + <conditional name="reference_genome"> + <param name="reference_genome_source" type="select" label="Reference Genome"> + <option value="history" selected="True">From History</option> + <option value="cached">Locally Cached</option> + </param> + <when value="cached"> + <param name="fasta_indexes" type="select" label="Source FASTA Sequence"> + <options from_data_table="all_fasta"/> + </param> + </when> + <when value="history"> + <param name="genome_fasta" type="data" format="fasta" label="Source FASTA Sequence"/> + </when> + </conditional> + </xml> + <xml name="gff3_input"> + <param label="GFF3 Annotations" name="gff3_data" type="data" format="gff3"/> + </xml> + <xml name="input/gff3+fasta"> + <expand macro="gff3_input" /> + <expand macro="genome_selector" /> + </xml> + <token name="@INPUT_GFF@"> + "$gff3_data" + </token> + <token name="@INPUT_FASTA@"> +#if str($reference_genome.reference_genome_source) == 'cached': + "${reference_genome.fasta_indexes.fields.path}" +#else if str($reference_genome.reference_genome_source) == 'history': + genomeref.fa +#end if + </token> + <token name="@GENOME_SELECTOR_PRE@"> +#if $reference_genome.reference_genome_source == 'history': + ln -s $reference_genome.genome_fasta genomeref.fa; +#end if + </token> + <token name="@GENOME_SELECTOR@"> +#if str($reference_genome.reference_genome_source) == 'cached': + "${reference_genome.fasta_indexes.fields.path}" +#else if str($reference_genome.reference_genome_source) == 'history': + genomeref.fa +#end if + </token> + <xml name="input/fasta"> + <param label="Fasta file" name="sequences" type="data" format="fasta"/> + </xml> + + <token name="@SEQUENCE@"> + "$sequences" + </token> + <xml name="input/fasta/protein"> + <param label="Protein fasta file" name="sequences" type="data" format="fasta"/> + </xml> +</macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_trnascanse_to_gff/tRNAscan_to_gff_SE_format.py Fri May 13 18:03:32 2022 +0000 @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import fileinput + +print ("##gff-version-3") +# process each trna in tsv file +metaLines = 0 +for trna in fileinput.input(): + if metaLines < 3: + metaLines += 1 + continue + cols_tsv = trna.split("\t") + if int(cols_tsv[2]) < int(cols_tsv[3]): + cols_gff = [ + cols_tsv[0].strip(), + "tRNAscan", + "tRNA", + cols_tsv[2].strip(), + cols_tsv[3].strip(), + cols_tsv[8], + "+", + ".", + 'ID=trna.%s;Anticodon=%s;Codon=tRNA-%s' + % (cols_tsv[1], cols_tsv[5].lower(), cols_tsv[4]), + ] + else: + cols_gff = [ + cols_tsv[0].strip(), + "tRNAscan", + "tRNA", + cols_tsv[3].strip(), + cols_tsv[2].strip(), + cols_tsv[8], + "-", + ".", + 'ID=trna.%s;Anticodon=%s;Codon=tRNA-%s' + % (cols_tsv[1], cols_tsv[5].lower(), cols_tsv[4]), + ] + print ("\t".join(cols_gff))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_trnascanse_to_gff/tRNAscan_to_gff_SE_format.xml Fri May 13 18:03:32 2022 +0000 @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<tool id="tRNA-SE_scan_to_gff" name="Convert tRNAscan-SE table to gff format" version="20.0.0"> + <description></description> + <macros> + <import>macros.xml</import> + <import>cpt-macros.xml</import> + </macros> + <expand macro="requirements"/> + <command detect_errors="aggressive"><![CDATA[ +python $__tool_directory__/tRNAscan_to_gff_SE_format.py +< $trnascan +> $output +]]></command> + <inputs> + <param format="tabular" type="data" name="trnascan" label="tRNAscan table" /> + </inputs> + <outputs> + <data format="gff3" name="output"> + </data> + </outputs> + <tests> + <test> + <param name="trnascan" value="ConvTrnaSe_In.tabular" /> + <output name="output" file="ConvTrnaSe_Out.gff3" /> + </test> + </tests> + <help><![CDATA[ +What it does +============ + +Converts tRNAscan-SE table to gff format + +]]></help> + <expand macro="citations" /> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_trnascanse_to_gff/test-data/ConvTrnaSe_In.tabular Fri May 13 18:03:32 2022 +0000 @@ -0,0 +1,4 @@ +Sequence tRNA Bounds tRNA Anti Intron Bounds Inf +Name tRNA # Begin End Type Codon Begin End Score Note +-------- ------ ----- ------ ---- ----- ----- ---- ------ ------ +NC_028755.1 1 49264 49339 Gly TCC 0 0 77.4