This function will write contact matrixes into short with score format.
writeJuicer(contactMatrixsList, pairs = NULL, file, overwrite = TRUE)
contactMatrixsList | A list contains all the contact matrix or a single matrix. The list name should be pair as form '1_1' or '1_2' |
---|---|
pairs | Which pairs of the chromosomes. If |
file | File name to store the contact matrix |
overwrite | If file exists, whether overwrite the file or append file. If TRUE, the function will remove the file and re-write it. If FALSE, function will append the result to the existing file. |
write a file into disk
The short with score format contains 9 columns.
str1 = strand (0 for forward, anything else for reverse)
chr1 = the first chromosome (must be a chromosome in the genome)
pos1 = the first position
frag1 = restriction site fragment
str2 = strand (0 for forward, anything else for reverse)
chr2 = the second chromosome (must be a chromosome in the genome)
pos2 = the second position
frag2 = restriction site fragment
score = the score imputed to this read
If not using the restriction site file option readJuicerFragmentSites
, both frag1 and frag2 will be ignored. By default, the function gives them 0.
java -jar juicer_tool.jar -r 5000 -n <infile> <outfile> <genomeID>
If <genomeID>
not in the list of hg18, hg19, hg38, dMel, mm9, mm10,
anasPlat1, bTaurus3, canFam3, equCab2, galGal4, Pf3D7, sacCer3, sCerS288c, susScr3, or TAIR10.
You must provide a chrom.sizes file path that lists on each line the name and size of the chromosomes.
Use readJuicerInformation
with the given hic file, you can extract the chromosome size.
The resulting list contains a list chromosomeSizes
.
# From existing object library(FreeHiCLite) ## Local file location localFilePath = system.file('extdata', 'example.hic', package = 'FreeHiCLite') ## Pairs needs to be extracted pairs = c('1_1', '1_2') unit = 'BP' resolution = 500000L ## pass chrosomes into function, it will contains all the interaction pairs dat <- readJuicer(file=localFilePath, chromosomes=NULL, pairs = pairs, unit=unit, resolution=resolution) contactMatrixsList <- dat[['contact']] .old_wd <- setwd(tempdir()) writeJuicer(contactMatrixsList, file = 'test.txt') setwd(.old_wd)