[MOBY-dev] Strange problems with nested moby objects

Volker Rössler volker.roessler at googlemail.com
Mon Nov 15 11:31:55 UTC 2010


Hi everyone,

I'm experiencing a rather strange problem when trying to build the
response object. What I'd like to achieve is building an
'AnnotatedSNPAndTranscriptLocation' object which contains an array of
'SNPTranscript' objects.

My code for building the response object looks like this, but this
causes some strange problems:


@SNP_list = mymethod($some_user_input);

foreach my $SNP (@SNP_list) {

        my @listOfBiomobyTranscriptObjects;

        my $transcriptList = $SNP->get_transcript_list();

        foreach my $trans (@$transcriptList) {

            my $snp_type = $trans->get_field('snp_type');
            my $database_references = new MOSES::MOBY::Data::Object
                (
                    id => $trans->get_field('name'),
                    namespace => 'Ensembl'
                );
            my $strand = $trans->get_field('strand');
            my $description = $trans->get_field('description');
            my $name = $trans->get_field('name');
            my $start = $trans->get_field('start');
            my $stop = $trans->get_field('stop');


            my $newTranscript => new MOSES::MOBY::Data::SNPTranscript
                (
                    snp_type => $snp_type,
                    #database_references => $database_references,
                    strand => $strand,
                    description => $description,
                    name => $name,
                    start => $start,
                    stop => $stop
                );
            push (@listOfBiomobyTranscriptObjects, $newTranscript);
        }

        my $output_snp_transcripts = new
MOSES::MOBY::Data::AnnotatedSNPAndTranscriptLocation
            (

                snp_transcripts => \@listOfBiomobyTranscriptObjects,
                coverage_all => $SNP->get_snp_coverage_all(),
                coverage_new_allele => $SNP->get_snp_coverage_new_allele(),
                genetype_allele => $SNP->get_snp_genotype_allele(),
                reference_allele => $SNP->get_snp_reference_allele(),
                confidence => $SNP->get_snp_score(),
                Position => new MOSES::MOBY::Data::Position
                    (
                        end => $SNP->get_snp_position(),
                        start => $SNP->get_snp_position(),
                        chromosome => $SNP->get_snp_chromosome()
                    ),
                Strain => $strain
            );
        $response->add_output_snp_transcripts($output_snp_transcripts);
    }



When I'm trying to run this, I get the following error message:
2010/11/15 12:26:02 (71764) FATAL> [13065] (eval 1068):155 -
------------- EXCEPTION: MOSES::MOBY::Data::SNPTranscript -------------
MSG: No such method: MOSES::MOBY::Data::SNPTranscript::value

I suspect, that this error happens, because I am trying to use an
array of MOSES::MOBY::Data::Object (stored in
@listOfBiomobyTranscriptObjects), but I'm not quite sure.

Any help or suggestions are greaty appreciated!

Yours,
Volker



More information about the MOBY-dev mailing list