cannot open file '--no-restore.matrix'

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

cannot open file '--no-restore.matrix'

anikaM
Hello,

I am trying to run this code:
https://github.com/eleporcu/TWMR/blob/master/MR.R

with r-3.6.1

via:

Rscript MR.R --no-save ENSG00000154803

in the current directory I have saved: ENSG00000154803.ld and
ENSG00000154803.matrix as the software requires

but I am getting this error:

Error in file(file, "rt") : cannot open the connection
Calls: read.table -> file
In addition: Warning message:
In file(file, "rt") :
  cannot open file '--no-restore.matrix': No such file or directory
Execution halted


Please advise,

Thanks
Ana

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Ben Tupper-2
Hi,

You might check the order of your arguments.   Options come before the
script filename. See the details here...

https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript

Ben

On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:

>
> Hello,
>
> I am trying to run this code:
> https://github.com/eleporcu/TWMR/blob/master/MR.R
>
> with r-3.6.1
>
> via:
>
> Rscript MR.R --no-save ENSG00000154803
>
> in the current directory I have saved: ENSG00000154803.ld and
> ENSG00000154803.matrix as the software requires
>
> but I am getting this error:
>
> Error in file(file, "rt") : cannot open the connection
> Calls: read.table -> file
> In addition: Warning message:
> In file(file, "rt") :
>   cannot open file '--no-restore.matrix': No such file or directory
> Execution halted
>
>
> Please advise,
>
> Thanks
> Ana
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/
https://eco.bigelow.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
HI Ben,

thank you so much , I did this:

Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
Error: unexpected numeric constant in "1.000 0.089"
Execution halted

I made ENSG00000154803.ld with:
library(MASS)
write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")

and it looks like this:

1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
0.000 0.000 0.000 0.001 0.003 0.000
0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
0.001 0.012 0.005 0.000 0.004 0.004
0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
0.054 0.006 0.002 0.010 0.001 0.000
0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
0.066 0.010 0.030 0.001 0.003 0.000
0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
0.002 0.003 0.066 0.006 0.004 0.004
0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
0.016 0.000 0.025 0.000 0.005 0.000
0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
0.128 0.019 0.005 0.030 0.002 0.016
0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
0.098 0.010 0.012 0.001 0.006 0.003
0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
0.012 0.000 0.006 0.018 0.004 0.013
0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
0.001 0.091 0.057 0.062 0.002 0.005
0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
0.238 0.180 0.073 0.058 0.000 0.006
0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
1.000 0.158 0.006 0.044 0.006 0.001
0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
0.158 1.000 0.077 0.237 0.009 0.000
0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
0.006 0.077 1.000 0.056 0.000 0.004
0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
0.044 0.237 0.056 1.000 0.000 0.003
0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
0.006 0.009 0.000 0.000 1.000 0.002
0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
0.001 0.000 0.004 0.003 0.002 1.000

the other file (ENSG00000154803.matrix) looks like this:

GENES ENSG00000154803 BETA_GWAS
rs12601631 -0.320577 -0.0160778
rs1708623 0.708706 0.0717719
rs1708628 -0.645996 -0.0973019
rs17804843 -0.78984 0.0059607
rs4078062 -0.340732 -0.0716837
rs4316813 -0.721137 -0.00502219
rs7217764 -0.61641 0.16997
rs7221842 -0.377727 -0.00184011
rs12602831 -0.397059 0.0154625
rs138437542 -0.590669 0.0145733
rs2174369 -0.167913 -0.0268728
rs242252 0.20184 0.0161709
rs34121330 0.328602 0.0753894
rs4792798 -0.303601 0.00227314
rs7222311 -0.367686 -0.0419168
rs74369938 0.687555 -0.223105
rs8075751 -0.261916 -0.0313484

On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:

>
> Hi,
>
> You might check the order of your arguments.   Options come before the
> script filename. See the details here...
>
> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
>
> Ben
>
> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> >
> > Hello,
> >
> > I am trying to run this code:
> > https://github.com/eleporcu/TWMR/blob/master/MR.R
> >
> > with r-3.6.1
> >
> > via:
> >
> > Rscript MR.R --no-save ENSG00000154803
> >
> > in the current directory I have saved: ENSG00000154803.ld and
> > ENSG00000154803.matrix as the software requires
> >
> > but I am getting this error:
> >
> > Error in file(file, "rt") : cannot open the connection
> > Calls: read.table -> file
> > In addition: Warning message:
> > In file(file, "rt") :
> >   cannot open file '--no-restore.matrix': No such file or directory
> > Execution halted
> >
> >
> > Please advise,
> >
> > Thanks
> > Ana
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> West Boothbay Harbor, Maine
> http://www.bigelow.org/
> https://eco.bigelow.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Ben Tupper-2
Hi,

I think you want this order...

Rscript [options for R] script_file.R argument_1 argument_2 ...

So, like this ...

Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix

Cheers,
Ben

On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:

>
> HI Ben,
>
> thank you so much , I did this:
>
> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> Error: unexpected numeric constant in "1.000 0.089"
> Execution halted
>
> I made ENSG00000154803.ld with:
> library(MASS)
> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
>
> and it looks like this:
>
> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> 0.000 0.000 0.000 0.001 0.003 0.000
> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> 0.001 0.012 0.005 0.000 0.004 0.004
> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> 0.054 0.006 0.002 0.010 0.001 0.000
> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> 0.066 0.010 0.030 0.001 0.003 0.000
> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> 0.002 0.003 0.066 0.006 0.004 0.004
> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> 0.016 0.000 0.025 0.000 0.005 0.000
> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> 0.128 0.019 0.005 0.030 0.002 0.016
> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> 0.098 0.010 0.012 0.001 0.006 0.003
> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> 0.012 0.000 0.006 0.018 0.004 0.013
> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> 0.001 0.091 0.057 0.062 0.002 0.005
> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> 0.238 0.180 0.073 0.058 0.000 0.006
> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> 1.000 0.158 0.006 0.044 0.006 0.001
> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> 0.158 1.000 0.077 0.237 0.009 0.000
> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> 0.006 0.077 1.000 0.056 0.000 0.004
> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> 0.044 0.237 0.056 1.000 0.000 0.003
> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> 0.006 0.009 0.000 0.000 1.000 0.002
> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> 0.001 0.000 0.004 0.003 0.002 1.000
>
> the other file (ENSG00000154803.matrix) looks like this:
>
> GENES ENSG00000154803 BETA_GWAS
> rs12601631 -0.320577 -0.0160778
> rs1708623 0.708706 0.0717719
> rs1708628 -0.645996 -0.0973019
> rs17804843 -0.78984 0.0059607
> rs4078062 -0.340732 -0.0716837
> rs4316813 -0.721137 -0.00502219
> rs7217764 -0.61641 0.16997
> rs7221842 -0.377727 -0.00184011
> rs12602831 -0.397059 0.0154625
> rs138437542 -0.590669 0.0145733
> rs2174369 -0.167913 -0.0268728
> rs242252 0.20184 0.0161709
> rs34121330 0.328602 0.0753894
> rs4792798 -0.303601 0.00227314
> rs7222311 -0.367686 -0.0419168
> rs74369938 0.687555 -0.223105
> rs8075751 -0.261916 -0.0313484
>
> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> >
> > Hi,
> >
> > You might check the order of your arguments.   Options come before the
> > script filename. See the details here...
> >
> > https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> >
> > Ben
> >
> > On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> > >
> > > Hello,
> > >
> > > I am trying to run this code:
> > > https://github.com/eleporcu/TWMR/blob/master/MR.R
> > >
> > > with r-3.6.1
> > >
> > > via:
> > >
> > > Rscript MR.R --no-save ENSG00000154803
> > >
> > > in the current directory I have saved: ENSG00000154803.ld and
> > > ENSG00000154803.matrix as the software requires
> > >
> > > but I am getting this error:
> > >
> > > Error in file(file, "rt") : cannot open the connection
> > > Calls: read.table -> file
> > > In addition: Warning message:
> > > In file(file, "rt") :
> > >   cannot open file '--no-restore.matrix': No such file or directory
> > > Execution halted
> > >
> > >
> > > Please advise,
> > >
> > > Thanks
> > > Ana
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> >
> > --
> > Ben Tupper
> > Bigelow Laboratory for Ocean Science
> > West Boothbay Harbor, Maine
> > http://www.bigelow.org/
> > https://eco.bigelow.org



--
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/
https://eco.bigelow.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
HI Ben,

I tried it but it doesn't work:

Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
Error in file(file, "rt") : cannot open the connection
Calls: read.table -> file
In addition: Warning message:
In file(file, "rt") :
  cannot open file '--no-restore.matrix': No such file or directory
Execution halted

Please advise,
Ana

On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:

>
> Hi,
>
> I think you want this order...
>
> Rscript [options for R] script_file.R argument_1 argument_2 ...
>
> So, like this ...
>
> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>
> Cheers,
> Ben
>
> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> >
> > HI Ben,
> >
> > thank you so much , I did this:
> >
> > Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> > Error: unexpected numeric constant in "1.000 0.089"
> > Execution halted
> >
> > I made ENSG00000154803.ld with:
> > library(MASS)
> > write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> >
> > and it looks like this:
> >
> > 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> > 0.000 0.000 0.000 0.001 0.003 0.000
> > 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> > 0.001 0.012 0.005 0.000 0.004 0.004
> > 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> > 0.054 0.006 0.002 0.010 0.001 0.000
> > 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> > 0.066 0.010 0.030 0.001 0.003 0.000
> > 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> > 0.002 0.003 0.066 0.006 0.004 0.004
> > 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> > 0.016 0.000 0.025 0.000 0.005 0.000
> > 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> > 0.128 0.019 0.005 0.030 0.002 0.016
> > 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> > 0.098 0.010 0.012 0.001 0.006 0.003
> > 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> > 0.012 0.000 0.006 0.018 0.004 0.013
> > 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> > 0.001 0.091 0.057 0.062 0.002 0.005
> > 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> > 0.238 0.180 0.073 0.058 0.000 0.006
> > 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> > 1.000 0.158 0.006 0.044 0.006 0.001
> > 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> > 0.158 1.000 0.077 0.237 0.009 0.000
> > 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> > 0.006 0.077 1.000 0.056 0.000 0.004
> > 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> > 0.044 0.237 0.056 1.000 0.000 0.003
> > 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> > 0.006 0.009 0.000 0.000 1.000 0.002
> > 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> > 0.001 0.000 0.004 0.003 0.002 1.000
> >
> > the other file (ENSG00000154803.matrix) looks like this:
> >
> > GENES ENSG00000154803 BETA_GWAS
> > rs12601631 -0.320577 -0.0160778
> > rs1708623 0.708706 0.0717719
> > rs1708628 -0.645996 -0.0973019
> > rs17804843 -0.78984 0.0059607
> > rs4078062 -0.340732 -0.0716837
> > rs4316813 -0.721137 -0.00502219
> > rs7217764 -0.61641 0.16997
> > rs7221842 -0.377727 -0.00184011
> > rs12602831 -0.397059 0.0154625
> > rs138437542 -0.590669 0.0145733
> > rs2174369 -0.167913 -0.0268728
> > rs242252 0.20184 0.0161709
> > rs34121330 0.328602 0.0753894
> > rs4792798 -0.303601 0.00227314
> > rs7222311 -0.367686 -0.0419168
> > rs74369938 0.687555 -0.223105
> > rs8075751 -0.261916 -0.0313484
> >
> > On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> > >
> > > Hi,
> > >
> > > You might check the order of your arguments.   Options come before the
> > > script filename. See the details here...
> > >
> > > https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> > >
> > > Ben
> > >
> > > On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> > > >
> > > > Hello,
> > > >
> > > > I am trying to run this code:
> > > > https://github.com/eleporcu/TWMR/blob/master/MR.R
> > > >
> > > > with r-3.6.1
> > > >
> > > > via:
> > > >
> > > > Rscript MR.R --no-save ENSG00000154803
> > > >
> > > > in the current directory I have saved: ENSG00000154803.ld and
> > > > ENSG00000154803.matrix as the software requires
> > > >
> > > > but I am getting this error:
> > > >
> > > > Error in file(file, "rt") : cannot open the connection
> > > > Calls: read.table -> file
> > > > In addition: Warning message:
> > > > In file(file, "rt") :
> > > >   cannot open file '--no-restore.matrix': No such file or directory
> > > > Execution halted
> > > >
> > > >
> > > > Please advise,
> > > >
> > > > Thanks
> > > > Ana
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.
> > >
> > >
> > >
> > > --
> > > Ben Tupper
> > > Bigelow Laboratory for Ocean Science
> > > West Boothbay Harbor, Maine
> > > http://www.bigelow.org/
> > > https://eco.bigelow.org
>
>
>
> --
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> West Boothbay Harbor, Maine
> http://www.bigelow.org/
> https://eco.bigelow.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Duncan Murdoch-2
On 23/11/2019 10:26 a.m., Ana Marija wrote:

> HI Ben,
>
> I tried it but it doesn't work:
>
> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> Error in file(file, "rt") : cannot open the connection
> Calls: read.table -> file
> In addition: Warning message:
> In file(file, "rt") :
>    cannot open file '--no-restore.matrix': No such file or directory
> Execution halted
>

You should print the cmd_args variable that is set on the first line of
that script.  When I run a script that prints it using your command
line, this is what it looks like:

$ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
[1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
[2] "--slave"
[3] "--no-restore"
[4] "--no-save"
[5] "--file=MR.R"
[6] "--args"
[7] "ENSG00000154803.ld"
[8] "ENSG00000154803.matrix"

The next line

gene <- cmd_args[3]

is obviously wrong for my system, because it would set gene to
"--no-restore".  Your results will probably be somewhat different, but
it might be clear what you should use instead of the third element.

By the way, changing the first line

cmd_args=commandArgs()

to

cmd_args <- commandArgs(TRUE)

makes a lot of sense in most cases.  I haven't read your whole script so
I don't know it it makes sense for you.

Duncan Murdoch


> Please advise,
> Ana
>
> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
>>
>> Hi,
>>
>> I think you want this order...
>>
>> Rscript [options for R] script_file.R argument_1 argument_2 ...
>>
>> So, like this ...
>>
>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>
>> Cheers,
>> Ben
>>
>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
>>>
>>> HI Ben,
>>>
>>> thank you so much , I did this:
>>>
>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
>>> Error: unexpected numeric constant in "1.000 0.089"
>>> Execution halted
>>>
>>> I made ENSG00000154803.ld with:
>>> library(MASS)
>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
>>>
>>> and it looks like this:
>>>
>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
>>> 0.000 0.000 0.000 0.001 0.003 0.000
>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
>>> 0.001 0.012 0.005 0.000 0.004 0.004
>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
>>> 0.054 0.006 0.002 0.010 0.001 0.000
>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
>>> 0.066 0.010 0.030 0.001 0.003 0.000
>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
>>> 0.002 0.003 0.066 0.006 0.004 0.004
>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
>>> 0.016 0.000 0.025 0.000 0.005 0.000
>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
>>> 0.128 0.019 0.005 0.030 0.002 0.016
>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
>>> 0.098 0.010 0.012 0.001 0.006 0.003
>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
>>> 0.012 0.000 0.006 0.018 0.004 0.013
>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
>>> 0.001 0.091 0.057 0.062 0.002 0.005
>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
>>> 0.238 0.180 0.073 0.058 0.000 0.006
>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
>>> 1.000 0.158 0.006 0.044 0.006 0.001
>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
>>> 0.158 1.000 0.077 0.237 0.009 0.000
>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
>>> 0.006 0.077 1.000 0.056 0.000 0.004
>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
>>> 0.044 0.237 0.056 1.000 0.000 0.003
>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
>>> 0.006 0.009 0.000 0.000 1.000 0.002
>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
>>> 0.001 0.000 0.004 0.003 0.002 1.000
>>>
>>> the other file (ENSG00000154803.matrix) looks like this:
>>>
>>> GENES ENSG00000154803 BETA_GWAS
>>> rs12601631 -0.320577 -0.0160778
>>> rs1708623 0.708706 0.0717719
>>> rs1708628 -0.645996 -0.0973019
>>> rs17804843 -0.78984 0.0059607
>>> rs4078062 -0.340732 -0.0716837
>>> rs4316813 -0.721137 -0.00502219
>>> rs7217764 -0.61641 0.16997
>>> rs7221842 -0.377727 -0.00184011
>>> rs12602831 -0.397059 0.0154625
>>> rs138437542 -0.590669 0.0145733
>>> rs2174369 -0.167913 -0.0268728
>>> rs242252 0.20184 0.0161709
>>> rs34121330 0.328602 0.0753894
>>> rs4792798 -0.303601 0.00227314
>>> rs7222311 -0.367686 -0.0419168
>>> rs74369938 0.687555 -0.223105
>>> rs8075751 -0.261916 -0.0313484
>>>
>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> You might check the order of your arguments.   Options come before the
>>>> script filename. See the details here...
>>>>
>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
>>>>
>>>> Ben
>>>>
>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I am trying to run this code:
>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
>>>>>
>>>>> with r-3.6.1
>>>>>
>>>>> via:
>>>>>
>>>>> Rscript MR.R --no-save ENSG00000154803
>>>>>
>>>>> in the current directory I have saved: ENSG00000154803.ld and
>>>>> ENSG00000154803.matrix as the software requires
>>>>>
>>>>> but I am getting this error:
>>>>>
>>>>> Error in file(file, "rt") : cannot open the connection
>>>>> Calls: read.table -> file
>>>>> In addition: Warning message:
>>>>> In file(file, "rt") :
>>>>>    cannot open file '--no-restore.matrix': No such file or directory
>>>>> Execution halted
>>>>>
>>>>>
>>>>> Please advise,
>>>>>
>>>>> Thanks
>>>>> Ana
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>>>
>>>> --
>>>> Ben Tupper
>>>> Bigelow Laboratory for Ocean Science
>>>> West Boothbay Harbor, Maine
>>>> http://www.bigelow.org/
>>>> https://eco.bigelow.org
>>
>>
>>
>> --
>> Ben Tupper
>> Bigelow Laboratory for Ocean Science
>> West Boothbay Harbor, Maine
>> http://www.bigelow.org/
>> https://eco.bigelow.org
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
Hi Ben,

I am not sure what you mean when you say to print, is it this?

> cmd_args=commandArgs(TRUE)
> print(cmd_args)
character(0)
> cmd_args=commandArgs()
> print(cmd_args)
[1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"

I changed in the first line of this script:
https://github.com/eleporcu/TWMR/blob/master/MR.R

cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)

but again I get the same error:

Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
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.matrix': No such file or directory
Execution halted


Please advise,
Ana

On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:

>
> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> > HI Ben,
> >
> > I tried it but it doesn't work:
> >
> > Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > Error in file(file, "rt") : cannot open the connection
> > Calls: read.table -> file
> > In addition: Warning message:
> > In file(file, "rt") :
> >    cannot open file '--no-restore.matrix': No such file or directory
> > Execution halted
> >
>
> You should print the cmd_args variable that is set on the first line of
> that script.  When I run a script that prints it using your command
> line, this is what it looks like:
>
> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> [2] "--slave"
> [3] "--no-restore"
> [4] "--no-save"
> [5] "--file=MR.R"
> [6] "--args"
> [7] "ENSG00000154803.ld"
> [8] "ENSG00000154803.matrix"
>
> The next line
>
> gene <- cmd_args[3]
>
> is obviously wrong for my system, because it would set gene to
> "--no-restore".  Your results will probably be somewhat different, but
> it might be clear what you should use instead of the third element.
>
> By the way, changing the first line
>
> cmd_args=commandArgs()
>
> to
>
> cmd_args <- commandArgs(TRUE)
>
> makes a lot of sense in most cases.  I haven't read your whole script so
> I don't know it it makes sense for you.
>
> Duncan Murdoch
>
>
> > Please advise,
> > Ana
> >
> > On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> >>
> >> Hi,
> >>
> >> I think you want this order...
> >>
> >> Rscript [options for R] script_file.R argument_1 argument_2 ...
> >>
> >> So, like this ...
> >>
> >> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>
> >> Cheers,
> >> Ben
> >>
> >> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> >>>
> >>> HI Ben,
> >>>
> >>> thank you so much , I did this:
> >>>
> >>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> >>> Error: unexpected numeric constant in "1.000 0.089"
> >>> Execution halted
> >>>
> >>> I made ENSG00000154803.ld with:
> >>> library(MASS)
> >>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> >>>
> >>> and it looks like this:
> >>>
> >>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> >>> 0.000 0.000 0.000 0.001 0.003 0.000
> >>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> >>> 0.001 0.012 0.005 0.000 0.004 0.004
> >>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> >>> 0.054 0.006 0.002 0.010 0.001 0.000
> >>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> >>> 0.066 0.010 0.030 0.001 0.003 0.000
> >>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> >>> 0.002 0.003 0.066 0.006 0.004 0.004
> >>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> >>> 0.016 0.000 0.025 0.000 0.005 0.000
> >>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> >>> 0.128 0.019 0.005 0.030 0.002 0.016
> >>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> >>> 0.098 0.010 0.012 0.001 0.006 0.003
> >>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> >>> 0.012 0.000 0.006 0.018 0.004 0.013
> >>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> >>> 0.001 0.091 0.057 0.062 0.002 0.005
> >>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> >>> 0.238 0.180 0.073 0.058 0.000 0.006
> >>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> >>> 1.000 0.158 0.006 0.044 0.006 0.001
> >>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> >>> 0.158 1.000 0.077 0.237 0.009 0.000
> >>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> >>> 0.006 0.077 1.000 0.056 0.000 0.004
> >>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> >>> 0.044 0.237 0.056 1.000 0.000 0.003
> >>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> >>> 0.006 0.009 0.000 0.000 1.000 0.002
> >>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> >>> 0.001 0.000 0.004 0.003 0.002 1.000
> >>>
> >>> the other file (ENSG00000154803.matrix) looks like this:
> >>>
> >>> GENES ENSG00000154803 BETA_GWAS
> >>> rs12601631 -0.320577 -0.0160778
> >>> rs1708623 0.708706 0.0717719
> >>> rs1708628 -0.645996 -0.0973019
> >>> rs17804843 -0.78984 0.0059607
> >>> rs4078062 -0.340732 -0.0716837
> >>> rs4316813 -0.721137 -0.00502219
> >>> rs7217764 -0.61641 0.16997
> >>> rs7221842 -0.377727 -0.00184011
> >>> rs12602831 -0.397059 0.0154625
> >>> rs138437542 -0.590669 0.0145733
> >>> rs2174369 -0.167913 -0.0268728
> >>> rs242252 0.20184 0.0161709
> >>> rs34121330 0.328602 0.0753894
> >>> rs4792798 -0.303601 0.00227314
> >>> rs7222311 -0.367686 -0.0419168
> >>> rs74369938 0.687555 -0.223105
> >>> rs8075751 -0.261916 -0.0313484
> >>>
> >>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> You might check the order of your arguments.   Options come before the
> >>>> script filename. See the details here...
> >>>>
> >>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> >>>>
> >>>> Ben
> >>>>
> >>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> >>>>>
> >>>>> Hello,
> >>>>>
> >>>>> I am trying to run this code:
> >>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> >>>>>
> >>>>> with r-3.6.1
> >>>>>
> >>>>> via:
> >>>>>
> >>>>> Rscript MR.R --no-save ENSG00000154803
> >>>>>
> >>>>> in the current directory I have saved: ENSG00000154803.ld and
> >>>>> ENSG00000154803.matrix as the software requires
> >>>>>
> >>>>> but I am getting this error:
> >>>>>
> >>>>> Error in file(file, "rt") : cannot open the connection
> >>>>> Calls: read.table -> file
> >>>>> In addition: Warning message:
> >>>>> In file(file, "rt") :
> >>>>>    cannot open file '--no-restore.matrix': No such file or directory
> >>>>> Execution halted
> >>>>>
> >>>>>
> >>>>> Please advise,
> >>>>>
> >>>>> Thanks
> >>>>> Ana
> >>>>>
> >>>>> ______________________________________________
> >>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Ben Tupper
> >>>> Bigelow Laboratory for Ocean Science
> >>>> West Boothbay Harbor, Maine
> >>>> http://www.bigelow.org/
> >>>> https://eco.bigelow.org
> >>
> >>
> >>
> >> --
> >> Ben Tupper
> >> Bigelow Laboratory for Ocean Science
> >> West Boothbay Harbor, Maine
> >> http://www.bigelow.org/
> >> https://eco.bigelow.org
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Duncan Murdoch-2
On 23/11/2019 11:05 a.m., Ana Marija wrote:

> Hi Ben,
>
> I am not sure what you mean when you say to print, is it this?
>
>> cmd_args=commandArgs(TRUE)
>> print(cmd_args)
> character(0)
>> cmd_args=commandArgs()
>> print(cmd_args)
> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
>
> I changed in the first line of this script:
> https://github.com/eleporcu/TWMR/blob/master/MR.R
>
> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
>
> but again I get the same error:
>
> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> 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.matrix': No such file or directory
> Execution halted

You didn't put the print(cmd_args) into the script.

Duncan Murdoch

>
>
> Please advise,
> Ana
>
> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
>>
>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
>>> HI Ben,
>>>
>>> I tried it but it doesn't work:
>>>
>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>> Error in file(file, "rt") : cannot open the connection
>>> Calls: read.table -> file
>>> In addition: Warning message:
>>> In file(file, "rt") :
>>>     cannot open file '--no-restore.matrix': No such file or directory
>>> Execution halted
>>>
>>
>> You should print the cmd_args variable that is set on the first line of
>> that script.  When I run a script that prints it using your command
>> line, this is what it looks like:
>>
>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
>> [2] "--slave"
>> [3] "--no-restore"
>> [4] "--no-save"
>> [5] "--file=MR.R"
>> [6] "--args"
>> [7] "ENSG00000154803.ld"
>> [8] "ENSG00000154803.matrix"
>>
>> The next line
>>
>> gene <- cmd_args[3]
>>
>> is obviously wrong for my system, because it would set gene to
>> "--no-restore".  Your results will probably be somewhat different, but
>> it might be clear what you should use instead of the third element.
>>
>> By the way, changing the first line
>>
>> cmd_args=commandArgs()
>>
>> to
>>
>> cmd_args <- commandArgs(TRUE)
>>
>> makes a lot of sense in most cases.  I haven't read your whole script so
>> I don't know it it makes sense for you.
>>
>> Duncan Murdoch
>>
>>
>>> Please advise,
>>> Ana
>>>
>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I think you want this order...
>>>>
>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
>>>>
>>>> So, like this ...
>>>>
>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>>>
>>>> Cheers,
>>>> Ben
>>>>
>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
>>>>>
>>>>> HI Ben,
>>>>>
>>>>> thank you so much , I did this:
>>>>>
>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
>>>>> Error: unexpected numeric constant in "1.000 0.089"
>>>>> Execution halted
>>>>>
>>>>> I made ENSG00000154803.ld with:
>>>>> library(MASS)
>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
>>>>>
>>>>> and it looks like this:
>>>>>
>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
>>>>>
>>>>> the other file (ENSG00000154803.matrix) looks like this:
>>>>>
>>>>> GENES ENSG00000154803 BETA_GWAS
>>>>> rs12601631 -0.320577 -0.0160778
>>>>> rs1708623 0.708706 0.0717719
>>>>> rs1708628 -0.645996 -0.0973019
>>>>> rs17804843 -0.78984 0.0059607
>>>>> rs4078062 -0.340732 -0.0716837
>>>>> rs4316813 -0.721137 -0.00502219
>>>>> rs7217764 -0.61641 0.16997
>>>>> rs7221842 -0.377727 -0.00184011
>>>>> rs12602831 -0.397059 0.0154625
>>>>> rs138437542 -0.590669 0.0145733
>>>>> rs2174369 -0.167913 -0.0268728
>>>>> rs242252 0.20184 0.0161709
>>>>> rs34121330 0.328602 0.0753894
>>>>> rs4792798 -0.303601 0.00227314
>>>>> rs7222311 -0.367686 -0.0419168
>>>>> rs74369938 0.687555 -0.223105
>>>>> rs8075751 -0.261916 -0.0313484
>>>>>
>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> You might check the order of your arguments.   Options come before the
>>>>>> script filename. See the details here...
>>>>>>
>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
>>>>>>
>>>>>> Ben
>>>>>>
>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am trying to run this code:
>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
>>>>>>>
>>>>>>> with r-3.6.1
>>>>>>>
>>>>>>> via:
>>>>>>>
>>>>>>> Rscript MR.R --no-save ENSG00000154803
>>>>>>>
>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
>>>>>>> ENSG00000154803.matrix as the software requires
>>>>>>>
>>>>>>> but I am getting this error:
>>>>>>>
>>>>>>> Error in file(file, "rt") : cannot open the connection
>>>>>>> Calls: read.table -> file
>>>>>>> In addition: Warning message:
>>>>>>> In file(file, "rt") :
>>>>>>>     cannot open file '--no-restore.matrix': No such file or directory
>>>>>>> Execution halted
>>>>>>>
>>>>>>>
>>>>>>> Please advise,
>>>>>>>
>>>>>>> Thanks
>>>>>>> Ana
>>>>>>>
>>>>>>> ______________________________________________
>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Ben Tupper
>>>>>> Bigelow Laboratory for Ocean Science
>>>>>> West Boothbay Harbor, Maine
>>>>>> http://www.bigelow.org/
>>>>>> https://eco.bigelow.org
>>>>
>>>>
>>>>
>>>> --
>>>> Ben Tupper
>>>> Bigelow Laboratory for Ocean Science
>>>> West Boothbay Harbor, Maine
>>>> http://www.bigelow.org/
>>>> https://eco.bigelow.org
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
Hi Duncan,

thanks, I just did,
 Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
[1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
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.matrix': No such file or directory
Execution halted


Please advise

On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
<[hidden email]> wrote:

>
> On 23/11/2019 11:05 a.m., Ana Marija wrote:
> > Hi Ben,
> >
> > I am not sure what you mean when you say to print, is it this?
> >
> >> cmd_args=commandArgs(TRUE)
> >> print(cmd_args)
> > character(0)
> >> cmd_args=commandArgs()
> >> print(cmd_args)
> > [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
> >
> > I changed in the first line of this script:
> > https://github.com/eleporcu/TWMR/blob/master/MR.R
> >
> > cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
> >
> > but again I get the same error:
> >
> > Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > 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.matrix': No such file or directory
> > Execution halted
>
> You didn't put the print(cmd_args) into the script.
>
> Duncan Murdoch
> >
> >
> > Please advise,
> > Ana
> >
> > On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
> >>
> >> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> >>> HI Ben,
> >>>
> >>> I tried it but it doesn't work:
> >>>
> >>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>> Error in file(file, "rt") : cannot open the connection
> >>> Calls: read.table -> file
> >>> In addition: Warning message:
> >>> In file(file, "rt") :
> >>>     cannot open file '--no-restore.matrix': No such file or directory
> >>> Execution halted
> >>>
> >>
> >> You should print the cmd_args variable that is set on the first line of
> >> that script.  When I run a script that prints it using your command
> >> line, this is what it looks like:
> >>
> >> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> >> [2] "--slave"
> >> [3] "--no-restore"
> >> [4] "--no-save"
> >> [5] "--file=MR.R"
> >> [6] "--args"
> >> [7] "ENSG00000154803.ld"
> >> [8] "ENSG00000154803.matrix"
> >>
> >> The next line
> >>
> >> gene <- cmd_args[3]
> >>
> >> is obviously wrong for my system, because it would set gene to
> >> "--no-restore".  Your results will probably be somewhat different, but
> >> it might be clear what you should use instead of the third element.
> >>
> >> By the way, changing the first line
> >>
> >> cmd_args=commandArgs()
> >>
> >> to
> >>
> >> cmd_args <- commandArgs(TRUE)
> >>
> >> makes a lot of sense in most cases.  I haven't read your whole script so
> >> I don't know it it makes sense for you.
> >>
> >> Duncan Murdoch
> >>
> >>
> >>> Please advise,
> >>> Ana
> >>>
> >>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> I think you want this order...
> >>>>
> >>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
> >>>>
> >>>> So, like this ...
> >>>>
> >>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>>>
> >>>> Cheers,
> >>>> Ben
> >>>>
> >>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> >>>>>
> >>>>> HI Ben,
> >>>>>
> >>>>> thank you so much , I did this:
> >>>>>
> >>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> >>>>> Error: unexpected numeric constant in "1.000 0.089"
> >>>>> Execution halted
> >>>>>
> >>>>> I made ENSG00000154803.ld with:
> >>>>> library(MASS)
> >>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> >>>>>
> >>>>> and it looks like this:
> >>>>>
> >>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> >>>>> 0.000 0.000 0.000 0.001 0.003 0.000
> >>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> >>>>> 0.001 0.012 0.005 0.000 0.004 0.004
> >>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> >>>>> 0.054 0.006 0.002 0.010 0.001 0.000
> >>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> >>>>> 0.066 0.010 0.030 0.001 0.003 0.000
> >>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> >>>>> 0.002 0.003 0.066 0.006 0.004 0.004
> >>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> >>>>> 0.016 0.000 0.025 0.000 0.005 0.000
> >>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> >>>>> 0.128 0.019 0.005 0.030 0.002 0.016
> >>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> >>>>> 0.098 0.010 0.012 0.001 0.006 0.003
> >>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> >>>>> 0.012 0.000 0.006 0.018 0.004 0.013
> >>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> >>>>> 0.001 0.091 0.057 0.062 0.002 0.005
> >>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> >>>>> 0.238 0.180 0.073 0.058 0.000 0.006
> >>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> >>>>> 1.000 0.158 0.006 0.044 0.006 0.001
> >>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> >>>>> 0.158 1.000 0.077 0.237 0.009 0.000
> >>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> >>>>> 0.006 0.077 1.000 0.056 0.000 0.004
> >>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> >>>>> 0.044 0.237 0.056 1.000 0.000 0.003
> >>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> >>>>> 0.006 0.009 0.000 0.000 1.000 0.002
> >>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> >>>>> 0.001 0.000 0.004 0.003 0.002 1.000
> >>>>>
> >>>>> the other file (ENSG00000154803.matrix) looks like this:
> >>>>>
> >>>>> GENES ENSG00000154803 BETA_GWAS
> >>>>> rs12601631 -0.320577 -0.0160778
> >>>>> rs1708623 0.708706 0.0717719
> >>>>> rs1708628 -0.645996 -0.0973019
> >>>>> rs17804843 -0.78984 0.0059607
> >>>>> rs4078062 -0.340732 -0.0716837
> >>>>> rs4316813 -0.721137 -0.00502219
> >>>>> rs7217764 -0.61641 0.16997
> >>>>> rs7221842 -0.377727 -0.00184011
> >>>>> rs12602831 -0.397059 0.0154625
> >>>>> rs138437542 -0.590669 0.0145733
> >>>>> rs2174369 -0.167913 -0.0268728
> >>>>> rs242252 0.20184 0.0161709
> >>>>> rs34121330 0.328602 0.0753894
> >>>>> rs4792798 -0.303601 0.00227314
> >>>>> rs7222311 -0.367686 -0.0419168
> >>>>> rs74369938 0.687555 -0.223105
> >>>>> rs8075751 -0.261916 -0.0313484
> >>>>>
> >>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> You might check the order of your arguments.   Options come before the
> >>>>>> script filename. See the details here...
> >>>>>>
> >>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> >>>>>>
> >>>>>> Ben
> >>>>>>
> >>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> >>>>>>>
> >>>>>>> Hello,
> >>>>>>>
> >>>>>>> I am trying to run this code:
> >>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> >>>>>>>
> >>>>>>> with r-3.6.1
> >>>>>>>
> >>>>>>> via:
> >>>>>>>
> >>>>>>> Rscript MR.R --no-save ENSG00000154803
> >>>>>>>
> >>>>>>> in the current directory I have saved: ENSG00000154803.ld and
> >>>>>>> ENSG00000154803.matrix as the software requires
> >>>>>>>
> >>>>>>> but I am getting this error:
> >>>>>>>
> >>>>>>> Error in file(file, "rt") : cannot open the connection
> >>>>>>> Calls: read.table -> file
> >>>>>>> In addition: Warning message:
> >>>>>>> In file(file, "rt") :
> >>>>>>>     cannot open file '--no-restore.matrix': No such file or directory
> >>>>>>> Execution halted
> >>>>>>>
> >>>>>>>
> >>>>>>> Please advise,
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>> Ana
> >>>>>>>
> >>>>>>> ______________________________________________
> >>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>>>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Ben Tupper
> >>>>>> Bigelow Laboratory for Ocean Science
> >>>>>> West Boothbay Harbor, Maine
> >>>>>> http://www.bigelow.org/
> >>>>>> https://eco.bigelow.org
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Ben Tupper
> >>>> Bigelow Laboratory for Ocean Science
> >>>> West Boothbay Harbor, Maine
> >>>> http://www.bigelow.org/
> >>>> https://eco.bigelow.org
> >>>
> >>> ______________________________________________
> >>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Duncan Murdoch-2
On 23/11/2019 1:21 p.m., Ana Marija wrote:

> Hi Duncan,
>
> thanks, I just did,
>   Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> 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.matrix': No such file or directory
> Execution halted
>
Your script works with the third element in the list of arguments, and
there are only two.

Duncan Murdoch

>
> Please advise
>
> On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
> <[hidden email]> wrote:
>>
>> On 23/11/2019 11:05 a.m., Ana Marija wrote:
>>> Hi Ben,
>>>
>>> I am not sure what you mean when you say to print, is it this?
>>>
>>>> cmd_args=commandArgs(TRUE)
>>>> print(cmd_args)
>>> character(0)
>>>> cmd_args=commandArgs()
>>>> print(cmd_args)
>>> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
>>>
>>> I changed in the first line of this script:
>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
>>>
>>> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
>>>
>>> but again I get the same error:
>>>
>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>> 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.matrix': No such file or directory
>>> Execution halted
>>
>> You didn't put the print(cmd_args) into the script.
>>
>> Duncan Murdoch
>>>
>>>
>>> Please advise,
>>> Ana
>>>
>>> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
>>>>
>>>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
>>>>> HI Ben,
>>>>>
>>>>> I tried it but it doesn't work:
>>>>>
>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>>>> Error in file(file, "rt") : cannot open the connection
>>>>> Calls: read.table -> file
>>>>> In addition: Warning message:
>>>>> In file(file, "rt") :
>>>>>      cannot open file '--no-restore.matrix': No such file or directory
>>>>> Execution halted
>>>>>
>>>>
>>>> You should print the cmd_args variable that is set on the first line of
>>>> that script.  When I run a script that prints it using your command
>>>> line, this is what it looks like:
>>>>
>>>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
>>>> [2] "--slave"
>>>> [3] "--no-restore"
>>>> [4] "--no-save"
>>>> [5] "--file=MR.R"
>>>> [6] "--args"
>>>> [7] "ENSG00000154803.ld"
>>>> [8] "ENSG00000154803.matrix"
>>>>
>>>> The next line
>>>>
>>>> gene <- cmd_args[3]
>>>>
>>>> is obviously wrong for my system, because it would set gene to
>>>> "--no-restore".  Your results will probably be somewhat different, but
>>>> it might be clear what you should use instead of the third element.
>>>>
>>>> By the way, changing the first line
>>>>
>>>> cmd_args=commandArgs()
>>>>
>>>> to
>>>>
>>>> cmd_args <- commandArgs(TRUE)
>>>>
>>>> makes a lot of sense in most cases.  I haven't read your whole script so
>>>> I don't know it it makes sense for you.
>>>>
>>>> Duncan Murdoch
>>>>
>>>>
>>>>> Please advise,
>>>>> Ana
>>>>>
>>>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I think you want this order...
>>>>>>
>>>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
>>>>>>
>>>>>> So, like this ...
>>>>>>
>>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
>>>>>>
>>>>>> Cheers,
>>>>>> Ben
>>>>>>
>>>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
>>>>>>>
>>>>>>> HI Ben,
>>>>>>>
>>>>>>> thank you so much , I did this:
>>>>>>>
>>>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
>>>>>>> Error: unexpected numeric constant in "1.000 0.089"
>>>>>>> Execution halted
>>>>>>>
>>>>>>> I made ENSG00000154803.ld with:
>>>>>>> library(MASS)
>>>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
>>>>>>>
>>>>>>> and it looks like this:
>>>>>>>
>>>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
>>>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
>>>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
>>>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
>>>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
>>>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
>>>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
>>>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
>>>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
>>>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
>>>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
>>>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
>>>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
>>>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
>>>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
>>>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
>>>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
>>>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
>>>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
>>>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
>>>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
>>>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
>>>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
>>>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
>>>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
>>>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
>>>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
>>>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
>>>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
>>>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
>>>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
>>>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
>>>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
>>>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
>>>>>>>
>>>>>>> the other file (ENSG00000154803.matrix) looks like this:
>>>>>>>
>>>>>>> GENES ENSG00000154803 BETA_GWAS
>>>>>>> rs12601631 -0.320577 -0.0160778
>>>>>>> rs1708623 0.708706 0.0717719
>>>>>>> rs1708628 -0.645996 -0.0973019
>>>>>>> rs17804843 -0.78984 0.0059607
>>>>>>> rs4078062 -0.340732 -0.0716837
>>>>>>> rs4316813 -0.721137 -0.00502219
>>>>>>> rs7217764 -0.61641 0.16997
>>>>>>> rs7221842 -0.377727 -0.00184011
>>>>>>> rs12602831 -0.397059 0.0154625
>>>>>>> rs138437542 -0.590669 0.0145733
>>>>>>> rs2174369 -0.167913 -0.0268728
>>>>>>> rs242252 0.20184 0.0161709
>>>>>>> rs34121330 0.328602 0.0753894
>>>>>>> rs4792798 -0.303601 0.00227314
>>>>>>> rs7222311 -0.367686 -0.0419168
>>>>>>> rs74369938 0.687555 -0.223105
>>>>>>> rs8075751 -0.261916 -0.0313484
>>>>>>>
>>>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> You might check the order of your arguments.   Options come before the
>>>>>>>> script filename. See the details here...
>>>>>>>>
>>>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
>>>>>>>>
>>>>>>>> Ben
>>>>>>>>
>>>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I am trying to run this code:
>>>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
>>>>>>>>>
>>>>>>>>> with r-3.6.1
>>>>>>>>>
>>>>>>>>> via:
>>>>>>>>>
>>>>>>>>> Rscript MR.R --no-save ENSG00000154803
>>>>>>>>>
>>>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
>>>>>>>>> ENSG00000154803.matrix as the software requires
>>>>>>>>>
>>>>>>>>> but I am getting this error:
>>>>>>>>>
>>>>>>>>> Error in file(file, "rt") : cannot open the connection
>>>>>>>>> Calls: read.table -> file
>>>>>>>>> In addition: Warning message:
>>>>>>>>> In file(file, "rt") :
>>>>>>>>>      cannot open file '--no-restore.matrix': No such file or directory
>>>>>>>>> Execution halted
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Please advise,
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Ana
>>>>>>>>>
>>>>>>>>> ______________________________________________
>>>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Ben Tupper
>>>>>>>> Bigelow Laboratory for Ocean Science
>>>>>>>> West Boothbay Harbor, Maine
>>>>>>>> http://www.bigelow.org/
>>>>>>>> https://eco.bigelow.org
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Ben Tupper
>>>>>> Bigelow Laboratory for Ocean Science
>>>>>> West Boothbay Harbor, Maine
>>>>>> http://www.bigelow.org/
>>>>>> https://eco.bigelow.org
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Henrik Bengtsson-5
Maybe it would help to add:

file<-paste(gene,"matrix",sep=".")
if (!file.exists(file)) stop("File not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")

/Henrik

On Sat, Nov 23, 2019 at 11:55 AM Duncan Murdoch
<[hidden email]> wrote:

>
> On 23/11/2019 1:21 p.m., Ana Marija wrote:
> > Hi Duncan,
> >
> > thanks, I just did,
> >   Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > 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.matrix': No such file or directory
> > Execution halted
> >
> Your script works with the third element in the list of arguments, and
> there are only two.
>
> Duncan Murdoch
>
> >
> > Please advise
> >
> > On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
> > <[hidden email]> wrote:
> >>
> >> On 23/11/2019 11:05 a.m., Ana Marija wrote:
> >>> Hi Ben,
> >>>
> >>> I am not sure what you mean when you say to print, is it this?
> >>>
> >>>> cmd_args=commandArgs(TRUE)
> >>>> print(cmd_args)
> >>> character(0)
> >>>> cmd_args=commandArgs()
> >>>> print(cmd_args)
> >>> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
> >>>
> >>> I changed in the first line of this script:
> >>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> >>>
> >>> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
> >>>
> >>> but again I get the same error:
> >>>
> >>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>> 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.matrix': No such file or directory
> >>> Execution halted
> >>
> >> You didn't put the print(cmd_args) into the script.
> >>
> >> Duncan Murdoch
> >>>
> >>>
> >>> Please advise,
> >>> Ana
> >>>
> >>> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
> >>>>
> >>>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> >>>>> HI Ben,
> >>>>>
> >>>>> I tried it but it doesn't work:
> >>>>>
> >>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>>>> Error in file(file, "rt") : cannot open the connection
> >>>>> Calls: read.table -> file
> >>>>> In addition: Warning message:
> >>>>> In file(file, "rt") :
> >>>>>      cannot open file '--no-restore.matrix': No such file or directory
> >>>>> Execution halted
> >>>>>
> >>>>
> >>>> You should print the cmd_args variable that is set on the first line of
> >>>> that script.  When I run a script that prints it using your command
> >>>> line, this is what it looks like:
> >>>>
> >>>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> >>>> [2] "--slave"
> >>>> [3] "--no-restore"
> >>>> [4] "--no-save"
> >>>> [5] "--file=MR.R"
> >>>> [6] "--args"
> >>>> [7] "ENSG00000154803.ld"
> >>>> [8] "ENSG00000154803.matrix"
> >>>>
> >>>> The next line
> >>>>
> >>>> gene <- cmd_args[3]
> >>>>
> >>>> is obviously wrong for my system, because it would set gene to
> >>>> "--no-restore".  Your results will probably be somewhat different, but
> >>>> it might be clear what you should use instead of the third element.
> >>>>
> >>>> By the way, changing the first line
> >>>>
> >>>> cmd_args=commandArgs()
> >>>>
> >>>> to
> >>>>
> >>>> cmd_args <- commandArgs(TRUE)
> >>>>
> >>>> makes a lot of sense in most cases.  I haven't read your whole script so
> >>>> I don't know it it makes sense for you.
> >>>>
> >>>> Duncan Murdoch
> >>>>
> >>>>
> >>>>> Please advise,
> >>>>> Ana
> >>>>>
> >>>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I think you want this order...
> >>>>>>
> >>>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
> >>>>>>
> >>>>>> So, like this ...
> >>>>>>
> >>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> >>>>>>
> >>>>>> Cheers,
> >>>>>> Ben
> >>>>>>
> >>>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> >>>>>>>
> >>>>>>> HI Ben,
> >>>>>>>
> >>>>>>> thank you so much , I did this:
> >>>>>>>
> >>>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> >>>>>>> Error: unexpected numeric constant in "1.000 0.089"
> >>>>>>> Execution halted
> >>>>>>>
> >>>>>>> I made ENSG00000154803.ld with:
> >>>>>>> library(MASS)
> >>>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> >>>>>>>
> >>>>>>> and it looks like this:
> >>>>>>>
> >>>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> >>>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
> >>>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> >>>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
> >>>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> >>>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
> >>>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> >>>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
> >>>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> >>>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
> >>>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> >>>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
> >>>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> >>>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
> >>>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> >>>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
> >>>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> >>>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
> >>>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> >>>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
> >>>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> >>>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
> >>>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> >>>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
> >>>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> >>>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
> >>>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> >>>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
> >>>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> >>>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
> >>>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> >>>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
> >>>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> >>>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
> >>>>>>>
> >>>>>>> the other file (ENSG00000154803.matrix) looks like this:
> >>>>>>>
> >>>>>>> GENES ENSG00000154803 BETA_GWAS
> >>>>>>> rs12601631 -0.320577 -0.0160778
> >>>>>>> rs1708623 0.708706 0.0717719
> >>>>>>> rs1708628 -0.645996 -0.0973019
> >>>>>>> rs17804843 -0.78984 0.0059607
> >>>>>>> rs4078062 -0.340732 -0.0716837
> >>>>>>> rs4316813 -0.721137 -0.00502219
> >>>>>>> rs7217764 -0.61641 0.16997
> >>>>>>> rs7221842 -0.377727 -0.00184011
> >>>>>>> rs12602831 -0.397059 0.0154625
> >>>>>>> rs138437542 -0.590669 0.0145733
> >>>>>>> rs2174369 -0.167913 -0.0268728
> >>>>>>> rs242252 0.20184 0.0161709
> >>>>>>> rs34121330 0.328602 0.0753894
> >>>>>>> rs4792798 -0.303601 0.00227314
> >>>>>>> rs7222311 -0.367686 -0.0419168
> >>>>>>> rs74369938 0.687555 -0.223105
> >>>>>>> rs8075751 -0.261916 -0.0313484
> >>>>>>>
> >>>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> You might check the order of your arguments.   Options come before the
> >>>>>>>> script filename. See the details here...
> >>>>>>>>
> >>>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> >>>>>>>>
> >>>>>>>> Ben
> >>>>>>>>
> >>>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> >>>>>>>>>
> >>>>>>>>> Hello,
> >>>>>>>>>
> >>>>>>>>> I am trying to run this code:
> >>>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> >>>>>>>>>
> >>>>>>>>> with r-3.6.1
> >>>>>>>>>
> >>>>>>>>> via:
> >>>>>>>>>
> >>>>>>>>> Rscript MR.R --no-save ENSG00000154803
> >>>>>>>>>
> >>>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
> >>>>>>>>> ENSG00000154803.matrix as the software requires
> >>>>>>>>>
> >>>>>>>>> but I am getting this error:
> >>>>>>>>>
> >>>>>>>>> Error in file(file, "rt") : cannot open the connection
> >>>>>>>>> Calls: read.table -> file
> >>>>>>>>> In addition: Warning message:
> >>>>>>>>> In file(file, "rt") :
> >>>>>>>>>      cannot open file '--no-restore.matrix': No such file or directory
> >>>>>>>>> Execution halted
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Please advise,
> >>>>>>>>>
> >>>>>>>>> Thanks
> >>>>>>>>> Ana
> >>>>>>>>>
> >>>>>>>>> ______________________________________________
> >>>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Ben Tupper
> >>>>>>>> Bigelow Laboratory for Ocean Science
> >>>>>>>> West Boothbay Harbor, Maine
> >>>>>>>> http://www.bigelow.org/
> >>>>>>>> https://eco.bigelow.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Ben Tupper
> >>>>>> Bigelow Laboratory for Ocean Science
> >>>>>> West Boothbay Harbor, Maine
> >>>>>> http://www.bigelow.org/
> >>>>>> https://eco.bigelow.org
> >>>>>
> >>>>> ______________________________________________
> >>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >>>>> and provide commented, minimal, self-contained, reproducible code.
> >>>>>
> >>>>
> >>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
it is confusing because in documentation they say this is how you run
the script:
https://github.com/eleporcu/TWMR

I tried changing this on the script:

cmd_args=commandArgs(TRUE)
print(cmd_args)
gene<-cmd_args[3]
Ngwas<-239087
N_eQTLs<-32000
out<-c("gene","alpha","SE","P","Nsnps","Ngene")

file<-paste(gene,"matrix",sep=".")
if (!file.exists(file)) stop("File not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")
#file<-paste(gene,"matrix",sep=".")
#filecluster<-read.table(file,header=T,sep=".",dec=" ")
beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])

and I run it:
Rscript< MR.R --no-save ENSG00000154803.ld ENSG00000154803.matrix
Error: unexpected numeric constant in "1.000 0.089"
Execution halted


I also tried this:
Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
[1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
Error: File not found: NA.matrix
Execution halted


Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
[1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
Error: File not found: NA.matrix
Execution halted

On Sat, Nov 23, 2019 at 2:08 PM Henrik Bengtsson
<[hidden email]> wrote:

>
> Maybe it would help to add:
>
> file<-paste(gene,"matrix",sep=".")
> if (!file.exists(file)) stop("File not found: ", file)
> filecluster<-read.table(file,header=T,sep=" ",dec=".")
>
> /Henrik
>
> On Sat, Nov 23, 2019 at 11:55 AM Duncan Murdoch
> <[hidden email]> wrote:
> >
> > On 23/11/2019 1:21 p.m., Ana Marija wrote:
> > > Hi Duncan,
> > >
> > > thanks, I just did,
> > >   Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > > 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.matrix': No such file or directory
> > > Execution halted
> > >
> > Your script works with the third element in the list of arguments, and
> > there are only two.
> >
> > Duncan Murdoch
> >
> > >
> > > Please advise
> > >
> > > On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
> > > <[hidden email]> wrote:
> > >>
> > >> On 23/11/2019 11:05 a.m., Ana Marija wrote:
> > >>> Hi Ben,
> > >>>
> > >>> I am not sure what you mean when you say to print, is it this?
> > >>>
> > >>>> cmd_args=commandArgs(TRUE)
> > >>>> print(cmd_args)
> > >>> character(0)
> > >>>> cmd_args=commandArgs()
> > >>>> print(cmd_args)
> > >>> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
> > >>>
> > >>> I changed in the first line of this script:
> > >>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > >>>
> > >>> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
> > >>>
> > >>> but again I get the same error:
> > >>>
> > >>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > >>> 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.matrix': No such file or directory
> > >>> Execution halted
> > >>
> > >> You didn't put the print(cmd_args) into the script.
> > >>
> > >> Duncan Murdoch
> > >>>
> > >>>
> > >>> Please advise,
> > >>> Ana
> > >>>
> > >>> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
> > >>>>
> > >>>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> > >>>>> HI Ben,
> > >>>>>
> > >>>>> I tried it but it doesn't work:
> > >>>>>
> > >>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > >>>>> Error in file(file, "rt") : cannot open the connection
> > >>>>> Calls: read.table -> file
> > >>>>> In addition: Warning message:
> > >>>>> In file(file, "rt") :
> > >>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > >>>>> Execution halted
> > >>>>>
> > >>>>
> > >>>> You should print the cmd_args variable that is set on the first line of
> > >>>> that script.  When I run a script that prints it using your command
> > >>>> line, this is what it looks like:
> > >>>>
> > >>>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > >>>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> > >>>> [2] "--slave"
> > >>>> [3] "--no-restore"
> > >>>> [4] "--no-save"
> > >>>> [5] "--file=MR.R"
> > >>>> [6] "--args"
> > >>>> [7] "ENSG00000154803.ld"
> > >>>> [8] "ENSG00000154803.matrix"
> > >>>>
> > >>>> The next line
> > >>>>
> > >>>> gene <- cmd_args[3]
> > >>>>
> > >>>> is obviously wrong for my system, because it would set gene to
> > >>>> "--no-restore".  Your results will probably be somewhat different, but
> > >>>> it might be clear what you should use instead of the third element.
> > >>>>
> > >>>> By the way, changing the first line
> > >>>>
> > >>>> cmd_args=commandArgs()
> > >>>>
> > >>>> to
> > >>>>
> > >>>> cmd_args <- commandArgs(TRUE)
> > >>>>
> > >>>> makes a lot of sense in most cases.  I haven't read your whole script so
> > >>>> I don't know it it makes sense for you.
> > >>>>
> > >>>> Duncan Murdoch
> > >>>>
> > >>>>
> > >>>>> Please advise,
> > >>>>> Ana
> > >>>>>
> > >>>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> > >>>>>>
> > >>>>>> Hi,
> > >>>>>>
> > >>>>>> I think you want this order...
> > >>>>>>
> > >>>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
> > >>>>>>
> > >>>>>> So, like this ...
> > >>>>>>
> > >>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > >>>>>>
> > >>>>>> Cheers,
> > >>>>>> Ben
> > >>>>>>
> > >>>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> > >>>>>>>
> > >>>>>>> HI Ben,
> > >>>>>>>
> > >>>>>>> thank you so much , I did this:
> > >>>>>>>
> > >>>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> > >>>>>>> Error: unexpected numeric constant in "1.000 0.089"
> > >>>>>>> Execution halted
> > >>>>>>>
> > >>>>>>> I made ENSG00000154803.ld with:
> > >>>>>>> library(MASS)
> > >>>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> > >>>>>>>
> > >>>>>>> and it looks like this:
> > >>>>>>>
> > >>>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> > >>>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
> > >>>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> > >>>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
> > >>>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> > >>>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
> > >>>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> > >>>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
> > >>>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> > >>>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
> > >>>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> > >>>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
> > >>>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> > >>>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
> > >>>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> > >>>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
> > >>>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> > >>>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
> > >>>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> > >>>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
> > >>>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> > >>>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
> > >>>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> > >>>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
> > >>>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> > >>>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
> > >>>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> > >>>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
> > >>>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> > >>>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
> > >>>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> > >>>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
> > >>>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> > >>>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
> > >>>>>>>
> > >>>>>>> the other file (ENSG00000154803.matrix) looks like this:
> > >>>>>>>
> > >>>>>>> GENES ENSG00000154803 BETA_GWAS
> > >>>>>>> rs12601631 -0.320577 -0.0160778
> > >>>>>>> rs1708623 0.708706 0.0717719
> > >>>>>>> rs1708628 -0.645996 -0.0973019
> > >>>>>>> rs17804843 -0.78984 0.0059607
> > >>>>>>> rs4078062 -0.340732 -0.0716837
> > >>>>>>> rs4316813 -0.721137 -0.00502219
> > >>>>>>> rs7217764 -0.61641 0.16997
> > >>>>>>> rs7221842 -0.377727 -0.00184011
> > >>>>>>> rs12602831 -0.397059 0.0154625
> > >>>>>>> rs138437542 -0.590669 0.0145733
> > >>>>>>> rs2174369 -0.167913 -0.0268728
> > >>>>>>> rs242252 0.20184 0.0161709
> > >>>>>>> rs34121330 0.328602 0.0753894
> > >>>>>>> rs4792798 -0.303601 0.00227314
> > >>>>>>> rs7222311 -0.367686 -0.0419168
> > >>>>>>> rs74369938 0.687555 -0.223105
> > >>>>>>> rs8075751 -0.261916 -0.0313484
> > >>>>>>>
> > >>>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> > >>>>>>>>
> > >>>>>>>> Hi,
> > >>>>>>>>
> > >>>>>>>> You might check the order of your arguments.   Options come before the
> > >>>>>>>> script filename. See the details here...
> > >>>>>>>>
> > >>>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> > >>>>>>>>
> > >>>>>>>> Ben
> > >>>>>>>>
> > >>>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> > >>>>>>>>>
> > >>>>>>>>> Hello,
> > >>>>>>>>>
> > >>>>>>>>> I am trying to run this code:
> > >>>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > >>>>>>>>>
> > >>>>>>>>> with r-3.6.1
> > >>>>>>>>>
> > >>>>>>>>> via:
> > >>>>>>>>>
> > >>>>>>>>> Rscript MR.R --no-save ENSG00000154803
> > >>>>>>>>>
> > >>>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
> > >>>>>>>>> ENSG00000154803.matrix as the software requires
> > >>>>>>>>>
> > >>>>>>>>> but I am getting this error:
> > >>>>>>>>>
> > >>>>>>>>> Error in file(file, "rt") : cannot open the connection
> > >>>>>>>>> Calls: read.table -> file
> > >>>>>>>>> In addition: Warning message:
> > >>>>>>>>> In file(file, "rt") :
> > >>>>>>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > >>>>>>>>> Execution halted
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> Please advise,
> > >>>>>>>>>
> > >>>>>>>>> Thanks
> > >>>>>>>>> Ana
> > >>>>>>>>>
> > >>>>>>>>> ______________________________________________
> > >>>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > >>>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>> --
> > >>>>>>>> Ben Tupper
> > >>>>>>>> Bigelow Laboratory for Ocean Science
> > >>>>>>>> West Boothbay Harbor, Maine
> > >>>>>>>> http://www.bigelow.org/
> > >>>>>>>> https://eco.bigelow.org
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>> --
> > >>>>>> Ben Tupper
> > >>>>>> Bigelow Laboratory for Ocean Science
> > >>>>>> West Boothbay Harbor, Maine
> > >>>>>> http://www.bigelow.org/
> > >>>>>> https://eco.bigelow.org
> > >>>>>
> > >>>>> ______________________________________________
> > >>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > >>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > >>>>> and provide commented, minimal, self-contained, reproducible code.
> > >>>>>
> > >>>>
> > >>
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

Henrik Bengtsson-5
Looking at the https://github.com/eleporcu/TWMR/blob/master/README.txt,
it looks like you should pass a single argument when you call the MR.R
script and it should be the name of a gene, e.g. 'ENSG00000154803'.
You are passing two arguments and they look like filenames.

Update the script, because it should really use commandArgs(TRUE), to:

cmd_args <- commandArgs(TRUE)
if (length(cmd_args) == 0L) stop("No arguments specified.")
print(cmd_args)
gene<-cmd_args[length(cmd_args)]   ## Last argument is the 'gene'
Ngwas<-239087
N_eQTLs<-32000
out<-c("gene","alpha","SE","P","Nsnps","Ngene")

file<-paste(gene,"matrix",sep=".")
if (!file.exists(file)) stop("File not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")
...

The call the script from the command line as:

$ Rscript MR.R ENSG00000154803

That should do it

/Henrik


On Sat, Nov 23, 2019 at 12:24 PM Ana Marija <[hidden email]> wrote:

>
> it is confusing because in documentation they say this is how you run
> the script:
> https://github.com/eleporcu/TWMR
>
> I tried changing this on the script:
>
> cmd_args=commandArgs(TRUE)
> print(cmd_args)
> gene<-cmd_args[3]
> Ngwas<-239087
> N_eQTLs<-32000
> out<-c("gene","alpha","SE","P","Nsnps","Ngene")
>
> file<-paste(gene,"matrix",sep=".")
> if (!file.exists(file)) stop("File not found: ", file)
> filecluster<-read.table(file,header=T,sep=" ",dec=".")
> #file<-paste(gene,"matrix",sep=".")
> #filecluster<-read.table(file,header=T,sep=".",dec=" ")
> beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])
>
> and I run it:
> Rscript< MR.R --no-save ENSG00000154803.ld ENSG00000154803.matrix
> Error: unexpected numeric constant in "1.000 0.089"
> Execution halted
>
>
> I also tried this:
> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> Error: File not found: NA.matrix
> Execution halted
>
>
> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> Error: File not found: NA.matrix
> Execution halted
>
> On Sat, Nov 23, 2019 at 2:08 PM Henrik Bengtsson
> <[hidden email]> wrote:
> >
> > Maybe it would help to add:
> >
> > file<-paste(gene,"matrix",sep=".")
> > if (!file.exists(file)) stop("File not found: ", file)
> > filecluster<-read.table(file,header=T,sep=" ",dec=".")
> >
> > /Henrik
> >
> > On Sat, Nov 23, 2019 at 11:55 AM Duncan Murdoch
> > <[hidden email]> wrote:
> > >
> > > On 23/11/2019 1:21 p.m., Ana Marija wrote:
> > > > Hi Duncan,
> > > >
> > > > thanks, I just did,
> > > >   Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > > > 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.matrix': No such file or directory
> > > > Execution halted
> > > >
> > > Your script works with the third element in the list of arguments, and
> > > there are only two.
> > >
> > > Duncan Murdoch
> > >
> > > >
> > > > Please advise
> > > >
> > > > On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
> > > > <[hidden email]> wrote:
> > > >>
> > > >> On 23/11/2019 11:05 a.m., Ana Marija wrote:
> > > >>> Hi Ben,
> > > >>>
> > > >>> I am not sure what you mean when you say to print, is it this?
> > > >>>
> > > >>>> cmd_args=commandArgs(TRUE)
> > > >>>> print(cmd_args)
> > > >>> character(0)
> > > >>>> cmd_args=commandArgs()
> > > >>>> print(cmd_args)
> > > >>> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
> > > >>>
> > > >>> I changed in the first line of this script:
> > > >>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > > >>>
> > > >>> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
> > > >>>
> > > >>> but again I get the same error:
> > > >>>
> > > >>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > >>> 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.matrix': No such file or directory
> > > >>> Execution halted
> > > >>
> > > >> You didn't put the print(cmd_args) into the script.
> > > >>
> > > >> Duncan Murdoch
> > > >>>
> > > >>>
> > > >>> Please advise,
> > > >>> Ana
> > > >>>
> > > >>> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
> > > >>>>
> > > >>>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> > > >>>>> HI Ben,
> > > >>>>>
> > > >>>>> I tried it but it doesn't work:
> > > >>>>>
> > > >>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > >>>>> Error in file(file, "rt") : cannot open the connection
> > > >>>>> Calls: read.table -> file
> > > >>>>> In addition: Warning message:
> > > >>>>> In file(file, "rt") :
> > > >>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > > >>>>> Execution halted
> > > >>>>>
> > > >>>>
> > > >>>> You should print the cmd_args variable that is set on the first line of
> > > >>>> that script.  When I run a script that prints it using your command
> > > >>>> line, this is what it looks like:
> > > >>>>
> > > >>>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > >>>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> > > >>>> [2] "--slave"
> > > >>>> [3] "--no-restore"
> > > >>>> [4] "--no-save"
> > > >>>> [5] "--file=MR.R"
> > > >>>> [6] "--args"
> > > >>>> [7] "ENSG00000154803.ld"
> > > >>>> [8] "ENSG00000154803.matrix"
> > > >>>>
> > > >>>> The next line
> > > >>>>
> > > >>>> gene <- cmd_args[3]
> > > >>>>
> > > >>>> is obviously wrong for my system, because it would set gene to
> > > >>>> "--no-restore".  Your results will probably be somewhat different, but
> > > >>>> it might be clear what you should use instead of the third element.
> > > >>>>
> > > >>>> By the way, changing the first line
> > > >>>>
> > > >>>> cmd_args=commandArgs()
> > > >>>>
> > > >>>> to
> > > >>>>
> > > >>>> cmd_args <- commandArgs(TRUE)
> > > >>>>
> > > >>>> makes a lot of sense in most cases.  I haven't read your whole script so
> > > >>>> I don't know it it makes sense for you.
> > > >>>>
> > > >>>> Duncan Murdoch
> > > >>>>
> > > >>>>
> > > >>>>> Please advise,
> > > >>>>> Ana
> > > >>>>>
> > > >>>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> > > >>>>>>
> > > >>>>>> Hi,
> > > >>>>>>
> > > >>>>>> I think you want this order...
> > > >>>>>>
> > > >>>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
> > > >>>>>>
> > > >>>>>> So, like this ...
> > > >>>>>>
> > > >>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > >>>>>>
> > > >>>>>> Cheers,
> > > >>>>>> Ben
> > > >>>>>>
> > > >>>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> > > >>>>>>>
> > > >>>>>>> HI Ben,
> > > >>>>>>>
> > > >>>>>>> thank you so much , I did this:
> > > >>>>>>>
> > > >>>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> > > >>>>>>> Error: unexpected numeric constant in "1.000 0.089"
> > > >>>>>>> Execution halted
> > > >>>>>>>
> > > >>>>>>> I made ENSG00000154803.ld with:
> > > >>>>>>> library(MASS)
> > > >>>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> > > >>>>>>>
> > > >>>>>>> and it looks like this:
> > > >>>>>>>
> > > >>>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> > > >>>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
> > > >>>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> > > >>>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
> > > >>>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> > > >>>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
> > > >>>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> > > >>>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
> > > >>>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> > > >>>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
> > > >>>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> > > >>>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
> > > >>>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> > > >>>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
> > > >>>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> > > >>>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
> > > >>>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> > > >>>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
> > > >>>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> > > >>>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
> > > >>>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> > > >>>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
> > > >>>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> > > >>>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
> > > >>>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> > > >>>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
> > > >>>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> > > >>>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
> > > >>>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> > > >>>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
> > > >>>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> > > >>>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
> > > >>>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> > > >>>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
> > > >>>>>>>
> > > >>>>>>> the other file (ENSG00000154803.matrix) looks like this:
> > > >>>>>>>
> > > >>>>>>> GENES ENSG00000154803 BETA_GWAS
> > > >>>>>>> rs12601631 -0.320577 -0.0160778
> > > >>>>>>> rs1708623 0.708706 0.0717719
> > > >>>>>>> rs1708628 -0.645996 -0.0973019
> > > >>>>>>> rs17804843 -0.78984 0.0059607
> > > >>>>>>> rs4078062 -0.340732 -0.0716837
> > > >>>>>>> rs4316813 -0.721137 -0.00502219
> > > >>>>>>> rs7217764 -0.61641 0.16997
> > > >>>>>>> rs7221842 -0.377727 -0.00184011
> > > >>>>>>> rs12602831 -0.397059 0.0154625
> > > >>>>>>> rs138437542 -0.590669 0.0145733
> > > >>>>>>> rs2174369 -0.167913 -0.0268728
> > > >>>>>>> rs242252 0.20184 0.0161709
> > > >>>>>>> rs34121330 0.328602 0.0753894
> > > >>>>>>> rs4792798 -0.303601 0.00227314
> > > >>>>>>> rs7222311 -0.367686 -0.0419168
> > > >>>>>>> rs74369938 0.687555 -0.223105
> > > >>>>>>> rs8075751 -0.261916 -0.0313484
> > > >>>>>>>
> > > >>>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> > > >>>>>>>>
> > > >>>>>>>> Hi,
> > > >>>>>>>>
> > > >>>>>>>> You might check the order of your arguments.   Options come before the
> > > >>>>>>>> script filename. See the details here...
> > > >>>>>>>>
> > > >>>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> > > >>>>>>>>
> > > >>>>>>>> Ben
> > > >>>>>>>>
> > > >>>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> > > >>>>>>>>>
> > > >>>>>>>>> Hello,
> > > >>>>>>>>>
> > > >>>>>>>>> I am trying to run this code:
> > > >>>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > > >>>>>>>>>
> > > >>>>>>>>> with r-3.6.1
> > > >>>>>>>>>
> > > >>>>>>>>> via:
> > > >>>>>>>>>
> > > >>>>>>>>> Rscript MR.R --no-save ENSG00000154803
> > > >>>>>>>>>
> > > >>>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
> > > >>>>>>>>> ENSG00000154803.matrix as the software requires
> > > >>>>>>>>>
> > > >>>>>>>>> but I am getting this error:
> > > >>>>>>>>>
> > > >>>>>>>>> Error in file(file, "rt") : cannot open the connection
> > > >>>>>>>>> Calls: read.table -> file
> > > >>>>>>>>> In addition: Warning message:
> > > >>>>>>>>> In file(file, "rt") :
> > > >>>>>>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > > >>>>>>>>> Execution halted
> > > >>>>>>>>>
> > > >>>>>>>>>
> > > >>>>>>>>> Please advise,
> > > >>>>>>>>>
> > > >>>>>>>>> Thanks
> > > >>>>>>>>> Ana
> > > >>>>>>>>>
> > > >>>>>>>>> ______________________________________________
> > > >>>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > > >>>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>> --
> > > >>>>>>>> Ben Tupper
> > > >>>>>>>> Bigelow Laboratory for Ocean Science
> > > >>>>>>>> West Boothbay Harbor, Maine
> > > >>>>>>>> http://www.bigelow.org/
> > > >>>>>>>> https://eco.bigelow.org
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>> --
> > > >>>>>> Ben Tupper
> > > >>>>>> Bigelow Laboratory for Ocean Science
> > > >>>>>> West Boothbay Harbor, Maine
> > > >>>>>> http://www.bigelow.org/
> > > >>>>>> https://eco.bigelow.org
> > > >>>>>
> > > >>>>> ______________________________________________
> > > >>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > > >>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > >>>>> and provide commented, minimal, self-contained, reproducible code.
> > > >>>>>
> > > >>>>
> > > >>
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: cannot open file '--no-restore.matrix'

anikaM
Thank you so much this indeed solved my issue!

On Sat, Nov 23, 2019 at 3:05 PM Henrik Bengtsson
<[hidden email]> wrote:

>
> Looking at the https://github.com/eleporcu/TWMR/blob/master/README.txt,
> it looks like you should pass a single argument when you call the MR.R
> script and it should be the name of a gene, e.g. 'ENSG00000154803'.
> You are passing two arguments and they look like filenames.
>
> Update the script, because it should really use commandArgs(TRUE), to:
>
> cmd_args <- commandArgs(TRUE)
> if (length(cmd_args) == 0L) stop("No arguments specified.")
> print(cmd_args)
> gene<-cmd_args[length(cmd_args)]   ## Last argument is the 'gene'
> Ngwas<-239087
> N_eQTLs<-32000
> out<-c("gene","alpha","SE","P","Nsnps","Ngene")
>
> file<-paste(gene,"matrix",sep=".")
> if (!file.exists(file)) stop("File not found: ", file)
> filecluster<-read.table(file,header=T,sep=" ",dec=".")
> ...
>
> The call the script from the command line as:
>
> $ Rscript MR.R ENSG00000154803
>
> That should do it
>
> /Henrik
>
>
> On Sat, Nov 23, 2019 at 12:24 PM Ana Marija <[hidden email]> wrote:
> >
> > it is confusing because in documentation they say this is how you run
> > the script:
> > https://github.com/eleporcu/TWMR
> >
> > I tried changing this on the script:
> >
> > cmd_args=commandArgs(TRUE)
> > print(cmd_args)
> > gene<-cmd_args[3]
> > Ngwas<-239087
> > N_eQTLs<-32000
> > out<-c("gene","alpha","SE","P","Nsnps","Ngene")
> >
> > file<-paste(gene,"matrix",sep=".")
> > if (!file.exists(file)) stop("File not found: ", file)
> > filecluster<-read.table(file,header=T,sep=" ",dec=".")
> > #file<-paste(gene,"matrix",sep=".")
> > #filecluster<-read.table(file,header=T,sep=".",dec=" ")
> > beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])
> >
> > and I run it:
> > Rscript< MR.R --no-save ENSG00000154803.ld ENSG00000154803.matrix
> > Error: unexpected numeric constant in "1.000 0.089"
> > Execution halted
> >
> >
> > I also tried this:
> > Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > Error: File not found: NA.matrix
> > Execution halted
> >
> >
> > Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > Error: File not found: NA.matrix
> > Execution halted
> >
> > On Sat, Nov 23, 2019 at 2:08 PM Henrik Bengtsson
> > <[hidden email]> wrote:
> > >
> > > Maybe it would help to add:
> > >
> > > file<-paste(gene,"matrix",sep=".")
> > > if (!file.exists(file)) stop("File not found: ", file)
> > > filecluster<-read.table(file,header=T,sep=" ",dec=".")
> > >
> > > /Henrik
> > >
> > > On Sat, Nov 23, 2019 at 11:55 AM Duncan Murdoch
> > > <[hidden email]> wrote:
> > > >
> > > > On 23/11/2019 1:21 p.m., Ana Marija wrote:
> > > > > Hi Duncan,
> > > > >
> > > > > thanks, I just did,
> > > > >   Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > > [1] "ENSG00000154803.ld"     "ENSG00000154803.matrix"
> > > > > 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.matrix': No such file or directory
> > > > > Execution halted
> > > > >
> > > > Your script works with the third element in the list of arguments, and
> > > > there are only two.
> > > >
> > > > Duncan Murdoch
> > > >
> > > > >
> > > > > Please advise
> > > > >
> > > > > On Sat, Nov 23, 2019 at 12:13 PM Duncan Murdoch
> > > > > <[hidden email]> wrote:
> > > > >>
> > > > >> On 23/11/2019 11:05 a.m., Ana Marija wrote:
> > > > >>> Hi Ben,
> > > > >>>
> > > > >>> I am not sure what you mean when you say to print, is it this?
> > > > >>>
> > > > >>>> cmd_args=commandArgs(TRUE)
> > > > >>>> print(cmd_args)
> > > > >>> character(0)
> > > > >>>> cmd_args=commandArgs()
> > > > >>>> print(cmd_args)
> > > > >>> [1] "/software/linux-el7-x86_64/compilers/r-3.6.1/lib64/R/bin/exec/R"
> > > > >>>
> > > > >>> I changed in the first line of this script:
> > > > >>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > > > >>>
> > > > >>> cmd_args=commandArgs() to be cmd_args=commandArgs(TRUE)
> > > > >>>
> > > > >>> but again I get the same error:
> > > > >>>
> > > > >>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > >>> 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.matrix': No such file or directory
> > > > >>> Execution halted
> > > > >>
> > > > >> You didn't put the print(cmd_args) into the script.
> > > > >>
> > > > >> Duncan Murdoch
> > > > >>>
> > > > >>>
> > > > >>> Please advise,
> > > > >>> Ana
> > > > >>>
> > > > >>> On Sat, Nov 23, 2019 at 9:44 AM Duncan Murdoch <[hidden email]> wrote:
> > > > >>>>
> > > > >>>> On 23/11/2019 10:26 a.m., Ana Marija wrote:
> > > > >>>>> HI Ben,
> > > > >>>>>
> > > > >>>>> I tried it but it doesn't work:
> > > > >>>>>
> > > > >>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > >>>>> Error in file(file, "rt") : cannot open the connection
> > > > >>>>> Calls: read.table -> file
> > > > >>>>> In addition: Warning message:
> > > > >>>>> In file(file, "rt") :
> > > > >>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > > > >>>>> Execution halted
> > > > >>>>>
> > > > >>>>
> > > > >>>> You should print the cmd_args variable that is set on the first line of
> > > > >>>> that script.  When I run a script that prints it using your command
> > > > >>>> line, this is what it looks like:
> > > > >>>>
> > > > >>>> $ Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > >>>> [1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
> > > > >>>> [2] "--slave"
> > > > >>>> [3] "--no-restore"
> > > > >>>> [4] "--no-save"
> > > > >>>> [5] "--file=MR.R"
> > > > >>>> [6] "--args"
> > > > >>>> [7] "ENSG00000154803.ld"
> > > > >>>> [8] "ENSG00000154803.matrix"
> > > > >>>>
> > > > >>>> The next line
> > > > >>>>
> > > > >>>> gene <- cmd_args[3]
> > > > >>>>
> > > > >>>> is obviously wrong for my system, because it would set gene to
> > > > >>>> "--no-restore".  Your results will probably be somewhat different, but
> > > > >>>> it might be clear what you should use instead of the third element.
> > > > >>>>
> > > > >>>> By the way, changing the first line
> > > > >>>>
> > > > >>>> cmd_args=commandArgs()
> > > > >>>>
> > > > >>>> to
> > > > >>>>
> > > > >>>> cmd_args <- commandArgs(TRUE)
> > > > >>>>
> > > > >>>> makes a lot of sense in most cases.  I haven't read your whole script so
> > > > >>>> I don't know it it makes sense for you.
> > > > >>>>
> > > > >>>> Duncan Murdoch
> > > > >>>>
> > > > >>>>
> > > > >>>>> Please advise,
> > > > >>>>> Ana
> > > > >>>>>
> > > > >>>>> On Sat, Nov 23, 2019 at 4:16 AM Ben Tupper <[hidden email]> wrote:
> > > > >>>>>>
> > > > >>>>>> Hi,
> > > > >>>>>>
> > > > >>>>>> I think you want this order...
> > > > >>>>>>
> > > > >>>>>> Rscript [options for R] script_file.R argument_1 argument_2 ...
> > > > >>>>>>
> > > > >>>>>> So, like this ...
> > > > >>>>>>
> > > > >>>>>> Rscript --no-save MR.R ENSG00000154803.ld ENSG00000154803.matrix
> > > > >>>>>>
> > > > >>>>>> Cheers,
> > > > >>>>>> Ben
> > > > >>>>>>
> > > > >>>>>> On Fri, Nov 22, 2019 at 8:59 PM Ana Marija <[hidden email]> wrote:
> > > > >>>>>>>
> > > > >>>>>>> HI Ben,
> > > > >>>>>>>
> > > > >>>>>>> thank you so much , I did this:
> > > > >>>>>>>
> > > > >>>>>>> Rscript --no-save ENSG00000154803.ld ENSG00000154803.matrix  MR.R
> > > > >>>>>>> Error: unexpected numeric constant in "1.000 0.089"
> > > > >>>>>>> Execution halted
> > > > >>>>>>>
> > > > >>>>>>> I made ENSG00000154803.ld with:
> > > > >>>>>>> library(MASS)
> > > > >>>>>>> write.matrix(ENSG00000154803.ld, file="ENSG00000154803.ld")
> > > > >>>>>>>
> > > > >>>>>>> and it looks like this:
> > > > >>>>>>>
> > > > >>>>>>> 1.000 0.089 0.006 0.038 0.012 0.014 0.003 0.001 0.005 0.015 0.013
> > > > >>>>>>> 0.000 0.000 0.000 0.001 0.003 0.000
> > > > >>>>>>> 0.089 1.000 0.002 0.007 0.005 0.001 0.004 0.005 0.000 0.003 0.014
> > > > >>>>>>> 0.001 0.012 0.005 0.000 0.004 0.004
> > > > >>>>>>> 0.006 0.002 1.000 0.004 0.008 0.029 0.040 0.001 0.001 0.006 0.013
> > > > >>>>>>> 0.054 0.006 0.002 0.010 0.001 0.000
> > > > >>>>>>> 0.038 0.007 0.004 1.000 0.460 0.044 0.008 0.022 0.010 0.229 0.095
> > > > >>>>>>> 0.066 0.010 0.030 0.001 0.003 0.000
> > > > >>>>>>> 0.012 0.005 0.008 0.460 1.000 0.151 0.018 0.047 0.021 0.272 0.185
> > > > >>>>>>> 0.002 0.003 0.066 0.006 0.004 0.004
> > > > >>>>>>> 0.014 0.001 0.029 0.044 0.151 1.000 0.007 0.018 0.218 0.010 0.023
> > > > >>>>>>> 0.016 0.000 0.025 0.000 0.005 0.000
> > > > >>>>>>> 0.003 0.004 0.040 0.008 0.018 0.007 1.000 0.003 0.002 0.020 0.031
> > > > >>>>>>> 0.128 0.019 0.005 0.030 0.002 0.016
> > > > >>>>>>> 0.001 0.005 0.001 0.022 0.047 0.018 0.003 1.000 0.004 0.014 0.004
> > > > >>>>>>> 0.098 0.010 0.012 0.001 0.006 0.003
> > > > >>>>>>> 0.005 0.000 0.001 0.010 0.021 0.218 0.002 0.004 1.000 0.004 0.000
> > > > >>>>>>> 0.012 0.000 0.006 0.018 0.004 0.013
> > > > >>>>>>> 0.015 0.003 0.006 0.229 0.272 0.010 0.020 0.014 0.004 1.000 0.466
> > > > >>>>>>> 0.001 0.091 0.057 0.062 0.002 0.005
> > > > >>>>>>> 0.013 0.014 0.013 0.095 0.185 0.023 0.031 0.004 0.000 0.466 1.000
> > > > >>>>>>> 0.238 0.180 0.073 0.058 0.000 0.006
> > > > >>>>>>> 0.000 0.001 0.054 0.066 0.002 0.016 0.128 0.098 0.012 0.001 0.238
> > > > >>>>>>> 1.000 0.158 0.006 0.044 0.006 0.001
> > > > >>>>>>> 0.000 0.012 0.006 0.010 0.003 0.000 0.019 0.010 0.000 0.091 0.180
> > > > >>>>>>> 0.158 1.000 0.077 0.237 0.009 0.000
> > > > >>>>>>> 0.000 0.005 0.002 0.030 0.066 0.025 0.005 0.012 0.006 0.057 0.073
> > > > >>>>>>> 0.006 0.077 1.000 0.056 0.000 0.004
> > > > >>>>>>> 0.001 0.000 0.010 0.001 0.006 0.000 0.030 0.001 0.018 0.062 0.058
> > > > >>>>>>> 0.044 0.237 0.056 1.000 0.000 0.003
> > > > >>>>>>> 0.003 0.004 0.001 0.003 0.004 0.005 0.002 0.006 0.004 0.002 0.000
> > > > >>>>>>> 0.006 0.009 0.000 0.000 1.000 0.002
> > > > >>>>>>> 0.000 0.004 0.000 0.000 0.004 0.000 0.016 0.003 0.013 0.005 0.006
> > > > >>>>>>> 0.001 0.000 0.004 0.003 0.002 1.000
> > > > >>>>>>>
> > > > >>>>>>> the other file (ENSG00000154803.matrix) looks like this:
> > > > >>>>>>>
> > > > >>>>>>> GENES ENSG00000154803 BETA_GWAS
> > > > >>>>>>> rs12601631 -0.320577 -0.0160778
> > > > >>>>>>> rs1708623 0.708706 0.0717719
> > > > >>>>>>> rs1708628 -0.645996 -0.0973019
> > > > >>>>>>> rs17804843 -0.78984 0.0059607
> > > > >>>>>>> rs4078062 -0.340732 -0.0716837
> > > > >>>>>>> rs4316813 -0.721137 -0.00502219
> > > > >>>>>>> rs7217764 -0.61641 0.16997
> > > > >>>>>>> rs7221842 -0.377727 -0.00184011
> > > > >>>>>>> rs12602831 -0.397059 0.0154625
> > > > >>>>>>> rs138437542 -0.590669 0.0145733
> > > > >>>>>>> rs2174369 -0.167913 -0.0268728
> > > > >>>>>>> rs242252 0.20184 0.0161709
> > > > >>>>>>> rs34121330 0.328602 0.0753894
> > > > >>>>>>> rs4792798 -0.303601 0.00227314
> > > > >>>>>>> rs7222311 -0.367686 -0.0419168
> > > > >>>>>>> rs74369938 0.687555 -0.223105
> > > > >>>>>>> rs8075751 -0.261916 -0.0313484
> > > > >>>>>>>
> > > > >>>>>>> On Fri, Nov 22, 2019 at 7:44 PM Ben Tupper <[hidden email]> wrote:
> > > > >>>>>>>>
> > > > >>>>>>>> Hi,
> > > > >>>>>>>>
> > > > >>>>>>>> You might check the order of your arguments.   Options come before the
> > > > >>>>>>>> script filename. See the details here...
> > > > >>>>>>>>
> > > > >>>>>>>> https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/Rscript
> > > > >>>>>>>>
> > > > >>>>>>>> Ben
> > > > >>>>>>>>
> > > > >>>>>>>> On Fri, Nov 22, 2019 at 8:17 PM Ana Marija <[hidden email]> wrote:
> > > > >>>>>>>>>
> > > > >>>>>>>>> Hello,
> > > > >>>>>>>>>
> > > > >>>>>>>>> I am trying to run this code:
> > > > >>>>>>>>> https://github.com/eleporcu/TWMR/blob/master/MR.R
> > > > >>>>>>>>>
> > > > >>>>>>>>> with r-3.6.1
> > > > >>>>>>>>>
> > > > >>>>>>>>> via:
> > > > >>>>>>>>>
> > > > >>>>>>>>> Rscript MR.R --no-save ENSG00000154803
> > > > >>>>>>>>>
> > > > >>>>>>>>> in the current directory I have saved: ENSG00000154803.ld and
> > > > >>>>>>>>> ENSG00000154803.matrix as the software requires
> > > > >>>>>>>>>
> > > > >>>>>>>>> but I am getting this error:
> > > > >>>>>>>>>
> > > > >>>>>>>>> Error in file(file, "rt") : cannot open the connection
> > > > >>>>>>>>> Calls: read.table -> file
> > > > >>>>>>>>> In addition: Warning message:
> > > > >>>>>>>>> In file(file, "rt") :
> > > > >>>>>>>>>      cannot open file '--no-restore.matrix': No such file or directory
> > > > >>>>>>>>> Execution halted
> > > > >>>>>>>>>
> > > > >>>>>>>>>
> > > > >>>>>>>>> Please advise,
> > > > >>>>>>>>>
> > > > >>>>>>>>> Thanks
> > > > >>>>>>>>> Ana
> > > > >>>>>>>>>
> > > > >>>>>>>>> ______________________________________________
> > > > >>>>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > > >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > > > >>>>>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > > >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.
> > > > >>>>>>>>
> > > > >>>>>>>>
> > > > >>>>>>>>
> > > > >>>>>>>> --
> > > > >>>>>>>> Ben Tupper
> > > > >>>>>>>> Bigelow Laboratory for Ocean Science
> > > > >>>>>>>> West Boothbay Harbor, Maine
> > > > >>>>>>>> http://www.bigelow.org/
> > > > >>>>>>>> https://eco.bigelow.org
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>>
> > > > >>>>>> --
> > > > >>>>>> Ben Tupper
> > > > >>>>>> Bigelow Laboratory for Ocean Science
> > > > >>>>>> West Boothbay Harbor, Maine
> > > > >>>>>> http://www.bigelow.org/
> > > > >>>>>> https://eco.bigelow.org
> > > > >>>>>
> > > > >>>>> ______________________________________________
> > > > >>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > > >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> > > > >>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > > >>>>> and provide commented, minimal, self-contained, reproducible code.
> > > > >>>>>
> > > > >>>>
> > > > >>
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.