I am trying to run dssp function using bio3d package in R. But I am getting error.
library("bio3d")
pdb <- read.pdb("1CRN")
x <- dssp(pdb, exepath="C:/dssp/dssp.exe")
Error in file(con, "r") : cannot open the connection
Any suggestions please.
To solve it you need to fix the dssp function paramenters:
fix(dssp)
rewrite the following line:
system(paste(exepath, "dssp -c ", infile, " ", outfile, sep = ""), ignore.stderr = TRUE)
"-i" istead of "-c" and "-o" intead of " "
chears
Related
cl <- parallelly::makeClusterPSOCK(2, autoStop = TRUE)
Error:
Error in system(test_cmd, intern = TRUE, input = input) :
'CreateProcess' failed to run 'C:\Users\xxx~1\ONEDRI~1\DOCUME~1\R\R-40~1.3\bin\x64\Rscript.exe -e "try(suppressWarnings(cat(Sys.getpid(),file=\"C:/Users/LOCAL_~1/Temp/RtmpIP7vSI/worker.rank=1.parallelly.parent=19988.4e147c0a5082.pid\")), silent = TRUE)" -e "file.exists(\"C:/Users/LOCAL_~1/Temp/RtmpIP7vSI/worker.rank=1.parallelly.parent=19988.4e147c0a5082.pid\")"'
I was trying to create the clusters for parallel execution. But does not work and throws the above error.
I tried to use R in a Jupyter Notebook with VSCode, but I get the following Error:
summary(mtcars)
ERROR: Error in parse(text = x, srcfile = src): <text>:1:16: unerwartete Eingabe
1: summary(mtcars)
^
Error in parse(text = x, srcfile = src): <text>:1:16: unerwartete Eingabe
1: summary(mtcars)
^
Traceback:
It seems like I there's a problem with the newline command, because I can execute multiple cells with one line of code each.
Changing the End of Line Command in VSCode from "\r\n" to "\n" did the trick...
When running the following call on Mac I get an error as follows
jsonlite::fromJSON(url(paste("https://fantasy.premierleague.com/api/element-summary/236")))
Error in parse_con(txt, bigint_as_char) : parse error: premature EOF
(right here) ------^
However the following call works correctly, with the only difference being the omission of the url().
jsonlite::fromJSON(paste("https://fantasy.premierleague.com/api/element-summary/236"))
The traceback from the error is as follows:
4: parse_con(txt, bigint_as_char)
3: parseJSON(txt, bigint_as_char)
2: parse_and_simplify(txt = txt, simplifyVector = simplifyVector,
simplifyDataFrame = simplifyDataFrame, simplifyMatrix = simplifyMatrix,
flatten = flatten, ...)
1: jsonlite::fromJSON(url(paste("https://fantasy.premierleague.com/api/element-summary/236")))
I've tried on two separate installations with the same result. I wonder if the line break after the first line of the JSON is being interpreted as EOF....
I am able to run this code normally in R.
setInternet2(use = TRUE)
download.file("http://d396qusza40orc.cloudfront.net/dsscapstone/dataset/Coursera-SwiftKey.zip", "Coursera-SwiftKey.zip", method = "curl", mode = 'wb')
unzip("Coursera-SwiftKey.zip", files=c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"), exdir=".")
But when i try to use knitR it gives me this error
Quitting from lines 15-21 (milestone.Rmd)
Error in parse(text = x, srcfile = src) : <text>:5:106: unexpected ')'
4: unzip("Coursera-SwiftKey.zip", files=c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"), exdir=".")
5: file.copy(c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"?)
^
Calls: <Anonymous> ... <Anonymous> -> parse_all -> parse_all.character -> parse
Execution halted
I am using R Studio and MAC OS X.
I tried removing the s from https but it still di not work.
I am trying to create a batch script in R to pre-process some data and one of the first steps I have to do is check to see if a file exists in a sub-directory and then (if it does) create a copy of it with a new name. I'm having trouble with the syntax.
This is my code:
##Define the subject directory path
sDIR = "/home/bsussman/Desktop/WORKSPACE"
#create data frame to loop through
##list of subject directories
subjects <-list.dirs(path = sDIR, full.names = TRUE, recursive = FALSE)
for (subj in 1:length(subjects)){
oldT1[[subj]] <- dir(subjects[subj], pattern=glob2rx("s*.nii"), full.names=TRUE)
T1[[subj]] <- paste(subjects[subj], pattern="/T1.nii",sep="")
if (file.exists(paste(subjects[subj], pattern="/T1.nii",sep=""))=FALSE{
file.copy(oldT1, T1)
}
}
It renames files in one subdirectory, but will not do loop through gives me these errors:
Error: unexpected '=' in:
"
if (file.exists(paste(subjects[subj], pattern="/T1.nii",sep=""))="
> file.copy(oldT1, T1)
[1] FALSE
> }
Error: unexpected '}' in " }"
> }
Error: unexpected '}' in "}"
I am not as much worried about the [1]FALSE message. But any ideas?
Thanks!!
It's just a problem with the syntax in the if statement. Try replacing this:
if (file.exists(paste(subjects[subj], pattern="/T1.nii",sep=""))=FALSE{
file.copy(oldT1, T1)
}
with this:
if (!file.exists(paste(subjects[subj], pattern="/T1.nii",sep=""))){
file.copy(oldT1, T1)
}