Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to calculate GC content !

  • Public
By BioStar 296 days ago
#!/usr/bin/perl sub calculate_gc_content { my ($sequence) = @_; $sequence = uc($sequence); # Convert the sequence to uppercase my $gc_count = () = $sequence =~ /[GC]/g; my $total_bases = length($sequence); my $gc_content = ($gc_count / $total_bases) * 100; return $gc_content; } # Example usage: my $dna_sequence = "ATGCGCTAAAGCGAGCGAAGCGCTAGATCGATCGATCGATCGATCGATCGATCGATCGATCG"; my $gc_content = calculate_gc_content($dna_sequence); printf "GC content: %.2f%%\n", $gc_content;