Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
frattalab
helpful_scripts
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
helpful_scripts
/
create_te_count_table.R
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
26 lines (25 loc) · 1.47 KB
master
Breadcrumbs
helpful_scripts
/
create_te_count_table.R
Copy path
Top
File metadata and controls
Code
Blame
26 lines (25 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# reads in a folder with TE counts from the Hammel TETranscripts tools
create_te_count_table = function(feature_count_folder, suffix = ".Aligned.sorted.out.bam",prefix = ""){
library(data.table)
# feature counts gives you feature coutns and summariues, given a folder name get a list of files that don't contain
# the word summary
feature_count_files = grep(list.files(path=feature_count_folder,full.names = TRUE), pattern='summary', inv=T, value=T)
# from the list, read them all
l <- lapply(feature_count_files, fread)
# make it into a data table
wide_feature_counts = setDT(unlist(l, recursive = FALSE), check.names = TRUE)[]
# there's only a few columns we really want from this table it's going to be
# Geneid and the things that labeled by their file name so we do two things
# first when we do this setDT unlist thing names become X.path.to. so we'lre gooing to take the feature counts files and replace the / with .
selector_list = c("gene.TE",names(wide_feature_counts)[grepl("^X",names(wide_feature_counts))])
# take only those columns
wide_feature_counts = wide_feature_counts[,.SD, .SDcols = selector_list]
# ----remove unnecessary information from the column names
if(suffix != ""){
colnames(wide_feature_counts) = gsub(suffix,"",colnames(wide_feature_counts))
}
if(prefix != ""){
colnames(wide_feature_counts) = gsub(prefix,"",colnames(wide_feature_counts))
}
return(wide_feature_counts)
}
You can’t perform that action at this time.