1 package CXGN
::Bulk
::BAC
;
5 use CXGN
::DB
::DBICFactory
;
6 use CXGN
::Genomic
::Clone
;
7 use CXGN
::Genomic
::CloneIdentifiers
;
8 use CXGN
::Genomic
::Library
;
9 use CXGN
::Tools
::List qw
/any/;
11 use base
"CXGN::Bulk";
15 my $self = $class->SUPER::new
(@_);
18 my $paramhash = $_[0];
19 $self->debug("ID String from BAC.pm constructor");
20 $self->debug("ids_string is " . $paramhash->{ids_string
});
42 sub process_parameters
47 unless length($self->{ids
}) <= 1_000_000
&& $self->{ids
} =~ /\w/;
49 $self->{output_fields
} = [grep $self->{$_} eq 'on', @field_list];
51 # clean up data retrieved
52 my $ids = $self->{ids
};
53 $ids =~ s/[\n\s\r]+/ /g;
54 my @ids = grep $_, split /\s+/, $ids;
55 return 0 if @ids > 10_000
; #limit to 10_000 ids to process
56 return 0 unless any
(@ids);
60 return 1; #params were OK if we got here
66 $self -> {query_start_time
} = time();
67 my $dbh = $self->{db
};
68 my @output_fields = @
{$self -> {output_fields
}};
71 my ($dump_fh, $notfound_fh) = $self -> create_dumpfile
();
73 my $current_time= time() - $self -> {query_start_time
};
74 $self->debug("Time point 1: $current_time");
80 my $chado = CXGN
::DB
::DBICFactory
->open_schema('Bio::Chado::Schema');
82 # iterate through identifiers
83 foreach my $id (@
{$self->{ids
}}) {
86 my $clone = CXGN
::Genomic
::Clone
->retrieve_from_clone_name($id);
88 #ask rob if parser should choke when given zero
90 print $notfound_fh (">$id\n");
93 my $lib = $clone->library_object;
95 # get organism name and accession
96 my (undef, $oname, $cname) = $lib->accession_name();
99 @data{@field_list} = ($clone->clone_name_with_chromosome || '',
100 $clone->cornell_clone_name || '',
102 $clone->clone_type_object->name,
106 $clone->estimated_length,
107 $clone->genbank_accession( $chado ),
109 my @dump_fields = grep $self->{$_},@field_list;
111 print $dump_fh join("\t", @data{@dump_fields})."\n";
114 $current_time = time() - $self->{query_start_time
};
115 $self->debug("Time point 2: $current_time");
119 $self->{foundcount
}= $foundcount;
120 $self->{notfoundcount
}= $notfoundcount;
121 $current_time = time() - $self->{query_start_time
};
122 $self->{query_time
} = time() - $self -> {query_start_time
};
123 $self->debug("Time point 3: $current_time");