备用帖子1Shell(Shell R语言)

shell==========================

ls -lrt ### list fils by date (sort by date)

echo 1 > /proc/sys/vm/drop_caches 清理内存 free -m

du -h --max-depth=1  folder

How to move all files and folders via mv command [duplicate]
mv /path/sourcefolder/* /path/destinationfolder/

cp -r /path/to/directory /path/to/location/new-name

awk '$0 ~ ">hsa" { print $0; getline str; print str; } ' 20150417.fa

只取文件名:

ll *tsv | sed 's/.*://g' | sed 's/.* //g'

R: letters[1:26]

echo -en "\007" #beep
echo "echo -en '\007'" >> t.sh

=CHAR(96+ROW())

 xxx.sh >00.logs 2>&1  &

join -a 1 file1 file2 > mergedfile

#sort the bam files by name
for f in *.bam; do samtools sort -n "f""{f%.*}".sorted; done
#convert bam to sam
for f in *sorted.bam; do samtools view "f">"{f%.*}".sam; done
#convert sam to read counts
for f in *.sam; do python -m HTSeq.scripts.count "f"Musmusculus.GRCm38.75.gtf>"{f%.*}".readcount.txt ; done

split -l 2000 seq_2  -d -a 2  split_  按行拆分文件

sed '1i "geneid"' filename 插入一行内容在第一行

sed -i '1iabc' urfile  插入一行内容在第一行

-S <作业名称>  指定screen作业的名称。

 grep -A 1  'EN03347'   ripts.fa 输出匹配的行及其下一行
# screen -X quit  退出screen

# awk '{if(length(3)>30)print0}' urfile

awk分割信息后获取最后一列 cat $(ll /home/sdzw/tcf/20110914_001/|awk '{print $NF}')|grep "abc"

 echo "Cfoo'barxml" | sed "s/'/::/g" |  sed 's/::/\\:/g' |  sed "s/:/'/g"    替换单引号为 \'

rpm -qa | grep mysql  // 这个命令就会查看该操作系统上是否已经安装了mysql数据库

grep -n 'key' file  显示行号

sed -n '1,5p' file

exit 0; 成功,退出脚本;

exit 1; 失败,退出脚本;

dos2unix filename 用:set ff=unix把它强制为unix格式   
sed -n '100,200p' mysql_slow_query.log 只查看文件的第100行到第200行

awk '7=="."print$0merged.gtfawk7!="." {print $0}' merged.gtf

find ./ -name '*extractfastabyid*' -print

grep -wq "Run complete" ERR266361.err && echo "SRR000000 tophat 运行正常; "  || echo "SRR000000  tophat 运行错误; "


nohup command > myout.file 2>myerr &  使用 jobs 查看任务。使用 fg %n 关闭。

ps aux | grep pbs
pkill "pbs_*"
pbs_server
pbs_sched
pbs_mom
pbsnodes -a
echo 'sleep 20' | qsub
qmgr -c 'print server'
cat /var/spool/torque/server_name

 grep 'exon_number \"1\"' /filename | wc

grep -v 'ENS4810'   file   不包含ENS4810 的行

sed -e 's/abc//g' file

:set list    进入List Mode;:set nolist    退出List Mode

awk 'NR==FNR{a[FNR]=$0} NR>FNR{for(i in a)if($0~a[i]){print;getline;print}}' Aid Bfilt >Cnew

 

 

R==========================

do.call('rbind',strsplit( as.character(one$tr) ,split='_'))

     b1=paste(triples[,1],triples[,2],triples[,3],sep='_')     

expr[exprcelltype=="hesc",]expr[exprcell_type %in% c("hesc","bj fibroblast"),]
subset(expr, cell_type =="hesc")
subset(expr, cell_type %in% c("bj fibroblast","hesc"))

data(mtcars)
mtcars[mtcars[, "mpg"]>25, ]
mtcars[mtcarsmpg>25, ] subset(mtcars, mpg>25) colnames(data)[2] <- 'column 2' colnames(data) <- c( 'col 1', 'col 2', 'col 3')  install.packages("ggplot2")  sample()函数可以用于在特定群体中,随机 选取特定数目的个体。即随机抽样。  sample(x, size, replace = FALSE, prob = NULL) replace=F,表示不重复抽样 replace=T 表示可以重复抽样  R:fileConn<-file(pbs_file_name) writeLines(str, fileConn) close(fileConn)  R:x=c("aa","bb","cc")  for (i in 1:length(x)) {    str=x[i]    cat(str) }  subset(dataset, gender=="M" | age < 50) DF.new <- subset(DF, (gender == "female") & (age > 50)) May be this help you; Just intall.packages("sqldf", dependencies=T) require(sqldf) my_df<-data.frame(cbind(gender=sample(c("male","female"),50,replace=T), age=round(rnorm(50, mean=30, sd=5),0))) my_df_subset_male<-sqldf("select * from my_df where gender=='male'") my_df_subset_male_greater35<-sqldf("select * from my_df where gender=='male' and age>35") df[,c('sequence','start','end')] df[grep("trna", dfcommon_name, ignore.case=T),]
a[rownames(a)=='a',]
http://code.google.com/p/sqldf/
filter<-fpkmgeneidid
df.new<-fpkm[filter,]

dev.new(width=5, height=4)  #窗口大小尺寸
 
http://www.cnblogs.com/emanlee/p/3332493.html
 
posted @   emanlee  阅读(1392)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
历史上的今天:
2011-12-17 rank sum test 秩和检验
2010-12-17 第2章-范围计划.pdf
2010-12-17 第1章-项目初始.pdf
2010-12-17 第0章-项目管理概述.pdf
2010-12-17 软件开发过程(CMMI/RUP/XP/MSF)是与非
2009-12-17 五个优秀的硬盘健康检测工具
点击右上角即可分享
微信分享提示