通过 url 访问服务器数据

通过 url 访问服务器数据

在使用 IGV 或者 UCSC track hub 可视化时,往往需要将数据放置在本地,但考虑到生信数据往往直接放置在服务器上,且文件大小可能高达几GB,此时可以将数据存放到可以接受外部访问的服务器上,然后通过 url 上传数据完成可视化,此处推荐的工具为 CyVerse(https://de.cyverse.org/dashboard)。

CyVerse 可以直接网页上传文件,或者通过软件来将数据传入和传出 Data Store。

参考文档:https://learning.cyverse.org/ds/gocommands/

官网:https://github.com/cyverse/gocommands

(一)网页上传

CyVerse 网站注册登录后可直接通过如下网页操作完成本地文件的上传,如果文件上传失败可能需要重新上传。

image-20240906124708371

(二)服务器上传

CyVerse 可以通过软件来将数据传入和传出 Data Store,建议 Mac 和 Windows 用户使用 Cyberduck,Linux 用户使用 iCommands 或 GoCommands,但由于 iCommands 的安装需要有 root 或者 sudo 权限,此处选择了使用 GoCommands。

1. 安装 GoCommands

(1)安装
  • 方式一:使用 conda 安装(推荐)
conda create -n gocommands
conda activate gocommands
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install gocommands
  • 方式二:使用源码安装,具体可参考官网
(2)配置(iCommands)

此处使用的是 iCommands 的配置,也可以使用 YAML 配置文件或直接设置环境变量,具体可参考官网。

# 创建 iCommands 的配置文件,如果已有可以不用此步骤
gocmd init

image-20240906113058146

# 检查载入的配置文件
gocmd env
gocmd ls

image-20240906113331526

2. 使用

(1)上传本地文件到 Data Store
gocmd put /local_directory /iplant/home/cyverse_username/destination_folder

注意:当将数据上传到数据存储时,不应上传名称中包含空格或特殊字符(如 ~''!@#$%^&*( )+={}[]|:;"'<>,?/\)的文件;对于较长的文件/文件夹名称,建议使用下划线而不是空格。

参数说明

gocmd put -R # for specifying resource server
gocmd put --progress # to display the progress of the upload
gocmd put -f # to force the upload and overwrite
gocmd put --encrypt file1.txt # file encryption
(2)下载 Data Store 文件到本地
gocmd get /iplant/home/cyverse_username/target_file /local_destination

参数说明

gocmd get -R # for specifying resource server
gocmd get --progress # to display the progress of the download
gocmd get -f # to force the download and overwrite

3. 更新

GoCommands 可以自行升级,运行命令以升级到可用的最新版本的 GoCommands

gocmd upgrade # check a new release and upgrade the gocmd binary
/gocmd upgrade --check # just check a new release and display 

(三)外部访问权限

通过网页界面点击 public link(s) 授予文件可被外部访问权限,此处不能直接赋予文件夹可访问权限,通过复制 public link(s) 即可以外部访问该文件,可以通过直接上传该 url 至 IGV 或 UCSC track hub 完成可视化。

image-20240906125036583

补充 1:galaxy

对于比较小如几 mb 的文件可以直接本地上传 track,但 bigwig 文件往往几百 mb,此时也可以上传至 Galaxy(https://usegalaxy.org/),可以暂时存储数据,但过段时间可能会失效。

注册登录完成后可根据如下网页操作完成本地数据上传。

image-20240906131130934

image-20240906131230787

补充 2:通过 url 查看服务器的文件

URL,统一资源定位器,指向互联网上的“资源”,可协议名、主机、端口和资源组成
如: http://username:password@host:8080/directory/file?query#ref

ComponentExample valueAlso known as
ProtocolhttpScheme
Authorityusername:password@host:8080
User Infousername:password
Hosthost
Port8080
File/directory/file?query
Path/directory/file
Queryquery
Refreffragment

此处提出了一种方法可以直接在浏览器中输入 url 网址查看服务器上较小的文件,如 .txt 或者 .pdf 文件。

# 示例,此处的 files 对应登录后的目录,
http://username:password@host:8080/files/path/to/file.txt

参考

  1. Transferring Data with GoCommands and Command Line - CyVerse Learning Home:https://learning.cyverse.org/ds/gocommands/#run-gocommands-using-a-yaml-configuration-file
  2. cyverse/gocommands: iRODS Command-line Tools written in Go (github.com):https://github.com/cyverse/gocommands
  3. 生信小白之路02-bw/bed等文件导入UCSC查看track:https://zhuanlan.zhihu.com/p/618938328
  4. 访问带有用户名、密码保护的 URL_客户端请求的 url 带有 user username pass、 password、sesion、jse-优快云 博客:https://blog.youkuaiyun.com/u010439291/article/details/46336527
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值