Mercurial > repos > mingchen0919 > rmarkdown_feature_counts
comparison rmarkdown_feature_counts.Rmd @ 0:5af86972b408 draft
planemo upload
author | mingchen0919 |
---|---|
date | Fri, 29 Dec 2017 15:03:18 -0500 |
parents | |
children | a7f7e8a58a82 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5af86972b408 |
---|---|
1 --- | |
2 title: 'Feature Counts' | |
3 output: | |
4 html_document: | |
5 number_sections: true | |
6 toc: true | |
7 theme: cosmo | |
8 highlight: tango | |
9 --- | |
10 | |
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} | |
12 knitr::opts_chunk$set( | |
13 echo = opt$echo, | |
14 error = TRUE | |
15 ) | |
16 ``` | |
17 | |
18 | |
19 # User input | |
20 | |
21 ```{r 'user input'} | |
22 opt | |
23 ``` | |
24 | |
25 # Calculate feature counts | |
26 | |
27 ```{r 'ste[ 2'} | |
28 res = featureCounts( | |
29 files = strsplit(opt$input_bam_paths, ',')[[1]], | |
30 # annotation | |
31 annot.inbuilt=opt$annot_inbuilt, | |
32 annot.ext=opt$annot_ext, | |
33 isGTFAnnotationFile=opt$isGTFAnnotationFile, | |
34 GTF.featureType=opt$gtf_feature_type, | |
35 GTF.attrType=opt$gtf_attr_type, | |
36 chrAliases=opt$chr_aliases, | |
37 | |
38 # level of summarization | |
39 useMetaFeatures=opt$use_meta_features, | |
40 | |
41 # overlap between reads and features | |
42 allowMultiOverlap=opt$allow_multi_overlap, | |
43 minOverlap=opt$min_overlap, | |
44 largestOverlap=opt$largest_overlap, | |
45 readExtension5=opt$read_extension_5, | |
46 readExtension3=opt$read_extension_3, | |
47 read2pos=opt$read_2_pos, | |
48 | |
49 # multi-mapping reads | |
50 countMultiMappingReads=opt$count_multi_mapping_reads, | |
51 fraction=opt$fraction, | |
52 | |
53 # read filtering | |
54 minMQS=opt$min_mqs, | |
55 splitOnly=opt$split_only, | |
56 nonSplitOnly=opt$non_split_only, | |
57 primaryOnly=opt$primary_only, | |
58 ignoreDup=opt$ignore_dup, | |
59 | |
60 # strandness | |
61 strandSpecific=opt$strand_specific, | |
62 | |
63 # exon-exon junctions | |
64 juncCounts=opt$junc_counts, | |
65 genome=opt$genome, | |
66 | |
67 # parameters specific to paired end reads | |
68 isPairedEnd=opt$is_paired_end, | |
69 requireBothEndsMapped=opt$require_both_ends_mapped, | |
70 checkFragLength=opt$check_frag_length, | |
71 minFragLength=opt$min_frag_length, | |
72 maxFragLength=opt$max_frag_length, | |
73 countChimericFragments=opt$count_chimeric_fragments, | |
74 autosort=opt$auto_sort, | |
75 | |
76 # miscellaneous | |
77 nthreads=opt$n_threads, | |
78 maxMOp=opt$max_mop, | |
79 reportReads=opt$report_reads | |
80 ) | |
81 ``` | |
82 | |
83 # Write counts into CSV file | |
84 | |
85 ```{r} | |
86 colnames(res$counts) = strsplit(opt$input_bam_names, ',')[[1]] | |
87 # write count into csv file | |
88 write.table(res$counts, file = 'feature_counts.txt') | |
89 ``` | |
90 | |
91 Display the first 100 rows. | |
92 | |
93 ```{r} | |
94 datatable(head(res$counts, 100)) | |
95 ``` | |
96 | |
97 # Save results into RData file | |
98 | |
99 ```{r} | |
100 save(res, file = 'feature_counts.RData') | |
101 str(res) | |
102 ``` | |
103 | |
104 |