BioPerl

 view release on metacpan or  search on metacpan

examples/Bio-DB-GFF/load_ucsc.pl  view on Meta::CPAN

#!/usr/bin/perl

use strict;

use enum qw(:u_ refmethod refsource refgroup refseq refstart refstop refscore refstrand refphase qrystart qrystop sizes starts);
use enum qw(:v_ refmethod refsource refgroup refseq refstrand refscore refphase txstart txstop cdsstart cdsstop exonstarts exonstops);

use enum qw(:all_bacends__ x matches misMatches repMatches nCount qNumInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:all_est__     bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:all_mrna__   bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:all_sts_primer__ matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:all_sts_seq__    matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:bacEndPairs__ bin chrom chromStart chromEnd name score strand pslTable lfCount lfStarts lfSizes lfNames);
use enum qw(:blatFish__  bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:gap__ bin chrom chromStart chromEnd ix n size type bridge);
use enum qw(:gl__ bin frag start end strand);
use enum qw(:gold__ bin chrom chromStart chromEnd ix type frag fragStart fragEnd strand);
use enum qw(:intronEst__ bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:mrna__      bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:rmsk__      bin swScore milliDiv milliDel milliIns genoName genoStart genoEnd genoLeft strand repName repClass repFamily repStart repEnd repLeft id);
use enum qw(:clonePos__ name seqSize phase chrom chromStart chromEnd stage faFile);
use enum qw(:ctgPos__ contig size chrom chromStart chromEnd);
use enum qw(:cytoBand__ chrom chromStart chromEnd name gieStain);
use enum qw(:fishClones__ chrom chromStart chromEnd name score placeCount bandStarts bandEnds labs placeType accCount accNames stsCount stsNames beCount beNames);
use enum qw(:gcPercent__ chrom chromStart chromEnd name gcPpt);
use enum qw(:genscan__ name chrom strand txStart txEnd cdsStart cdsEnd exonCount exonStarts exonEnds);
use enum qw(:genscanSubopt__ bin chrom chromStart chromEnd name score strand);
use enum qw(:jaxOrtholog__ humanSymbol humanBand mgiId mouseSymbol mouseChr mouseCm mouseBand);
use enum qw(:refGene__ name chrom strand txStart txEnd cdsStart cdsEnd exonCount exonStarts exonEnds);
use enum qw(:refLink__ name product mrnaAcc protAcc geneName prodName locusLinkID omimId);
use enum qw(:refSeqAli__    bin matches misMatches repMatches nCount qNumInsert qBaseInsert tNumInsert tBaseInsert strand qName qSize qStart qEnd tName tSize tStart tEnd blockCount blockSizes qStarts tStarts);
use enum qw(:simpleRepeat__ bin chrom chromStart chromEnd name period copyNum consensusSize perMatch perIndel score A C G T entropy sequence);
use enum qw(:stsAlias__ alias identNo trueName);
use enum qw(:stsInfo__ identNo name gbCount genbank gdbCount gdb nameCount otherNames dbSTSid otherDbstsCount otherDbSTS leftPrimer rightPrimer distance organism sequence otherUCSCcount otherUCSC mergeUCSCcount mergeUCSC genethonName genethonChr gene...
use enum qw(:stsMap__ chrom chromStart chromEnd name score identNo ctgAcc otherAcc genethonChrom genethonPos marshfieldChrom marshfieldPos gm99Gb4Chrom gm99Gb4Pos shgcTngChrom shgcTngPos shgcG3Chrom shgcG3Pos wiYacChrom wiYacPos wiRhChrom wiRhPos fis...
use enum qw(:uniGene_2__ bin chrom chromStart chromEnd name score strand txStart txEnd reserved exonCount exonStarts exonEnds);
###############################################
# end enum
###############################################

my %parentpos;
my %nolandmark = map {$_=>1} qw(gap cpgIsland recombRate_decode recombRate_marshfield recombRate_genethon
								humMusL zoom1_humMusL zoom50_humMusL zoom2500_humMusL
								genscanSubopt simpleRepeat snpNih snpTsc
							   );

foreach my $filename (@ARGV){
  my $newfilename = $filename;
  $newfilename =~ s/txt\.gz/gff/;
  open(my $fhi, "zcat $filename |");
  open(my $fho, ">$newfilename");

  while(my $line = <$fhi>){

  #these three should work the same way as unigene, but the fields are different order
  # $filename =~ /affyRatio/               ? toGFF($line,$fho,['affyRatio',               '', 3, 0, 1, 2, 4, 5,-1,-1,-1,10,11]) :
  # $filename =~ /nci60/                   ? toGFF($line,$fho,['nci60',                   '', 3, 0, 1, 2, 4, 5,-1,-1,-1,10,11]) :
  # $filename =~ /rnaCluster/              ? toGFF($line,$fho,['rnaCluster',              '', 4, 1, 2, 3, 5, 6,-1, 7, 8,11,12]) :

  #these two are not yet handled
  # $filename =~ /cpgIsland/               ? toGFF($line,$fho,['cpgIsland',               '', 3, 0, 1, 2,-1,-1,-1]) :
  # $filename =~ /estOrientInfo/           ? toGFF($line,$fho,['estOrientInfo',           '',]) :


    $filename =~ /uniGene_2/               ? toGFF($line,$fho,['uniGene_2',               '', 4, 1, 2, 3, 5, 6,-1,-1,-1,11,12]) :

    $filename =~ /all_bacends/             ? toGFF($line,$fho,['bacends',                 '', 9,13,15,16,-1, 8,-1,11,12,18,20]) :
    $filename =~ /all_est/                 ? toGFF($line,$fho,['est',                     '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /all_mrna/                ? toGFF($line,$fho,['mrna',                    '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /all_sts_primer/          ? toGFF($line,$fho,['sts_primer',              '', 9,13,15,16,-1, 8,-1,11,12,18,20]) :
    $filename =~ /all_sts_seq/             ? toGFF($line,$fho,['sts_seq',                 '', 9,13,15,16,-1, 8,-1,11,12,18,20]) :
    $filename =~ /blastzBestMouse/         ? toGFF($line,$fho,['blastzBestMouse',         '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /blastzMm2/               ? toGFF($line,$fho,['blastzMm2',               '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /blastzTightMouse/        ? toGFF($line,$fho,['blastzTightMouse',        '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /blatFish/                ? toGFF($line,$fho,['blatFish',                '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /chimpBac/                ? toGFF($line,$fho,['chimpBac',                '',10,14,16,17,-1, 9,-1,12,13,19,21]) :
    $filename =~ /chimpBlat/               ? toGFF($line,$fho,['chimpBlat',               '',10,14,16,17,-1, 9,-1,12,13,19,21]) :



( run in 1.069 second using v1.01-cache-2.11-cpan-364913b4093 )