Created
February 18, 2016 09:00
-
-
Save idot/0be1b35f8db553dd85f9 to your computer and use it in GitHub Desktop.
converts chromosome names from Tair10 from ngsplot to numeric names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
#copy .metainfo and .chrnames.endsembl from orig tar.gz in subfolder and change | |
# chrnames, ID | |
#tar with tar -zcvf Tair10numeric.tar.gz Tair10numeric | |
convertRdata <- function(){ | |
id <- "Tair10numeric" | |
dir.create(id, recursive=TRUE, show=FALSE ) | |
dts <- dir(".", ".RData", full=TRUE) | |
for(d in dts){ | |
print(d) | |
tableName <- load(d) | |
if(length(tableName) != 1){ | |
stop("object has unexpected name or multiple tables loaded ", tableName) | |
} | |
df <- get(tableName) | |
df$chrom <- gsub("chr", "", df$chrom) | |
bn <- basename(d) | |
dt <- sub(".+?(\\..*)", "\\1", d) | |
iddt <- paste(id, dt, sep="") | |
outp <- paste(id,"/", iddt, sep="") | |
print(tableName) | |
print(length(df)) | |
save(df, list=tableName, file=outp) | |
} | |
} | |
convertRdata() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment