Some fasta files contain all chromosomes from one genome,sometimes users have to split these chromosomes into different files according to their number label.The msqchr can help to handle this, so that the specific chromosome fasta file can be used for downstream analysis.
Replace tedious chromosome identifier into simple format. So that the subtracted ids are easy to manipulate.
Subtract chromosome ids from a fasta file
Transform the large character object into special list:
fil <- tempfile(fileext = ".data")
write(text,file = fil)
con0 <- file(fil, "r")
tex <- readToList(id,text = text,con = con0)
Sort the chromosome list according to their number. Note: the “single” and “double” chromosome should be sort separately. Note: This data is already sorted, this is just for expository purposes.
tex2<- sortList(id=id,tex = tex,chrsig = "single")
tex3 <- sortList(id=id,tex = tex,chrsig = "double")
Now we can split the chromosome fasta file into different files according to their number.