Snakemake:执行R脚本时忽略Rprofile

时间:2018-09-17 09:15:30

标签: r snakemake

在我的snakemake工作流程中执行R脚本时遇到一些问题。似乎我的个人.Rprofile文件已加载到R脚本中。该作业在单个容器中运行,问题是我自动在我的R配置文件中加载了一些未安装在容器中的软件包。我当然可以通过编辑R配置文件来解决此问题,但是其他每个想要使用管道的人都必须做同样的事情,这是我不喜欢的。有人知道如何解决这个问题吗?

谢谢!

2 个答案:

答案 0 :(得分:2)

您会发现import {Router, ActivatedRoute, Params} from '@angular/router'; import {OnInit, Component} from '@angular/core'; @Component({...}) export class MyComponent implements OnInit { queryParamsStatus =''; constructor(private activatedRoute: ActivatedRoute) {} ngOnInit() { // subscribe to router event this.activatedRoute.params.subscribe((params: Params) => { this.queryParamsStatus= params['status']; console.log(queryParamsStatus ); }); let tempRows = this.rows.filter(s => s.staus === this.queryParamsStatus); } }

Rscript

$ Rscript Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] --options accepted are --no-environ Don't read the site and user environment files --no-site-file Don't read the site-wide Rprofile --no-init-file Don't read the user R profile --vanilla Combine --no-save, --no-restore, --no-site-file --no-init-file and --no-environ 有一些选项可以帮助您:

R

(为简洁起见,省略了其他选项)

答案 1 :(得分:1)

正如@hrbrmstr所建议的那样,#include<iostream> using namespace std; int main() { int marks[5], i; float sum=0,avg; cout<<"\n Enter Marks of Student \n"; cout<<"------------------------------------"; cout<<"\n Quizzes : "; cin>>marks[0]; cout<<"\n Labwork : "; cin>>marks[1]; cout<<"\n Midterm : "; cin>>marks[2]; cout<<"\n Final : "; cin>>marks[3]; cout<<"\n Participation : "; cin>>marks[4]; for(i=0;i<5;i++) { sum=sum+marks[i]; } cout<<"------------------------------------"; cout<<"\n Total Marks of Student = "<<sum; cout<<"\n Grade = "; if(sum>80) { cout<<"A"; } else if(sum>60 && sum<=80) { cout<<"B"; } else if(sum>40 && sum<=60) { cout<<"C"; } else { cout<<"D"; } return 0; } 是我要使用的参数。但是,我仍然找不到在将R脚本作为脚本运行的同时在snakemake中传递此参数的方法(其优点是可以在R环境中使用所有snakemake参数)。相反,我去了源代码并编辑了script.py文件--vanilla

来自

.../lib/python3.6/site-packages/snakemake/script.py

shell("Rscript {f.name}", bench_record=bench_record)

现在可以使用。

干杯!