3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
20 package XrefParser::CodelinkParser;
27 # Parser for Codelink probes
30 #TTGTTTTCAGCTTGCTTCTGTCATTCTTCC
32 #CACAGTTGGGTGAAGCTGGTGATGAAGGTA
36 my ($self, $ref_arg) = @_;
37 my $source_id = $ref_arg->{source_id};
38 my $species_id = $ref_arg->{species_id};
39 my $files = $ref_arg->{files};
40 my $release_file = $ref_arg->{rel_file};
41 my $verbose = $ref_arg->{verbose};
43 if((!defined $source_id) or (!defined $species_id) or (!defined $files) or (!defined $release_file)){
44 croak
"Need to pass source_id, species_id, files and rel_file as pairs";
48 my $file = @{$files}[0];
54 my $codelink_io = $self->get_filehandle($file);
55 if ( !defined $codelink_io ) {
56 print STDERR
"ERROR: Could not open $file\n";
60 while ( $_ = $codelink_io->getline() ) {
63 my ($header, $sequence) = $_ =~ /^>?(.+?)\n([^>]*)/s or warn(
"Can't parse FASTA entry: $_\n");
65 # deconstruct header - only accession for now
66 my $accession = $header;
68 # make sequence into one long string - probably not necessary for short probes
71 # build the xref object and store it
72 $xref->{ACCESSION} = $accession;
73 $xref->{LABEL} = $accession;
74 $xref->{SEQUENCE} = $sequence;
75 $xref->{SOURCE_ID} = $source_id;
76 $xref->{SPECIES_ID} = $species_id;
77 $xref->{SEQUENCE_TYPE} =
'dna';
78 $xref->{STATUS} =
'experimental';
84 $codelink_io->close();
87 $self->upload_xref_object_graphs(\@xrefs);
89 print scalar(@xrefs) .
" Codelink xrefs succesfully parsed\n" if($verbose);