Re: [theaidenlab/juicer] Exception thrown: "java.lang.IndexOutOfBoundsException: Index: 6, Size: 4" (#22)

77 views
Skip to first unread message

Neva Durand

unread,
Jul 4, 2017, 3:59:55 AM7/4/17
to theaidenlab/juicer, 3D Genomics, theaidenlab/juicer, Subscribed

Hello,

The hic file creation stopped when the error was thrown. The awk code looks correct (except for one issue that I will say more about below); however, the hic file creation stopped because there were not enough fields on one line.

I would check that every line has 11 fields; here is a simple script to do that:

awk 'NF!=11{print "Problem at line",NR; exit}' Arrowhead.input

Finally, I see from your pre command that you are sending in the fragment file. There’s no point to doing this if you set the fragment number to 0 and 1. In other words, you should drop the “-f mm9_DpnII.txt”, or if you want fragment delimited resolutions, use the following code:

samtools view read1_2.hicup.bam | awk 'BEGIN {FS="\t"; OFS="\t"} {name1=$1; str1=and($2,16); chr1=substr($3, 4); pos1=$4; mapq1=$5; cigar1=$6; seq1=$10; getline; name2=$1; str2=and($2,16); chr2=substr($3, 4); pos2=$4; mapq2=$5; cigar2=$6; seq2=$10; if(name1==name2) { if (chr1>chr2){print str2, chr2, pos2, str1, chr1, pos1, mapq2, cigar2, seq2, mapq1, cigar1, seq1, name2, name1} else {print str1, chr1, pos1, str2, chr2, pos2, mapq1, cigar1, seq1, mapq2, cigar2, seq2, name1, name2}}}' | sort -k3,3d -k7,7d > fragment.input
perl fragment.pl fragment.input Arrowhead.input mm9_DpnII.txt

And then use the same command as before to create the .hic file.

We do recommend using the Juicer pipeline for creating these files; we handle duplicates and chimeras differently from other pipelines, the details of which are available in the supplementary materials of Rao&Huntley et al. | Cell 2014 and Durand&Shamim et al. | Cell Systems 2016.

Best

Neva


On Tue, Jul 4, 2017 at 4:25 AM, lwtan90 <notifi...@github.com> wrote:

Hi,

I generated the input file for pre from BAM file (generated by Babraham HiCUPs) with the kind solution provided in this forum. Subsequently, I ran pre command, and have generated the .hic file. I am not sure if it is successful as I have encountered an exception.

java.lang.IndexOutOfBoundsException: Index: 6, Size: 4 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at java.util.Collections$UnmodifiableList.get(Collections.java:1211) at juicebox.tools.utils.original.AsciiPairIterator.advance(AsciiPairIterator.java:143) at juicebox.tools.utils.original.AsciiPairIterator.next(AsciiPairIterator.java:247) at juicebox.tools.utils.original.Preprocessor.computeWholeGenomeMatrix(Preprocessor.java:496) at juicebox.tools.utils.original.Preprocessor.writeBody(Preprocessor.java:374) at juicebox.tools.utils.original.Preprocessor.preprocess(Preprocessor.java:286) at juicebox.tools.clt.old.PreProcessing.run(PreProcessing.java:105) at juicebox.tools.HiCTools.main(HiCTools.java:97)
My question is how do I know if the hic file generated was complete and did not stop at the point where the exception was thrown?

Thank you.

PS:
Code for converting bam to input file for pre:
samtools view read1_2.hicup.bam | awk 'BEGIN {FS="\t"; OFS="\t"} {name1=$1; str1=and($2,16); chr1=substr($3, 4); pos1=$4; mapq1=$5; getline; name2=$1; str2=and($2,16); chr2=substr($3, 4); pos2=$4; mapq2=$5; if(name1==name2) { if (chr1>chr2){print name1, str2, chr2, pos2,1, str1, chr1, pos1, 0, mapq2, mapq1} else {print name1, str1, chr1, pos1, 0, str2, chr2, pos2 ,1, mapq1, mapq2}}}' | sort -k3,3d -k7,7d > Arrowhead.input
my command for generating .hic file:
java -Xmx2g -jar /mnt/projects/wlwtan/cardiac_epigenetics/george/juicer/juicer_tools.1.6.2_linux_jcuda.0.8.jar pre -f mm9_DpnII.txt -q 30 Arrowhead.input Arrowhead.hic mm9


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.




--
Neva Cherniavsky Durand, Ph.D.
Staff Scientist, Aiden Lab
Reply all
Reply to author
Forward
0 new messages