/usr/share/perl5/Bio/MapIO/fpc.pm is in libbio-perl-perl 1.6.901-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | # fpc.pm,v 1.2.2.1 2005/10/09 15:16:27 jason Exp
#
# BioPerl module for Bio::MapIO::fpc
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Gaurav Gupta <gaurav@genome.arizona.edu>
#
# Copyright AGCoL
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::MapIO::fpc - A FPC Map reader
=head1 SYNOPSIS
# do not use this object directly it is accessed through the Bio::MapIO system
use Bio::MapIO;
-format : specifies the format of the file format is "fpc",
-file : specifies the name of the .fpc file
-readcor : boolean argument, indicating if .cor is to be read
or not. It looks for the .cor file in the same path
as .fpc file.
0 : doesn't read .cor file
1 : reads the .cor file
[default 0]
-verbose : indicates the process of loading of fpc file
my $mapio = Bio::MapIO->new(-format => "fpc",
-file => "rice.fpc",
-readcor => 0,
-verbose => 0);
my $map = $mapio->next_map();
foreach my $marker ( $map->each_markerid() ) {
# loop through the markers associated with the map
# likewise for contigs, clones, etc.
}
=head1 DESCRIPTION
This object contains code for parsing and processing FPC files and creating
L<Bio::Map::Physical> object from it.
For faster access and better optimization, the data is stored internally in
hashes. The corresponding objects are created on request.
We handle reading of the FPC ourselves, since MapIO module of Bioperl adds
too much overhead.
=cut
# Let the code begin...
package Bio::MapIO::fpc;
use strict;
use POSIX;
use Bio::Map::Physical;
use Bio::Map::Clone;
use Bio::Map::Contig;
use Bio::Map::FPCMarker;
use Bio::Range;
use base qw(Bio::MapIO);
my $_readcor;
=head1 Initializer
=head2 _initialize
Title : _initialize
Usage : called implicitly
Function: calls the SUPER::_initialize
Returns : nothing
Args : species, readcor
=cut
sub _initialize{
my ($self,@args) = @_;
my $species;
$self->SUPER::_initialize(@args);
($species,$_readcor) = $self->_rearrange([qw(SPECIES READCOR)], @args);
$_readcor = 0 unless (defined($_readcor));
}
=head1 Access Methods
These methods let you get and set the member variables
=head2 next_map
Title : next_map
Usage : my $fpcmap = $mapio->next_map();
Function: gets the fpcmap from MapIO
Returns : object of type L<Bio::Map::MapI>
Args : none
=cut
sub next_map{
my ($self) = @_;
my $line;
my ($name,$fpcver,$moddate,$moduser,$contigcnt,$clonecnt,$markerscnt,
$bandcnt,$marker,$seqclone);
my ($corfile,$corindex,$BUFFER);
my @cordata;
my %fpcmarker;
my ($contig, $contigNumber);
my $curClone = 0;
my $curMarker = 0;
my $curContig = 0;
my %_clones;
my %_markers;
my %_contigs;
my $ctgzeropos = 1;
my $map = Bio::Map::Physical->new('-units' => 'CB',
'-type' => 'physical');
my $filename = $self->file();
my $fh = $self->{'_filehandle'};
if (defined($_readcor)) {
$map->core_exists($_readcor);
}
else {
$map->core_exists(0);
}
if ($map->core_exists()) {
$corfile = substr($filename,0,length($filename)-3)."cor";
if (open(CORE,$corfile)) {
while(read(CORE,$BUFFER,2)) {
push(@cordata,unpack('n*', $BUFFER));
}
}
else {
$map->core_exists(0);
}
}
## Read in the header
while (defined($line = <$fh>)) {
chomp($line);
if ($line =~ m{^//\s+fpc\s+project\s+(.+)}) { $map->name($1); }
if ($line =~ m{^//\s+([\d.]+)}) {
my $version = $1;
$version =~ /((\d+)\.(\d+))(.*)/;
$map->version($1);
if ($line =~ /User:\s+(.+)/) { $map->modification_user($1); }
}
if ($line =~ m{^//\s+Framework\s+(\w+)\s+(\w+)\s+([-\w]+)\s+(\w+)\s+(\w+)\s+(.+)$})
{
$map->group_type($3) if ($2 eq "Label");
$map->group_abbr($5) if ($4 eq "Abbrev");
}
last unless ($line =~ m{^//});
}
if (!defined($map->group_type()) || !defined($map->group_abbr()) ) {
$map->group_type("Chromosome");
$map->group_abbr("Chr");
}
$_contigs{0}{'range'}{'end'} = 0;
$_contigs{0}{'range'}{'start'} = 0;
## Read in the clone data
while (defined($line = <$fh>)) {
$marker = 0;
$contig = 0;
$seqclone = 0;
$contigNumber = 0;
my ($type,$name);
my (@amatch,@pmatch,@ematch);
my $bandsread = 0;
last if ($line =~ /^Markerdata/);
$line =~ /^(\w+)\s+:\s+"(.+)"/;
## these will be set if we did find the clone line
($type, $name) = ($1, $2);
if ($name =~ /sd1/) {
$seqclone = 1;
}
$_clones{$name}{'type'} = $type;
$_clones{$name}{'contig'} = 0;
$_contigs{'0'}{'clones'}{$name} = 0;
my $temp;
## Loop through the following lines, getting attributes for clone
while (defined($line = <$fh>) && $line !~ /^\s*\n$/) {
if ($line =~ /^Map "ctg(\d+)" Ends (Left|Right) ([-\d]+)/) {
$_clones{$name}{'contig'} = $1;
$_contigs{$1}{'clones'}{$name} = 0;
delete($_contigs{'0'}{'clones'}{$name});
$temp = $3;
$contigNumber = $1;
$line = <$fh>;
$line =~ /^Map "ctg(\d+)" Ends (Left|Right) ([\d]+)/;
$_clones{$name}{'range'}{'start'} = $temp;
$_contigs{$contigNumber}{'range'}{'start'} = $temp
if (!exists($_contigs{$contigNumber}{'range'}{'start'})
|| $_contigs{$contigNumber}{'range'}{'start'}
> $temp );
$_clones{$name}{'range'}{'end'} = $3;
$_contigs{$contigNumber}{'range'}{'end'} = $3
if (!exists($_contigs{$contigNumber}{'range'}{'end'})
|| $_contigs{$contigNumber}{'range'}{'end'} < $3 );
}
elsif ($line =~ /^([a-zA-Z]+)_match_to_\w+\s+"(.+)"/) {
my $matchtype = "match" . lc(substr($1, 0, 1));
$_clones{$name}{$matchtype}{$2} = 0;
}
elsif ($line =~ /^Positive_(\w+)\s+"(.+)"/) {
$_clones{$name}{'markers'}{$2} = 0;
$_markers{$2}{'clones'}{$name} = 0;
$_markers{$2}{'type'} = $1;
$_markers{$2}{'contigs'}{$contigNumber} = 0;
$_contigs{$contigNumber}{'markers'}{$2} = 0;
}
elsif ($line =~ /^Bands\s+(\d+)\s+(\d+)/ && !$bandsread) {
my $i = 0;
my @numbands;
$bandsread = 1;
if ($map->core_exists()) {
while($i<$2){
push(@numbands,$cordata[($1-1)+$i]);
$i++;
}
$_clones{$name}{'bands'} = \@numbands;
}
else {
push(@numbands,$1,$2);
$_clones{$name}{'bands'} = \@numbands;
}
if (exists($_contigs{0}{'clones'}{$name})) {
$_clones{$name}{'range'}{'start'} = $ctgzeropos;
$_clones{$name}{'range'}{'end'} = $ctgzeropos + $2;
$_contigs{0}{'range'}{'end'} = $ctgzeropos + $2;
$ctgzeropos += $2;
}
}
elsif ($line =~ /^Gel_number\s+(.+)/) {
$_clones{$name}{'gel'} = $1;
}
elsif ($line =~ /^Remark\s+"(.+)"/) {
$_clones{$name}{'remark'} .= $1;
$_clones{$name}{'remark'} .= "\n";
if($seqclone == 1 ) {
if( $1 =~ /\,\s+Chr(\d+)\s+/){
$_clones{$name}{'group'} = $1;
}
}
}
elsif ($line =~ /^Fp_number\s+"(.+)"/) {
$_clones{$name}{'fp_number'} = $1;
}
elsif ($line =~ /^Shotgun\s+(\w+)\s+(\w+)/) {
$_clones{$name}{'sequence_type'} = $1;
$_clones{$name}{'sequence_status'} = $2;
}
elsif ($line =~ /^Fpc_remark\s+"(.+)"/) {
$_clones{$name}{'fpc_remark'} .= $1;
$_clones{$name}{'fpc_remark'} .= "\n";
}
}
$curClone++;
print "Adding clone $curClone...\n\r"
if ($self->verbose() && $curClone % 1000 == 0);
}
$map->_setCloneRef(\%_clones);
$line = <$fh>;
while (defined($line = <$fh>) && $line !~ /Contigdata/) {
my ($type,$name);
last if ($line !~ /^Marker_(\w+)\s+:\s+"(.+)"/);
($type, $name) = ($1, $2);
$_markers{$name}{'type'} = $type;
$_markers{$name}{'group'} = 0;
$_markers{$name}{'global'} = 0;
$_markers{$name}{'anchor'} = 0;
while (defined($line = <$fh>) && $line !~ /^\s*\n$/) {
if ($line =~ /^Global_position\s+([\d.]+)\s*(Frame)?/) {
my $position = $1 - floor($1/1000)*1000;
$position = sprintf("%.2f",$position);
$_markers{$name}{'global'} = $position;
$_markers{$name}{'group'} = floor($1/1000);
$_markers{$name}{'anchor'} = 1;
if(defined($2)) {
$_markers{$name}{'framework'} = 1;
}
else {
$_markers{$name}{'framework'} = 0;
}
}
elsif ($line =~ /^Anchor_bin\s+"([\w\d.]+)"/) {
my $grpmatch = $1;
my $grptype = $map->group_type();
$grpmatch =~ /(\d+|\w)(.*)/;
my ($group,$subgroup);
$group = $1;
$subgroup = $2;
$subgroup = substr($subgroup,1) if ($subgroup =~ /^\./);
$_markers{$name}{'group'} = $group;
$_markers{$name}{'subgroup'} = $subgroup;
}
elsif ($line =~ /^Anchor_pos\s+([\d.]+)\s+(F|P)?/){
$_markers{$name}{'global'} = $1;
$_markers{$name}{'anchor'} = 1;
if ($2 eq 'F') {
$_markers{$name}{'framework'} = 1;
}
else {
$_markers{$name}{'framework'} = 0;
}
}
elsif ($line =~ /^anchor$/) {
$_markers{$name}{'anchor'} = 1;
}
elsif ($line =~ /^Remark\s+"(.+)"/) {
$_markers{$name}{'remark'} .= $1;
$_markers{$name}{'remark'} .= "\n";
}
}
$curMarker++;
print "Adding Marker $curMarker...\n"
if ($self->verbose() && $curMarker % 1000 == 0);
}
$map->_setMarkerRef(\%_markers);
my $ctgname;
my $grpabbr = $map->group_abbr();
my $chr_remark;
$_contigs{0}{'group'} = 0;
while (defined($line = <$fh>)) {
if ($line =~ /^Ctg(\d+)/) {
$ctgname = $1;
$_contigs{$ctgname}{'group'} = 0;
$_contigs{$ctgname}{'anchor'} = 0;
$_contigs{$ctgname}{'position'} = 0;
if ($line =~ /#\w*(.*)\w*$/) {
$_contigs{$ctgname}{'remark'} = $1;
if ($line =~ /#\s+Chr(\d+)\s+/) {
$_contigs{$ctgname}{'group'} = $1;
$_contigs{$ctgname}{'anchor'} = 1;
}
}
}
elsif ($line =~ /^Chr_remark\s+"(-|\+|Chr(\d+))\s+(.+)"$/) {
$_contigs{$ctgname}{'anchor'} = 1;
$_contigs{$ctgname}{'chr_remark'} = $3 if(defined($3));
if (defined($2)) {
$_contigs{$ctgname}{'group'} = $2;
}
else {
$_contigs{$ctgname}{'group'} = "?";
}
}
elsif ($line =~ /^User_remark\s+"(.+)"/) {
$_contigs{$ctgname}{'usr_remark'} = $1;
}
elsif ($line =~ /^Trace_remark\s+"(.+)"/) {
$_contigs{$ctgname}{'trace_remark'} = $1;
}
elsif ($grpabbr && $line =~ /^Chr_remark\s+"(\W|$grpabbr((\d+)|(\w+)|([.\w\d]+)))\s*(\{(.*)\}|\[(.*)\])?"\s+(Pos\s+((\d.)+|NaN))(NOEDIT)?/)
{
my $grpmatch = $2;
my $pos = $10;
if ($pos eq "NaN") {
$pos = 0;
print "Warning: Nan encountered for Contig position \n";
}
$_contigs{$ctgname}{'chr_remark'} = $6;
$_contigs{$ctgname}{'position'} = $pos;
$_contigs{$ctgname}{'subgroup'} = 0;
if (defined($grpmatch)) {
$_contigs{$ctgname}{'anchor'} = 1;
if ($grpmatch =~ /((\d+)((\D\d.\d+)|(.\d+)))|((\w+)(\.\d+))/) {
my ($group,$subgroup);
$group = $2 if($grpabbr eq "Chr");
$subgroup = $3 if($grpabbr eq "Chr");
$group = $7 if($grpabbr eq "Lg");
$subgroup = $8 if($grpabbr eq "Lg");
$subgroup = substr($subgroup,1) if ($subgroup =~ /^\./);
$_contigs{$ctgname}{'group'} = $group;
$_contigs{$ctgname}{'subgroup'} = $subgroup;
}
else {
$_contigs{$ctgname}{'group'} = $grpmatch;
}
}
else {
$_contigs{$ctgname}{'anchor'} = 1;
$_contigs{$ctgname}{'group'} = "?";
}
}
$curContig++;
print "Adding Contig $curContig...\n"
if ($self->verbose() && $curContig % 100 == 0);
}
$map->_setContigRef(\%_contigs);
$map->_calc_markerposition();
$map->_calc_contigposition() if ($map->version() < 7.0);
$map->_calc_contiggroup() if ($map->version() == 4.6);
return $map;
}
=head2 write_map
Title : write_map
Usage : $mapio->write_map($map);
Function: Write a map out
Returns : none
Args : Bio::Map::MapI
=cut
sub write_map{
my ($self,@args) = @_;
$self->throw_not_implemented();
}
1;
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<bioperl-l@bioperl.org>
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via the
web:
https://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR - Gaurav Gupta
Email gaurav@genome.arizona.edu
=head1 PROJECT LEADERS
Jamie Hatfield jamie@genome.arizona.edu
Dr. Cari Soderlund cari@genome.arizona.edu
=head1 PROJECT DESCRIPTION
The project was done in Arizona Genomics Computational Laboratory
(AGCoL) at University of Arizona.
This work was funded by USDA-IFAFS grant #11180 titled "Web Resources
for the Computation and Display of Physical Mapping Data".
For more information on this project, please refer:
http://www.genome.arizona.edu
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
=cut
|