XrefParser DirectParser
Included librariesPackage variablesGeneral documentationMethods
Toolbar
WebCvsRaw content
Package variables
No package variables defined.
Inherit
XrefParser::BaseParser
Synopsis
No synopsis!
Description
No description!
Methods
new
No description
Code
run
No description
Code
Methods description
None available.
Methods code
newdescriptionprevnextTop
sub new {
    my $proto = shift;

    my $class = ref $proto || $proto;
    my $self = bless {}, $class;

    return $self;
}
rundescriptionprevnextTop
sub run {
    my $self = shift;

    my ( $source_id, $species_id, $filename ) = @_;

    my $file_io = $self->get_filehandle($filename);
    if ( !defined($file_io) ) {
        return 1;
    }

    my $parsed_count = 0;

    printf( STDERR "source = %d\t species = %d\n",
            $source_id, $species_id );

    while ( defined( my $line = $file_io->getline() ) ) {
        chomp $line;

        my ( $accession, $ensembl_id, $type, $label, $description,
             $version )
          = split( /\t/, $line );

        if ( !defined($accession) || !defined($ensembl_id) ) {
            printf( "Line %d contains  has less than two columns.\n",
                    1 + $parsed_count );
            print("The parsing failed\n");
            return 1;
        }

        $type        ||= 'gene';
        $label       ||= $accession;
        $description ||= '';
        $version     ||= '1';

        ++$parsed_count;

        my $xref_id =
          XrefParser::BaseParser->get_xref( $accession, $source_id, $species_id );

        if ( !defined($xref_id) || $xref_id eq '' ) {
            $xref_id =
              XrefParser::BaseParser->add_xref(
                                   $accession,   $version,   $label,
                                   $description, $source_id, $species_id, "DIRECT"
              );
        }
        XrefParser::BaseParser->add_direct_xref( $xref_id, $ensembl_id,
                                                 $type, $accession );
    } ## end while ( defined( my $line...
printf( "%d direct xrefs succesfully parsed\n", $parsed_count ); $file_io->close(); print "Done\n"; return 0; } ## end sub run
1;
}
General documentation
No general documentation available.