[BioC] Fetching documents from PubMed
Morten Mattingsdal
morten.mattingsdal at student.uib.no
Fri Feb 10 12:13:52 CET 2006
Kaustubh Patil wrote:
>Hi,
>
> I want to fetch documents from PubMed. So first I get all the PMIDs and then use the "pubmed" function from the "annotate package". But does this function take care of the NCBI rule for waiting 3 seconds between queries?
>
>
Dont know about the "pubmed" function from annotate, but Ive seen a
function which does excaly this in the MedlineR package (im just pasting
the code below)
pauseBetweenQueries<- function (
sleep.peak=15, # pause (in seconds) during peak hours
sleep.offpeak=3 # pause (in seconds) during off-peak
) {
# sleep.peak<-15; sleep.offpeak<-3
# Date example:
# "Thu" "Jan" "15" "16:46:11" "2004"
result.date<- unlist (strsplit(
date(), split=" "))
hour<- as.numeric(unlist (strsplit (result.date[4], split=':'))[1])
# off peak hours are Sat, Sun or anytime between 9 pm and 5 am
if (
(result.date[1]=="Sat") | (result.date[1]=="Sun") |
(hour > 21) | (hour<5)
) {off.peak<-T} else {off.peak<-F}
# perform the sleep
if (off.peak) {
Sys.sleep (sleep.offpeak)
} else {
Sys.sleep (sleep.peak)
}
}
you may want to try more code from MedlineR. you can find the complete
code here:
http://www.dbsr.duke.edu/pub/MedlineR/MedlineR_v30.txt
hope this can be usefull :)
morten
>
> Also I have a list of 718 PMIDs but the function retrieves only 377 of them? I don't understand why. Suggestions appreciated.
>
> Thank you and regards,
> Kaustubh
>
>
>---------------------------------
>
> [[alternative HTML version deleted]]
>
>_______________________________________________
>Bioconductor mailing list
>Bioconductor at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/bioconductor
>
>
More information about the Bioconductor
mailing list