ixxmu / mp_duty

抓取网络文章到github issues保存

Home Page:https://archives.duty-machine.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

snakemake的初步尝试

ixxmu opened this issue · comments

snakemake的初步尝试 by 东林的扯淡小屋

conda config --set channel_priority flexible#https://github.com/rapidsai/cuml/issues/4016
conda install -c conda-forge mambamamba create -c conda-forge -c bioconda -n snakemake snakemakeconda activate snakemakesnakemake --help

strings /usr/lib/x86_64-linux-gnu//libstdc++.so.6 | grep CXXABIll /usr/lib/x86_64-linux-gnu//libstdc++.so.6sudo find / -name "libstdc++.so.*"
sudo cp /data/yudonglin/software/HiC-Pro-master/hic/lib/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/
cd /usr/lib/x86_64-linux-gnusudo rm libstdc++.so.6sudo ln -s libstdc++.so.6.0.30 libstdc++.so.6strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep CXXABI#参考资料:https://blog.csdn.net/wenroudebaozi/article/details/107564647

终于成功安装!


初步尝试:

#首先我们建立两个文件echo "Here is hello." > hello.txtecho "Here is world." > world.txt
vi Snakefile#接下来开始编写我们的Snakefilerule concat: # 这里的rule可视为snakemake定义的关键字,concat使我们自定义的这一步任务的名称 input: # input同样是snakemake的关键字,定义了在这个任务中的输入文件 expand("{file}.txt", file=["hello", "world"]) #expand是一个snakemake定义的替换命令 output: # output也是snakemake的关键字,定义输出结果的保存文件 "merged.txt" shell: # 这里表示我们下面的命令将在命令行中执行 "cat {input} > {output}"
#最后就可以在Snakefile的路径执行snakemake命令即可#https://www.jianshu.com/p/14b9eccc0c0esnakemake --cores 20cat merge.txt


代码文件命名最好为Snakefile, snakefile, workflow/Snakefile, workflow/snakefile。

snakemake的第一步实战就是修改文件的名字,如果直接就是fq.gz,就不用改,如果是fastq.gz就改为fq.gz。

# -*- coding: utf-8 -*-"""Created on Thu Jan  5 15:57:26 2023
@author: yudonglin"""

#统一输入的文件是fq.gz格式new_fq = [ "data/HA-Vector-1_L3_1.fq.gz", "data/HA-Vector-1_L3_2.fq.gz", "data/HA-Vector-2_L3_1.fq.gz", "data/HA-Vector-2_L3_2.fq.gz"]
rule all: input: new_fqrule change_suffix: input: "rawdata/{sample}.fastq.gz" output: "data/{sample}.fq.gz" shell: "cp {input} {output}"

很复杂,也可以用shell来写:

for i in $(ls data/*.fastq.gz);do cp $i data/$(basename $i fastq.gz)fq.gz; done



参考资料:

https://snakemake.readthedocs.io/en/stable/getting_started/installation.html


https://cloud.tencent.com/developer/article/2032005