This function will write contact matrixes into short with score format.

writeJuicer(contactMatrixsList, pairs = NULL, file, overwrite = TRUE)

Arguments

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 contactMatrixList is a list, with name, this argument can be NULL. If contactMatrixList is a matrix, it must has pair which format "A_B".

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.

Value

write a file into disk

Details

The short with score format contains 9 columns.

  1. str1 = strand (0 for forward, anything else for reverse)

  2. chr1 = the first chromosome (must be a chromosome in the genome)

  3. pos1 = the first position

  4. frag1 = restriction site fragment

  5. str2 = strand (0 for forward, anything else for reverse)

  6. chr2 = the second chromosome (must be a chromosome in the genome)

  7. pos2 = the second position

  8. frag2 = restriction site fragment

  9. 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.

Examples

# 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)