[BioC] problem with function
Iain Gallagher
iaingallagher at btopenworld.com
Fri Dec 17 23:40:18 CET 2010
Thanks for the attention you've given this Christian.
I'll do that and try and debug the output.
Cheers
Iain
--- On Fri, 17/12/10, cstrato <cstrato at aon.at> wrote:
> From: cstrato <cstrato at aon.at>
> Subject: Re: [BioC] problem with function
> To: "Iain Gallagher" <iaingallagher at btopenworld.com>
> Cc: "bioconductor" <bioconductor at stat.math.ethz.ch>
> Date: Friday, 17 December, 2010, 22:38
> At the moment I have no idea, but
> what I would do in this case is to put
> print() statements after each line to see where it fails.
>
> Christian
>
> On 12/17/10 10:59 PM, Iain Gallagher wrote:
> > Hi
> >
> > FC is the second column of the deMirs variable. deMirs
> is a dataframe with 2 columns - Probe (e.g. hsa-miR-145) and
> FC (e.g 1.45). Using 'with' allows me to use deMirs as an
> 'environment'. I thus don't have to pass FC explicitly.
> >
> > Cheers
> >
> > i
> >
> > --- On Fri, 17/12/10, cstrato<cstrato at aon.at>
> wrote:
> >
> >> From: cstrato<cstrato at aon.at>
> >> Subject: Re: [BioC] problem with function
> >> To: "Iain Gallagher"<iaingallagher at btopenworld.com>
> >> Cc: "bioconductor"<bioconductor at stat.math.ethz.ch>
> >> Date: Friday, 17 December, 2010, 20:39
> >> What is FC[]? It is not passed
> >> to the function. Christan
> >>
> >> On 12/17/10 8:11 PM, Iain Gallagher wrote:
> >>> Sorry.
> >>>
> >>> That was a typo. In my script
> deMirPresGenes1[,4] is
> >> deMirPresGenes[,4].
> >>>
> >>> Just to be sure I'm going about this the right
> way
> >> though I should say that at the moment I assign
> the output
> >> of another function to a variable called 'tf1' -
> this object
> >> is the same as the deMirPresGenes is my previous
> email.
> >>>
> >>> This is then fed to my problem function using
> >> positional matching.
> >>>
> >>> e.g. tf2<- cumulMetric(tf1, deMirs)
> >>>
> >>> Which leads to:
> >>>
> >>> Error in eval(expr, envir, enclos) : object
> >> 'geneMetric' not found
> >>>
> >>> Hey ho!
> >>>
> >>> i
> >>>
> >>> --- On Fri, 17/12/10, cstrato<cstrato at aon.at>
> >> wrote:
> >>>
> >>>> From: cstrato<cstrato at aon.at>
> >>>> Subject: Re: [BioC] problem with function
> >>>> To: "Iain Gallagher"<iaingallagher at btopenworld.com>
> >>>> Cc: "bioconductor"<bioconductor at stat.math.ethz.ch>
> >>>> Date: Friday, 17 December, 2010, 18:40
> >>>> I am not sure but I would say that
> >>>> deMirPresGenes1 does not exist.
> >>>>
> >>>> Regards
> >>>> Christian
> >>>>
> >>>>
> >>>> On 12/17/10 6:42 PM, Iain Gallagher
> wrote:
> >>>>> Hello List
> >>>>>
> >>>>> I wonder if someone would help me with
> the
> >> following
> >>>> function.
> >>>>>
> >>>>> cumulMetric<-
> function(deMirPresGenes,
> >> deMirs){
> >>>>>
> >>>>> #need to match position of each miR
> in
> >> deMirPresGenes
> >>>> with its FC to form a vector of FC in
> correct
> >> order
> >>>>> fc<-
> deMirs
> >>>>>
> fcVector<-
> >> as.numeric(with (fc,
> >>>> FC[match(deMirPresGenes1[,4], Probe)] ) )
> >>>>>
> >>>>> #multiply
> fc by context
> >> score for
> >>>> each interaction
> >>>>> metric<-
> fcVector *
> >>>> as.numeric(deMirPresGenes[,11])
> >>>>>
> geneMetric<-
> >>>> cbind(deMirPresGenes[,2],
> as.numeric(metric))
> >>>>>
> >>>>>
> #make
> >> cumul
> >>>> weighted score
> >>>>>
> listMetric<-
> >> unstack(geneMetric,
> >>>>
> as.numeric(geneMetric[,2])~geneMetric[,1])
> >>>>>
> listMetric<-
> >>>> as.data.frame(sapply(listMetric,sum))
> #returns a
> >> dataframe
> >>>>>
> colnames(listMetric)<-
> >>>> c('cumulMetric')
> >>>>>
> >>>>> #return
> whole list
> >>>>>
> return(listMetric)
> >>>>> }
> >>>>>
> >>>>> deMirPresGenes looks like this:
> >>>>>
> >>>>> Gene.ID
> >>>> Gene.Symbol Species.ID
> >>>> miRNA Site.type
> >>>> UTR_start UTR_end
> >>>> X3pairing_contr
> >>>> local_AU_contr
> >>>> position_contr
> >>>> context_score
> context_percentile
> >>>>> 22848 AAK1
> >>>> 9606 hsa-miR-183
> >>>> 2 1546
> >>>> 1552 -0.026
> >>>> -0.047 0.099
> >>>> -0.135 47
> >>>>> 19 ABCA1
> >>>> 9606 hsa-miR-183
> >>>> 2 1366
> >>>> 1372 -0.011
> >>>> -0.048 0.087
> >>>> -0.133 46
> >>>>> 20 ABCA2
> >>>> 9606 hsa-miR-495
> >>>> 2 666
> >>>> 672 -0.042
> >>>> -0.092 -0.035
> >>>> -0.33 93
> >>>>> 23456 ABCB10
> >>>> 9606 hsa-miR-183
> >>>> 3 1475
> >>>> 1481 0.003
> >>>> -0.109 -0.05
> >>>> -0.466 98
> >>>>> 6059 ABCE1
> >>>> 9606 hsa-miR-495
> >>>> 2 1474
> >>>> 1480 0.005
> >>>> -0.046 0.006
> >>>> -0.196 58
> >>>>> 55324 ABCF3
> >>>> 9606 hsa-miR-1275
> >>>> 3 90
> >>>> 96 0.007
> >>>> 0.042 -0.055
> >>>> -0.316 94
> >>>>>
> >>>>>
> >>>>> The aim of the function is to extract
> a
> >> dataframe of
> >>>> gene symbols along with a weighted score
> from the
> >> above
> >>>> data. The weighted score is the FC column
> of
> >> deMirs * the
> >>>> context_score column of deMirPresGenes.
> This is
> >> easy peasy!
> >>>>>
> >>>>> Where I'm falling down is that if I
> run this
> >> function
> >>>> it complains that 'geneMetric' can't be
> found. Hmm
> >> - I've
> >>>> run it all line by line (i.e. not as a
> function)
> >> and it
> >>>> works but wrapped up like this it fails!
> >>>>>
> >>>>> e.g.
> >>>>>
> >>>>>> testF2<- cumulMetric(testF1,
> >> deMirs$up)
> >>>>> Error in eval(expr, envir, enclos) :
> object
> >>>> 'geneMetric' not found
> >>>>>
> >>>>> deMirs$up looks like this:
> >>>>>
> >>>>> Probe FC
> >>>>> hsa-miR-183 2.63
> >>>>> hsa-miR-1275 2.74
> >>>>> hsa-miR-495 3.13
> >>>>> hsa-miR-886-3p 3.73
> >>>>> hsa-miR-886-5p 3.97
> >>>>> hsa-miR-144* 6.62
> >>>>> hsa-miR-451 7.94
> >>>>>
> >>>>> Could someone possibly point out where
> I
> >> falling
> >>>> down.
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>> i
> >>>>>
> >>>>>> sessionInfo()
> >>>>> R version 2.12.0 (2010-10-15)
> >>>>> Platform: x86_64-pc-linux-gnu
> (64-bit)
> >>>>>
> >>>>> locale:
> >>>>> [1]
> >> LC_CTYPE=en_GB.utf8
> >>>>
> LC_NUMERIC=C
> >>>>> [3]
> >> LC_TIME=en_GB.utf8
> >>>>
> LC_COLLATE=en_GB.utf8
> >>>>> [5]
> LC_MONETARY=C
> >>>>
> >> LC_MESSAGES=en_GB.utf8
> >>>>> [7]
> >> LC_PAPER=en_GB.utf8
> >>>> LC_NAME=C
> >>>>> [9]
> LC_ADDRESS=C
> >>>>
> LC_TELEPHONE=C
> >>>>> [11] LC_MEASUREMENT=en_GB.utf8
> >> LC_IDENTIFICATION=C
> >>>>>
> >>>>> attached base packages:
> >>>>> [1] stats
> graphics
> >>>> grDevices utils
> datasets
> >>>> methods base
> >>>>>
> >>>>> loaded via a namespace (and not
> attached):
> >>>>> [1] tools_2.12.0
> >>>>>>
> >>>>>
> >>>>>
> >> _______________________________________________
> >>>>> Bioconductor mailing list
> >>>>> Bioconductor at r-project.org
> >>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
> >>>>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
> >>>>>
> >>>>
> >>>
> >>>
> _______________________________________________
> >>> Bioconductor mailing list
> >>> Bioconductor at r-project.org
> >>> https://stat.ethz.ch/mailman/listinfo/bioconductor
> >>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
> >>>
> >>
> >
>
More information about the Bioconductor
mailing list