in reply to Split Function - Positions
#! /usr/bin/perl -w use strict; my (@genes, @positions); my $screen = "ATCGATCGXXXXXATCGATXXXACTGCTACGGTACXXXAATTATXGCGCGXXT"; if ($screen =~ /X/) { my @parts = split /(X+)/, $screen; my $pos = 0; foreach my $part (@parts) { if ($part !~ /X/) { push @genes, $part; push @positions, $pos; print "Gene $part is at position $pos\n"; } $pos += length $part; } my $genecounter = @genes; print "Number of components = $genecounter\n\n"; }
-Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split Function - Positions
by tkil (Monk) on Jun 02, 2004 at 04:51 UTC |