Biopython not installed correctly error when trying to call python script from R on a MacOS
1
0
Entering edit mode
3.5 years ago
devarts ▴ 40

I'm trying to run a script in r that relies on calling a python script. I'm using a Mac with Python 3.8.2 installed and Biopython installed through Python 3, but I keep getting the following error. I've uninstalled and reinstalled Python 3 and Biopython, but continue to get the following error. "BioPython not installed correctly (see http://biopython.org)"

Does anyone have any ideas about what is going on and how to resolve it? The key part of the script and where the problem is seems to be this.

  cmnd<-paste0('./anaconda3/envs/python3.8.2/bin/python3.8 ','"', pfile, '"'," -f ", '"', source_file, '"', "  ", '-m simple -M reduced_alphabet_2 -k 10 -o ', '"', dest_file, '"')
  cat(cmnd)
  system(cmnd)

The whole script chunk is as follows.

kGenFasta <- function(i) {
#for(i in 1:192){
  pfile<-"./SIEVE-Ub-master/KmerFeatures.py"
  #source_file<-paste0("/Applications/kayes/tailocin\ work/S\ tailocin/tailorcinData/",i,".fa")

  source_file<-paste0("./PHASTERzero_cleaned_proteins/X_cleaned_files/",i,".fasta")


  if (file.exists(source_file)){
    print(i)

  #dest_file<-paste0("/Applications/kayes/tailocin\ work/J\ work/tailocin/red_0/kmer_",i,".csv")
  dest_file<-paste0("./PHASTER_zero_proteins/PHASTERzero_cleaned_proteins/X_cleaned_files/red_2/kmer_",i,".csv")




  cmnd<-paste0('/Users/evar698/anaconda3/envs/python3.8.2/bin/python3.8 ','"', pfile, '"'," -f ", '"', source_file, '"', "  ", '-m simple -M reduced_alphabet_2 -k 10 -o ', '"', dest_file, '"')
  cat(cmnd)
  system(cmnd)


}
}

#library(lme4)
core<-detectCores()-2
core
#set.seed( 123, kind = "L'Ecuyer-CMRG" )
tmxList <- mclapply(1:77, kGenFasta, mc.cores = core)
Biopython • 965 views
ADD COMMENT
0
Entering edit mode

What happens if you try to invoke a dummy python command (so, not Biopython)? e.g. have R call a script which just prints out some version numbers or writes a dummy file.

ADD REPLY
0
Entering edit mode

Dummy Python commands work. What I found is that parts of the Biopython that was being called within the python script, that was being called, were deprecated. Changing those, made it work.

ADD REPLY
2
Entering edit mode
3.5 years ago
devarts ▴ 40

What I found is that parts of the Biopython that was being called within the python script, that was being called, were deprecated. Changing those, made it work.

ADD COMMENT

Login before adding your answer.

Traffic: 1789 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6