Skip to content
Snippets Groups Projects
Commit 8d93d13a authored by Graham McVicker's avatar Graham McVicker
Browse files

more cruft removal

parent 1e1fbf33
No related branches found
No related tags found
No related merge requests found
my %contigs;
while (<>) {
chomp;
if ($_ =~ /(\S+)\.\d+\.\d+\.\d+/) {
push (@{$contigs{$1}},$_);
}
elsif ($_ =~ /(\S+)\.\d+\.(\d+)/) {
if ($2 =~ /^1/) {
push (@{$contigs{$1}},$_);
}
else {
#print "Couldn't parse line $_\n";
}
}
else {
#print "Couldn't parse line $_\n";
}
}
my %idmap;
foreach my $clone (keys %contigs) {
my %clone;
my $c=0;
foreach my $line (@{$contigs{$clone}}) {
#print "Parsing line $line\n";
if ($line =~ /\S+\.\d+\.(\d+)\.\d+/) {
$clone{$1}=$line;
}
elsif ($_ =~ /(\S+)\.\d+\.(\d+)/) {
$clone{1}=$line;
$c++;
}
if ($c > 1) {
#print "BARF\n";
}
}
#print "Sorted by start lines for clone $clone:\n";
my $c=1;
foreach $line (sort {$a <=> $b} (keys %clone)) {
my $id = "0000$c";
while (length ($id) > 5) {
$id =~ s/^0//g;
}
my $final = "$clone.$id";
$idmap{$line}=$final;
print $clone{$line}." $final\n";
$c++;
}
#print "\n";
}
#USe with:
#mkdir temp/
#cd temp/
#ls ../*.pm | xargs -i perl /work2/elia/src/ensembl/misc-scripts/utilities/dbsql_dbold.pl {}
#mv -f *.pm ../
#rm -rf temp/
my $file=shift(@ARGV);
open (FILE,"<$file");
$file =~ /(\w+\.pm)/;
my $new = $1;
open (NEW,">$new");
while (<FILE>) {
$line =$_;
$line =~ s/DBSQL/DBOLD/g;
print NEW $line;
}
my %map;
my $file = pop (@ARGV);
foreach my $f (@ARGV) {
#print "Reading $f\n";
open ($f,"<$f");
while (<$f>) {
chomp;
$_ =~ /(\S+)\s+(\S+)/;
$map{$1}=$2;
}
close ($f);
}
open (FILE,"<$file");
while (<FILE>) {
chomp;
my @tabs = split(/\t/);
my $line;
foreach my $tab (@tabs) {
if ($map{$tab}) {
$line .= $map{$tab}."\t";
}
else {
$line .= $tab."\t";
}
}
$line =~ s/\t$//g;
print "$line\n";
}
my %map;
my $file = pop (@ARGV);
foreach my $f (@ARGV) {
#print "Reading $f\n";
open ($f,"<$f");
while (<$f>) {
chomp;
$_ =~ /(\S+)\s+(\S+)/;
$map{$2}=$1;
}
close ($f);
}
open (FILE,"<$file");
while (<FILE>) {
chomp;
my @tabs = split(/\t/);
my $line;
foreach my $tab (@tabs) {
if ($map{$tab}) {
$line .= $map{$tab}."\t";
}
else {
$line .= $tab."\t";
}
}
$line =~ s/\t$//g;
print "$line\n";
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment