[Bio] / FigKernelScripts / get_PATRIC_AMR_genome_list.pl Repository:
ViewVC logotype

View of /FigKernelScripts/get_PATRIC_AMR_genome_list.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Sep 17 18:11:03 2015 UTC (4 years, 1 month ago) by jdavis
Branch: MAIN
CVS Tags: HEAD
adding get_PATRIC_AMR_genome_list.pl

#! /usr/bin/env perl
use strict;
use Getopt::Long;
use Data::Dumper;

my $usage = 'get_PATRIC_AMR_genome_list.pl [options]  output.SUS output.RES
			 options
			 -a antibiotic
			 -o output
			 -s species string "will grep anything matching this string for genus species"
			 -h help
			
			The program curls the AMR data from the PATRIC FTP and returns 
			the gene list for Res and Sus strains for a given antibiotic and 
			string matching the genus species
';

my ($help, $ant, $output, $species);
my $n = 100;
my $rc = GetOptions('a=s'  => \$ant,
                    'o=s'  => \$output,
                    's=s'  => \$species,
                    'h'    => \$help);

if ($help){die "$usage\n";}
unless (($ant) && ($output) && ($species)){die "$usage\n";}

#Read in the kmer file from the ftp site.
open (IN, "curl \"ftp\:\/\/ftp.patricbrc.org\/BRC_Mirrors\/AMR\/PATRIC_genomes_AMR.tab\" | grep \"$species\" | grep \"$ant\" |");

open (RES, ">$output.RES");
open (SUS, ">$output.SUS");

while (<IN>)
{
	chomp;
	my ($id, $name, $ant, $mic_orig, $mic_sign, $mic_num, $sir) = split /\t/;
	if ($sir =~ /R/)
	{
		print RES "$_\n";
	}
	elsif ($sir =~ /S/)
	{
		print SUS "$_\n";
	}
}



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3