Great!! Thank you very much Ram. I am running the script, however, it is not giving me what I want. Not sure if something is wrong with the screen_complete_proteome_from_uniprot_division.pl script
Here is what it looks like:
*
#!/usr/bin/env perl
use strict;
use warnings;
use G;
# perl screen_complete_proteome_from_uniprot_division.pl EBML_format.dat
## EMBL_format.dat ex : uniprot_sprot_archaea.dat
my $input = shift;
my %out = &get_fasta($input);
sub get_fasta{
my $input = $_[0];
my $tree = readFile($input, -format=>"swiss" );
my ($dat, $div) = (split /\_/, $input)[1,2];
$div =~ s/.dat//;
foreach my $entry ( sort keys %{$tree} ) {
if( defined $tree->{$entry}->{KW} && $tree->{$entry}->{KW} =~ /Complete\sproteome/ ) {
next if $tree->{$entry}->{OC} =~ /Tardigrada/ ;
# next if $tree->{$entry}->{OC} =~ /Nematoda/ ;
# next if $tree->{$entry}->{OC} =~ /Arthropoda/ ;
my %fasta;
my $seq = $tree->{$entry}->{" "};
$seq =~ s/\s+//g;
say $tree->{$entry}->{LOCUS}->{id}."|".$dat."|".$div if $tree->{$entry}->{OC} =~ /Metazoa/;
$fasta{$tree->{$entry}->{LOCUS}->{id}."|".$dat."|".$div} = $seq;
say to_fasta(%fasta);
}
}
}
*
Would you be able to help me figuring it out?
I appreciate your input very very much!
I have some doubts that this is working as intended. What is it you're trying to do ?
For instance, while the bash script will unzip all dat.gz files, the perl line will repeatedly work on the string uniprot_sprot_archaea.dat. The split part extract the string archae and so the perl one-liner will print the following every time the bash script unzips a file:
perl screen_complete_proteome_from_uniprot_division.pl $i >> uniprot_archaea.fasta
Note the presence of $i in the output, this is because the \ preceding $i, tells perl to not interpret the $ sign as indicating a variable.
I am very confused here. I think the main execution here is based on the perl script. I have provided it below.
The entire idea is to extract sequences with “Complete Proteome” in the Keyword from files downloaded (Swiss-Prot and TrEMBL). All I am trying to do is repeating some analyses from this paper. http://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2002266#sec014 (method section HGT analyses)
The script screen_complete_proteome_from_uniprot_division.pl is never executed when you run the bash script you posted. If you want to execute it from within the perl one-liner, one option is to use the qx operator, i.e. replace print by qx, but that's not the only problem you have.
Thanks very much. I will replace the print with qx. Also, if you don't mind and have time to spend, is it possible to point out the other problems?
Thanks like a ocean!!
For every file that is unzipped, the bash script passes the string 'uniprot_sprot_archaea.dat' to perl, i.e. it's always printing the line: perl screen_complete_proteome_from_uniprot_division.pl $i >> uniprot_archaea.fasta
Maybe you want run the script screen_complete_proteome_from_uniprot_division.pl on each unzipped file ? Then try something along these lines:
Great. Thank you! I will try these...
I'd recommend redirecting stdout of the bash script to a file and executing that file. Running the perl script from a loop will make debugging more difficult.