Created
November 1, 2012 04:52
-
-
Save ChemicalJames/3991907 to your computer and use it in GitHub Desktop.
GEN220 HW5 BioPerl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use Bio::DB::Fasta; | |
use Bio::Seq; | |
use Bio::SeqIO; | |
my $file = 'sacharomyces_cerevisiae_S288C.fa'; | |
my $db = Bio::DB::Fasta->new($file); | |
my $piece = $db->seq('chrI',54584 => 54913); | |
print "Sequence from ChromosomeI 54584..54913.\n", "$piece\n"; | |
my $seq = Bio::Seq->new(-seq =>$piece); | |
print "Amino acid sequence.\n", $seq->translate->seq, "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Bio::SeqIO; | |
my $file = 'seqs.gbk'; | |
my $in = Bio::SeqIO->new(-file => $file , | |
-format => 'genbank'); | |
my ($count); | |
while ( my $seq = $in->next_seq) { | |
$count++; | |
print $seq->display_id, ":\n"; | |
my $cds = 0; | |
for my $feature ( $seq->get_SeqFeatures ) { | |
if ( $feature->primary_tag eq 'CDS' ) { | |
$cds ++; | |
my $length = $feature->end - $feature->start; | |
print "CDS Identified! Length is $length\n"; | |
} | |
} | |
print "Number of CDS features is $cds\n"; | |
} | |
printf $file, $count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use Bio::SearchIO; | |
my $cutoff = '0.001'; | |
my $file = 'basidio.BLASTP'; | |
my $in = Bio::SearchIO->new(-format => 'blast', | |
-file => $file); | |
while( my $r = $in->next_result ) { | |
print "Query is: ", $r->query_name, " ", | |
$r->query_description," ",$r->query_length," aa\n"; | |
print " Matrix was ", $r->get_parameter('matrix'), "\n"; | |
while( my $h = $r->next_hit ) { | |
last if $h->significance > $cutoff; | |
print "Hit is ", $h->name, "\n"; | |
while( my $hsp = $h->next_hsp ) { | |
print " HSP Len is ", $hsp->length('total'), " ", | |
" E-value is ", $hsp->evalue, " Bit score ", | |
$hsp->score, " \n", | |
" Query loc: ",$hsp->query->start, " ", | |
$hsp->query->end," ", | |
" Sbject loc: ",$hsp->hit->start, " ", | |
$hsp->hit->end,"\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
last one is just a copy of the slides from the class and doesn't print out the tab delimited report as requested.