Mercurial > repos > mgarnier > catchsequence
changeset 0:c30eb2050ef5 draft default tip
Uploaded
author | mgarnier |
---|---|
date | Thu, 26 Aug 2021 13:41:33 +0000 |
parents | |
children | |
files | catchsequence/catchsequence.pl catchsequence/catchsequence.xml |
diffstat | 2 files changed, 157 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/catchsequence/catchsequence.pl Thu Aug 26 13:41:33 2021 +0000 @@ -0,0 +1,111 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +#INPUTS_ +# my $Result_RES = $ARGV[0]; +my $sequences = $ARGV[0]; + +#OUTPUT_ +#my $output = $ARGV[1]; + +#my @list_seq = split(/,/,$sequences); +my @list_seq = @ARGV; + +########################################################################################## + +#open (OUT, ">$output"); +print "SEQUENCE\tRESISTANCE GENES\tPLASMIDS\tVIRULENCE GENES\tMLST NUMBER\tGENE(ALLELE)\n"; + +foreach my $sequence (@list_seq) { + my $Result_RES = `abricate --db resfinder $sequence > $sequence.RES.txt`; #appel système de la commande abricate avec la BDD ResFinder + my $Result_PLA = `abricate --db plasmidfinder $sequence > $sequence.PLA.txt`; #appel système de la commande abricate avec la BDD PlasmidFinder + my $Result_VIR = `abricate --db vfdb $sequence > $sequence.VIR.txt`; + my $Result_MLST = `mlst $sequence > $sequence.MLST.txt`; + + open (RES, "$sequence.RES.txt"); + print "$sequence\t"; + + while (<RES>) { + + chomp(); + if ($_ !~ m/^#/) { + my @infos = split(/\t/,$_); + my $geneRes = $infos[5]; # resistance gene name (ancienne valeur $infos[4]) + my $identity = $infos[10]; # identity % (ancienne valeur $infos[9]) + + if ($identity > 90.000) { + print "$geneRes;"; + } + } + + } + + close (RES); + print "\t"; + + + open (PLA, "$sequence.PLA.txt") or die "could not open $!"; + + while (<PLA>) { + chomp(); + if ($_ !~ m/^#/) { + my @infos = split(/\t/,$_); + my $plasmid = $infos[5]; # plasmid name + my $identity = $infos[10]; # identity % + + if ($identity > 90.000) { + print"$plasmid;"; + } + } + + } + close (PLA); + print "\t"; + + open (VIR, "$sequence.VIR.txt") or die "could not open $!"; + + while (<VIR>) { + chomp(); + + if ($_ !~ m/^#/) { + my @infos = split(/\t/,$_); + my $geneVir = $infos[5]; # virulence gene name + my $identity = $infos[10]; # identity % + + if ($identity > 80.000) { + print "$geneVir;"; + } + } + + } + close (VIR); + print "\t"; + + + open (MLST, "$sequence.MLST.txt") or die "could not open $!"; + + while (<MLST>) { + chomp(); + + my @infos = split(/\t/,$_); + my $numMLST = $infos[2]; + print "$numMLST\t"; + + for (my $i=3; $i <= $#infos; $i++){ + print "$infos[$i];"; + } + + } + close (MLST); + print "\n"; +} + +#close (OUT); + +unlink glob ('*.VIR.txt'); +unlink glob ('*.PLA.txt'); +unlink glob ('*.RES.txt'); +unlink glob ('*.MLST.txt'); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/catchsequence/catchsequence.xml Thu Aug 26 13:41:33 2021 +0000 @@ -0,0 +1,46 @@ +<tool id="catchsequence" name="Catch Sequence" version="0.1.0"> + <description>Catch sequence for BioloMICS import</description> +<requirements> + <requirement type="package" version="1.0.1">abricate</requirement> + <requirement type="package" version="2.19.0">mlst</requirement> + <!--<requirement type="package" version="6.6.0">emboss</requirement> + <requirement type="package" version="1.3.2">pandas</requirement>--> +</requirements> + + +<command detect_errors="aggressive"><![CDATA[ + +#import re + ## Creates symlinks for each input file based on the Galaxy 'element_identifier' + ## Used so that a human-readable name appears in the output table (instead of 'dataset_xyz.dat') + #set $named_input_files = '' + #for $input_file in $input_files + ## Add single quotes around each input file identifier + #set $_input_file = "'{}'".format($input_file.element_identifier) + ln -s '${input_file}' ${_input_file} && + #set $named_input_files = $named_input_files + ' ' + $_input_file + #end for + + + perl '$__tool_directory__/catchsequence.pl' $named_input_files > "$output" + + + +]]></command> + <!-- perl '$__tool_directory__/nucleScore.pl' $_input_file > "$output" --> + <!-- ./nuclescore.sh ${named_input_files} > "$output" --> + +<inputs> + <param type="data" name="input_files" format="fasta" multiple="true" label="Genome fasta files"/> + <!-- <param format="fasta" name="input_files" type="data" label="Genome fasta file : " multiple="true" display="checkboxes"/> --> +</inputs> + + <outputs> + <data format="tabular" name="output" /> + </outputs> + +<help> +No documentation + </help> + +</tool>