comparison rmsk_summary_table_multiple.r @ 14:62fefa284036 draft

Uploaded
author petr-novak
date Fri, 07 Feb 2020 06:06:47 -0500
parents a4cd8608ef6b
children
comparison
equal deleted inserted replaced
13:f12eb3896842 14:62fefa284036
1 #! /usr/bin/env Rscript 1 #! /usr/bin/env Rscript
2 # repeat masker summary 2 # repeat masker summary
3 # analysis of *.out file 3 # analysis of *.out file
4 # input arguments: <rmsk_result.out> <reads.fas. 4 # input arguments: <rmsk_result.out> <reads.fas.
5 # calculates totoal proportion of matched repetetive families and averagee score and print the table 5 # calculates totoal proportion of matched repetetive families and averagee score and print the table
6 suppressPackageStartupMessages(library(getopt))
7 6
8 # INPUT ARGUMENTS: 7 opt = list()
9 opt = getopt(matrix(c( 8 opt$fasta = commandArgs(T)[1]
10 'fasta', 'f', 1, "character", 9 opt$repeat_masker = commandArgs(T)[2]
11 'repeat_masker','r', 1, "character", 10 opt$output = commandArgs(T)[3]
12 'output', 'o', 1, "character",
13 'help','h',0,'logical'),ncol=4,byrow=T))
14 11
15 if (!is.null(opt$help)) {
16 cat("Usage:\n\n -f fasta file \n -r repeat masker output\n -o output files\n")
17 stop()
18 }
19 12
20 RMfiles=system(paste("ls ",opt$repeat_masker,sep=""),intern=T) 13 RMfiles=system(paste("ls ",opt$repeat_masker,sep=""),intern=T)
21 fasta=system(paste("ls ",opt$fasta,sep=""),intern=T) 14 fasta=system(paste("ls ",opt$fasta,sep=""),intern=T)
22 15
23 16
24 17
25 getsubdir=function(x){ 18 getsubdir=function(x){
26 xx=gsub(".*/","",x) 19 xx=gsub(".*/","",x)
27 sdir=gsub(xx,"",x,fixed=T) 20 sdir=gsub(xx,"",x,fixed=T)
28 sdir 21 sdir
29 } 22 }
30 23
31 fasta.summary=function(reads){ 24 fasta.summary=function(reads){
32 suppressPackageStartupMessages(library(Biostrings,quiet=T)) 25 suppressPackageStartupMessages(library(Biostrings,quiet=T))