2901 days ago
Read lines from input file – print lines that match a regular expression
...chomp $line; if ($line =~ /^ATG?C*[ATCG]+?A{3,10}$/) { print "$line\n"; } } exit(); __DATA__ ATGCCCAA ATGCCCAAAA ATGCCCAAAAAAAAAAAAAAAA...2901 days ago
BioPerl to convert between sequence formats from Fasta to Genbank
#!/usr/local/bin/perl -w # Sequence formats to choose: Fasta, EMBL. GenBank, Swissprot, PIR and GCG use Bio::SeqIO; $inFile = "BRCA2.fa"; $in = Bio::SeqIO->newFh('-file...2900 days ago
Extract a random sequence from a file
...put.txt'; open my $in_fh, '', $outputfile; my $size = 21; my $count = 10; while (my $line = ) { next unless $line =~ /^([ATGCN]+)/; my $genome =...2899 days ago
Find and replace ambiguous characters in fasta file with Perl and Bioperl
...er\n". "Print out the name of sequences with characters other than ATGC-.\n". "If -m is specifie...t; sub AmbiguousChar { my $string = shift; $string =~ s/[ATGC-]//g; $string =~ s/\s+...2898 days ago
Perl to print indivisual nucleotide from a sequence!
#!/usr/bin/perl use strict; use warnings; my $string = "ATGCTTGCGT?AAATG??CT?GCGTA"; my @chars = split("", $string); print "First character: $chars[0]\n";2898 days ago
Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl
#!/usr/bin/perl -w use strict; my $subject = "AACGTACTGACGTACTGGTTGGTACGA"; my %results = (); while ($subject =~ m/[ACTG][ATGC]/g) { # matched text = $& if(exi...2893 days ago
Count GC Content in nucleotide sequence with Perl
...!/usr/bin/perl -w ### Usage: get_gc_content.pl...asta_file = $ARGV[0]; $out_file = "gc_out.txt"; unless ( open(IN,...----------------- print OUT "ID\t% GCContent\tTotal Count\tG Count\...acount = 0; $tcount = 0; $gcount = 0; $ccount = 0;...2889 days ago
Implementation of biological random mutation with Perl
#!/usr/bin/perl -w use strict; use warnings; #sequence for a better recognition my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \ n";...2885 days ago
Perl script introduces control structures, arrays and hashes.
...n/env perl use strict; use warnings; my @first_array = ('DNA', 'ATGCGTGC', 5, 'RNA', 'AUGC'); print $...ng_size_of_array\n\n"; # Control Loop: for for (my $i=0; $i 'ATCGATGCT', 'RNA' =>...2846 days ago