Error in file(file, "rt") : cannot open the connection Calls: read.table -> file Execution halted. 

202 views
Skip to first unread message

Giuseppe Fanelli

unread,
Aug 8, 2017, 10:02:09 AM8/8/17
to PRSice
I'm trying to learn how to generate a PRS with this tool, using the TUTORIAL files. I ran the script below on the Terminal of my mac.
I get this error: Error in file(file, "rt") : cannot open the connection Calls: read.table -> file Execution halted.

Could you help me? What am I doing wrong?


INPUT SCRIPT

cd /usr/local/bin/PRSice_v1.25    #THE DIRECTORY WHERE I HAVE "PRSice_v1.25.R"#


R -q --file=./PRSice_v1.25.R --args base TOY_BASE_GWAS.assoc target TOY_TARGET_DATA slower 0 supper 0.5 sinc 0.01 covary F clump.snps F plink ./plink_1.9_mac_160914 figname EXAMPLE_1


OUTPUT

> library(batch)

> start.time <- proc.time()[3]

> options(echo = FALSE)

 ################################# 

 # 

 # 

 # 

 # 

 # PRSice: Polygenic Risk Score software 

 # 

 # Jack Euesden, Cathryn M. Lewis, Paul F. O'Reilly 2014 

 # 

 # 

 # If you use PRSice in published work, please cite: 

 # 

 # "PRSice: Polygenic Risk Score software" 

 # Euesden, Lewis, O'Reilly, Bioinformatics (2015) 31 (9):1466-1468 

 # 

 # 

 # 

 #  

 ################################# 

 ################################# 

 # 

 #  Read in Command Line Arguments & interpret 

 # 

 ################################# 

$base

[1] "TOY_BASE_GWAS.assoc"


$target

[1] "TOY_TARGET_DATA"


$slower

[1] 0


$supper

[1] 0.5


$sinc

[1] 0.01


$covary

[1] "F"


$clump.snps

[1] "F"


$plink

[1] "./plink_1.9_mac_160914"


$figname

[1] "EXAMPLE_1"


 ################################# 

 # 

 #  Check options match 

 # 

 ################################# 

[1] "Using current directory as working directory"

 ################################# 

 # 

 #  Check base input format 

 # 

 ################################# 

[1] "WARNING: No SE column in base data"

 ################################# 

 # 

 #   Remove Ambiguous SNPs 

 # 

 ################################# 

 ################################# 

 # 

 #   Deal with strand flips if target is in genotype format and produce input files for polygenic scoring 

 # 

 ################################# 

 ################################# 

 # 

 #   Polygenic scoring! 

 # 

 ################################# 

 ################################# 

 # 

 #   Regression Models 

 # 

 ################################# 

Error in file(file, "rt") : cannot open the connection Calls: read.table -> file Execution halted. 





Sam Choi

unread,
Aug 8, 2017, 11:22:37 AM8/8/17
to PRSice
can you re-run the program with these additional options?

debug.mode T plink.silent F

Andrea Allegrini

unread,
Aug 8, 2017, 12:52:30 PM8/8/17
to PRSice
I have the same problem here. I re-run the program with the options debug.mode T and plink.silent F and I got the following: 


IMPUT: 



cd /path/to/PRSice_v1.25/

R -q --file=./PRSice_v1.25.R --args \
base SumStat_PRScise.assoc \
target /path/to/target \
slower 0 \
supper 0.5 \
sinc 0.01 \
covary F \
clump.snps F \
plink ./plink_1.9_linux_160914 \
figname TotScore_Figure \
pheno.file totalS_PRScise.pheno \
debug.mode T \
plink.silent F \
binary.target F



OUTPUT:
[1] "SumStat_PRSice.assoc"

$target
[1] "path/to/data" #example 

$slower
[1] 0

$supper
[1] 0.5

$sinc
[1] 0.01

$covary
[1] "F"

$clump.snps
[1] "F"

$plink
[1] "./plink_1.9_linux_160914"

$figname
[1] "TotScore_Figure"

$pheno.file
[1] "totalS_PRSice.pheno"

$debug.mode
[1] "T"

$plink.silent
[1] "F"

$binary.target
[1] "F"

 #################################
 #
 #  Check options match
 #
 #################################
[1] "Using current directory as working directory"
 #################################
 #
 #  Check base input format
 #
 #################################
[1] "NB: READING BETA NOT ODDS RATIO"
[1] "WARNING: No SE column in base data"
 #################################
 #
 #   Remove Ambiguous SNPs
 #
 #################################
PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2
(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to non_synonymous_snps_only.log.
Note: --noweb has no effect since no web check is implemented yet.
193456 MB RAM detected; reserving 96728 MB for main workspace.
Allocated 22953 MB successfully, after larger attempt(s) failed.
3519009 variants loaded from .bim file.
6710 people (0 males, 0 females, 6710 ambiguous) loaded from .fam.
Ambiguous sex IDs written to non_synonymous_snps_only.nosex .
--exclude: 3517369 variants remaining.
Using 1 thread (no multithreaded calculations invoked).
Calculating allele frequencies... done.
Total genotyping rate is 0.996648.
3517369 variants and 6710 people pass filters and QC.
Note: No phenotypes present.
--make-bed to non_synonymous_snps_only.bed + non_synonymous_snps_only.bim +
non_synonymous_snps_only.fam ... done.
 #################################
 #
 #   Deal with strand flips if target is in genotype format and produce input files for polygenic scoring
 #
 #################################
PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2
(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to flipped_target.log.
Note: --noweb has no effect since no web check is implemented yet.
193456 MB RAM detected; reserving 96728 MB for main workspace.
Allocated 22953 MB successfully, after larger attempt(s) failed.
3517369 variants loaded from .bim file.
6710 people (0 males, 0 females, 6710 ambiguous) loaded from .fam.
Ambiguous sex IDs written to flipped_target.nosex .
--flip: 9971 SNPs flipped.
Using 1 thread (no multithreaded calculations invoked).
Calculating allele frequencies... done.
Total genotyping rate is 0.996648.
3517369 variants and 6710 people pass filters and QC.
Note: No phenotypes present.
--make-bed to flipped_target.bed + flipped_target.bim + flipped_target.fam ...
done.
 #################################
 #
 #   Polygenic scoring!
 #
 #################################
PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2
(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to PROFILES.log.
Note: --noweb has no effect since no web check is implemented yet.
193456 MB RAM detected; reserving 96728 MB for main workspace.
Allocated 22953 MB successfully, after larger attempt(s) failed.
3517369 variants loaded from .bim file.
6710 people (0 males, 0 females, 6710 ambiguous) loaded from .fam.
Ambiguous sex IDs written to PROFILES.nosex .
Using 1 thread (no multithreaded calculations invoked).
Calculating allele frequencies... done.
Total genotyping rate is 0.996648.
3517369 variants and 6710 people pass filters and QC.
Note: No phenotypes present.
Error: No valid entries in --score file.
 #################################
 #
 #   Regression Models
 #
 #################################
Error in file(file, "rt") : cannot open the connection
Calls: read.table -> file
In addition: Warning message:
In file(file, "rt") : cannot open file 'NA': No such file or directory
Execution halted


Any help would be greatly appreciated! 

Sam Choi

unread,
Aug 8, 2017, 5:20:42 PM8/8/17
to PRSice
If you add cleanup F

Can you check the output of 

head  rangelist.txt rangelist_ranges rawfile.raw  (If you want to, you can mask your SNP ID as long as they match between the files)


Andrea Allegrini

unread,
Aug 9, 2017, 3:48:54 AM8/9/17
to PRSice
 head rangelist.txt 

-0.01 0 -0.01
0.00 0 0.00
0.01 0 0.01
0.02 0 0.02
0.03 0 0.03
0.04 0 0.04
0.05 0 0.05
0.06 0 0.06
0.07 0 0.07
0.08 0 0.08

head rangelist_ranges

rs1000132 0.02981
rs10001779 0.01333
rs10001818 0.0007922
rs10002358 0.002153
rs10004571 0.04435
rs10005103 0.004409
rs1000768 0.004287
rs10008208 0.02523
rs1000933 0.007852
rs10012165 0.005333

head rawfile.raw

rs1000132 a 0.0834
rs10001779 a -0.1261
rs10001818 t 0.28
rs10002358 a 0.0832
rs10004571 a -0.06
rs10005103 a 0.24
rs1000768 t 0.0711
rs10008208 a 0.0775
rs1000933 a 0.0772
rs10012165 t -0.1073

Giuseppe Fanelli

unread,
Aug 9, 2017, 4:56:24 AM8/9/17
to PRSice
when I add: debug.mode T plink.silent F

cd /usr/local/bin/PRSice_v1.2

R -q --file=./PRSice_v1.25.R --args base TOY_BASE_GWAS.assoc target TOY_TARGET_DATA slower 0 supper 0.5 sinc 0.01 covary F clump.snps F plink ./plink_1.9_mac_160914 figname EXAMPLE_1 debug.mode T plink.silent F

$debug.mode

[1] "T"


$plink.silent

[1] "F"


 ################################# 

 # 

 #  Check options match 

 # 

 ################################# 

[1] "Using current directory as working directory"

 ################################# 

 # 

 #  Check base input format 

 # 

 ################################# 

[1] "WARNING: No SE column in base data"

 ################################# 

 # 

 #   Remove Ambiguous SNPs 

 # 

 ################################# 

PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2

(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3

Logging to non_synonymous_snps_only.log.

Note: --noweb has no effect since no web check is implemented yet.

8192 MB RAM detected; reserving 4096 MB for main workspace.

91062 variants loaded from .bim file.

2000 people (1024 males, 976 females) loaded from .fam.

2000 phenotype values loaded from .fam.

--exclude: 91062 variants remaining.

Using 1 thread (no multithreaded calculations invoked).

Calculating allele frequencies... done.

Warning: 648016 het. haploid genotypes present (see non_synonymous_snps_only.hh

).

Total genotyping rate is 0.996442.

91062 variants and 2000 people pass filters and QC.

Among remaining phenotypes, 1000 are cases and 1000 are controls.

--make-bed to non_synonymous_snps_only.bed + non_synonymous_snps_only.bim +

non_synonymous_snps_only.fam ... done.

 ################################# 

 # 

 #   Deal with strand flips if target is in genotype format and produce input files for polygenic scoring 

 # 

 ################################# 

PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2

(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3

Logging to flipped_target.log.

Note: --noweb has no effect since no web check is implemented yet.

8192 MB RAM detected; reserving 4096 MB for main workspace.

91062 variants loaded from .bim file.

2000 people (1024 males, 976 females) loaded from .fam.

2000 phenotype values loaded from .fam.

--flip: 0 SNPs flipped.

Using 1 thread (no multithreaded calculations invoked).

Calculating allele frequencies... done.

Warning: 648016 het. haploid genotypes present (see flipped_target.hh ).

Total genotyping rate is 0.996442.

91062 variants and 2000 people pass filters and QC.

Among remaining phenotypes, 1000 are cases and 1000 are controls.

--make-bed to flipped_target.bed + flipped_target.bim + flipped_target.fam ...

done.

 ################################# 

 # 

 #   Polygenic scoring! 

 # 

 ################################# 

PLINK v1.90b2i 64-bit (8 Sep 2014)         https://www.cog-genomics.org/plink2

(C) 2005-2014 Shaun Purcell, Christopher Chang   GNU General Public License v3

Logging to PROFILES.log.

Note: --noweb has no effect since no web check is implemented yet.

8192 MB RAM detected; reserving 4096 MB for main workspace.

91062 variants loaded from .bim file.

2000 people (1024 males, 976 females) loaded from .fam.

2000 phenotype values loaded from .fam.

Using 1 thread (no multithreaded calculations invoked).

Calculating allele frequencies... done.

Warning: 648016 het. haploid genotypes present (see PROFILES.hh ).

Total genotyping rate is 0.996442.

91062 variants and 2000 people pass filters and QC.

Among remaining phenotypes, 1000 are cases and 1000 are controls.

--score: 0 ranges processed (52 empty ranges skipped).

Results written to PROFILES.*.profile.

 ################################# 

 # 

 #   Regression Models 

 # 

 ################################# 

Error in file(file, "rt") : cannot open the connection

Calls: read.table -> file

In addition: Warning message:

Sam Choi

unread,
Aug 9, 2017, 9:54:38 AM8/9/17
to PRSice
Ar, I see. We have seen this problem before. Can you please try to capitalize all your alleles for both your base and target file so that they are in upper case?

Sam Choi

unread,
Aug 9, 2017, 4:35:35 PM8/9/17
to PRSice
Could you please try and add cleanup F

and then check


head  rangelist.txt rangelist_ranges rawfile.raw  (If you want to, you can mask your SNP ID as long as they match between the files)

The problem is that it seems like none of the score were calculated by PLINK (maybe due to some file format)

Andrea Allegrini

unread,
Aug 10, 2017, 4:51:41 AM8/10/17
to PRSice
Great, that worked! thanks



xujiay...@gmail.com

unread,
Jun 23, 2018, 11:21:24 AM6/23/18
to PRSice
Hi Andrea
I met the same erro. Could you please clarify how did you sovle the problem ? Thanks a lot

Sam Choi

unread,
Jun 23, 2018, 6:54:27 PM6/23/18
to PRSice
This is a problem related to the old version of PRSice, maybe try using PRSice2 and see if that solves your problem?

Sonia Hesam

unread,
Feb 11, 2019, 12:50:01 AM2/11/19
to PRSice
Hi All,

I have the same error while running PRSice:
 ################################# 
 # 
 #   Polygenic scoring! 
 # 
 ################################# 
 ################################# 
 # 
 #   Covary by generated dimensions 
 # 
 ################################# 
Error in file(file, "rt") : cannot open the connection
Calls: read.table -> file
Execution halted

and after I used debug.mode T plink.silent F, I still got this:

Error: Failed to open prune_target_out.genome.
Error in file(file, "rt") : cannot open the connection
Calls: read.table -> file
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'ANCESTRY_INFORMATIVE_DIMENSIONS.mds': No such file or directory
Execution halted

Do you have any suggestion?
Thanks a lot.

Sam Choi

unread,
Feb 11, 2019, 5:25:25 PM2/11/19
to PRSice
Hi, we strongly recommend you to try using PRSice 2 instead. It has a better error report and should be easier for us to figure out the problem
Reply all
Reply to author
Forward
0 new messages