[med-svn] [Git][med-team/chromhmm][upstream] New upstream version 1.21+dfsg
Dylan Aïssi
gitlab at salsa.debian.org
Wed Jul 15 09:19:23 BST 2020
Dylan Aïssi pushed to branch upstream at Debian Med / chromhmm
Commits:
bd1ced35 by Dylan Aïssi at 2020-07-15T10:17:40+02:00
New upstream version 1.21+dfsg
- - - - -
5 changed files:
- README.md
- edu/mit/compbio/ChromHMM/BrowserOutput.java
- edu/mit/compbio/ChromHMM/ChromHMM.java
- edu/mit/compbio/ChromHMM/Preprocessing.java
- edu/mit/compbio/ChromHMM/StateAnalysis.java
Changes:
=====================================
README.md
=====================================
@@ -1,2 +1,2 @@
-See http://compbio.mit.edu/ChromHMM/ or http://www.biolchem.ucla.edu/labs/ernst/ChromHMM/ for more information on ChromHMM.
+See http://compbio.mit.edu/ChromHMM/ or https://ernstlab.biolchem.ucla.edu/ChromHMM/ for more information on ChromHMM.
========
=====================================
edu/mit/compbio/ChromHMM/BrowserOutput.java
=====================================
@@ -385,7 +385,7 @@ public class BrowserOutput
String szID = szFullID.substring(1); //this removes ordering type
if (bfirst)
{
- String szout = "track name=\""+szsegmentationname+"\" description=\" "+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szFullID.charAt(0))
+ String szout = "track name=\""+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szFullID.charAt(0))
+" ordered)"+"\" visibility=1 itemRgb=\"On\""+"\n";
byte[] btformat = szout.getBytes();
pwzip.write(btformat,0,btformat.length);
@@ -433,7 +433,7 @@ public class BrowserOutput
String szID = szFullID.substring(1); //this removes ordering type
if (bfirst)
{
- pw.println("track name=\""+szsegmentationname+"\" description=\" "+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szFullID.charAt(0))
+ pw.println("track name=\""+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szFullID.charAt(0))
+" ordered)"+"\" visibility=1 itemRgb=\"On\"");
bfirst = false;
}
@@ -559,7 +559,7 @@ public class BrowserOutput
if (bgzip)
{
GZIPOutputStream pwzip = new GZIPOutputStream(new FileOutputStream(szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed.gz"));
- String szout = "track name=\"Expanded_"+szsegmentationname+"\" description=\" "+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+ String szout = "track name=\"Expanded_"+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+" ordered)"+"\" visibility=2 itemRgb=\"On\""+"\n";
byte[] btformat = szout.getBytes();
pwzip.write(btformat,0,btformat.length);
@@ -641,7 +641,7 @@ public class BrowserOutput
else
{
PrintWriter pw = new PrintWriter(new FileWriter(szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed"));
- pw.println("track name=\"Expanded_"+szsegmentationname+"\" description=\" "+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+ pw.println("track name=\"Expanded_"+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+" ordered)"+"\" visibility=2 itemRgb=\"On\"");
int nbrowserend = (int) (((Integer)hmchromMax.get(szChroms[0])).intValue()*.001)+1;
pw.println("browser position "+szChroms[0]+":1-"+nbrowserend);
@@ -699,5 +699,308 @@ public class BrowserOutput
pw.close();
}
}
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////
+ /**
+ * Makes a single track browser view of the segmentation represented in szsegmentfile
+ * szcolormapping is a two or three column text file which maps state ID to R,G,B color triples and optionally a state label
+ * Name of segmentation in the browser file is given by szsegmentationame
+ * Output is a file named szoutputfileprefix_browserdense.bed of segmentation viewable with one state per row
+ */
+ public void makebrowserexpandedLowMem() throws IOException
+ {
+ if (bgzip)
+ {
+ System.out.println("Writing to file "+szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed.gz");
+ }
+ else
+ {
+ System.out.println("Writing to file "+szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed");
+ }
+
+ String szLine;
+
+ BufferedReader brsegment = Util.getBufferedReader(szsegmentfile);
+
+ //stores set of chromosomes and labels
+ HashSet hschroms = new HashSet();
+ HashSet hslabels = new HashSet();
+
+ //stores for each chromosome the maximum coordinate
+ HashMap hmchromMax = new HashMap();
+
+
+ //maps a label without the prefix back to the full label
+ HashMap hmlabelToFull = new HashMap();
+
+ String szLabelFull=null;
+ while ((szLine = brsegment.readLine())!=null)
+ {
+ StringTokenizer st = new StringTokenizer(szLine,"\t");
+ String szchrom = st.nextToken();
+ int nbegin = Integer.parseInt(st.nextToken());
+ int nend = Integer.parseInt(st.nextToken());
+ szLabelFull = st.nextToken();
+ String szLabel = szLabelFull.substring(1);
+
+ hmlabelToFull.put(szLabel, szLabelFull);
+
+ hschroms.add(szchrom);
+ hslabels.add(szLabel);
+ //ArrayList alRecs = (ArrayList) hmcoords.get(szchrom+"\t"+szLabel);
+ //if (alRecs ==null)
+ //{
+ //creating first entry for chromsome and coordinate
+ // alRecs = new ArrayList();
+ // hmcoords.put(szchrom+"\t"+szLabel,alRecs);
+ //}
+ //alRecs.add(new BeginEndRec(nbegin,nend));
+
+ //potentially updating maximum coordinate for chromosome
+ Object obj = ((Integer) hmchromMax.get(szchrom));
+ if (obj != null)
+ {
+ int nval = ((Integer) obj).intValue();
+
+ if (nend > nval)
+ {
+ hmchromMax.put(szchrom,Integer.valueOf(nend));
+ }
+ }
+ else
+ {
+ hmchromMax.put(szchrom,Integer.valueOf(nend));
+ }
+ }
+ brsegment.close();
+
+
+ //gets all the state labels and sorts them
+ String[] szLabels = new String[hslabels.size()];
+ Iterator itrLabels = hslabels.iterator();
+ int nindex = 0;
+ while (itrLabels.hasNext())
+ {
+ szLabels[nindex] = (String) itrLabels.next();
+ nindex++;
+ }
+ Arrays.sort(szLabels, new LabelCompare());
+
+ //gets all the chromsomes and sorts them
+ String[] szChroms = new String[hschroms.size()];
+ Iterator itrChroms = hschroms.iterator();
+ nindex = 0;
+ while (itrChroms.hasNext())
+ {
+ szChroms[nindex] = (String) itrChroms.next();
+ nindex++;
+ }
+ Arrays.sort(szChroms);
+
+ if (bgzip)
+ {
+ GZIPOutputStream pwzip = new GZIPOutputStream(new FileOutputStream(szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed.gz"));
+ String szout = "track name=\"Expanded_"+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+ +" ordered)"+"\" visibility=2 itemRgb=\"On\""+"\n";
+ byte[] btformat = szout.getBytes();
+ pwzip.write(btformat,0,btformat.length);
+
+ //pw.println("track name=\"Expanded_"+szsegmentationname+"\" description=\" "+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+ // +" ordered)"+"\" visibility=2 itemRgb=\"On\"");
+ int nbrowserend = (int) (((Integer)hmchromMax.get(szChroms[0])).intValue()*.001)+1;
+
+ szout = "browser position "+szChroms[0]+":1-"+nbrowserend+"\n";
+ btformat = szout.getBytes();
+ pwzip.write(btformat,0,btformat.length);
+ //pwzip.println("browser position "+szChroms[0]+":1-"+nbrowserend);
+
+ for (int nchrom = 0; nchrom < szChroms.length; nchrom++)
+ {
+ HashMap hmcoords = new HashMap();
+ String szcurrchrom = szChroms[nchrom];
+
+ //stores the set of interval coordinates for each chromosome and label
+ brsegment = Util.getBufferedReader(szsegmentfile);
+ while ((szLine = brsegment.readLine())!=null)
+ {
+ StringTokenizer st = new StringTokenizer(szLine,"\t");
+ String szchrom = st.nextToken();
+ if (szchrom.equals(szcurrchrom))
+ {
+ int nbegin = Integer.parseInt(st.nextToken());
+ int nend = Integer.parseInt(st.nextToken());
+ szLabelFull = st.nextToken();
+ String szLabel = szLabelFull.substring(1);
+
+ ArrayList alRecs = (ArrayList) hmcoords.get(szLabel);
+ if (alRecs ==null)
+ {
+ //creating first entry for chromsome and coordinate
+ alRecs = new ArrayList();
+ hmcoords.put(szLabel,alRecs);
+ }
+ alRecs.add(new BeginEndRec(nbegin,nend));
+ }
+ }
+ brsegment.close();
+
+
+ //UCSC browser seems to reverse the ordering of browser track files
+ for (int nlabel = szLabels.length-1; nlabel >=0; nlabel--)
+ {
+ String szcolor = (String) hmcolor.get(""+szLabels[nlabel]);
+ //omits those segment labels not observed at all on chromosome
+
+ ArrayList alRecs = (ArrayList) hmcoords.get(szLabels[nlabel]);
+ if (alRecs == null) continue;
+
+ int nmax = ((Integer) hmchromMax.get(szChroms[nchrom])).intValue();
+
+ //this forces browser to display segment until the end of the chromosome
+ alRecs.add(new BeginEndRec(nmax-1,nmax));
+
+ int nsize = alRecs.size();
+ int nmin = ((BeginEndRec) alRecs.get(0)).nbegin;
+ int nfinalend = nmax;
+
+ String szoutlabel;
+ String szsuffix;
+ if ((szsuffix = (String) hmlabelExtend.get((String) hmlabelToFull.get(szLabels[nlabel])))!=null)
+ {
+ szoutlabel = szLabels[nlabel]+"_"+szsuffix;
+ }
+ else
+ {
+ szoutlabel = szLabels[nlabel];
+ }
+
+ StringBuffer sbout = new StringBuffer();
+ sbout.append(szcurrchrom+"\t"+0+"\t"+nfinalend+"\t"+szoutlabel+"\t0\t.\t"+nmin+"\t"+nfinalend+"\t"+szcolor+"\t"+(nsize+1)+"\t");
+ //pw.print(szChroms[nchrom]+"\t"+0+"\t"+nfinalend+"\t"+szoutlabel+"\t0\t.\t"+nmin+"\t"+nfinalend+"\t"+szcolor+"\t"+(nsize+1)+"\t");
+ //pw.print(0); //forcing the display to start at the beginning of the chromosome
+ sbout.append(0);
+ for (int ni = 0; ni < nsize; ni++)
+ {
+ BeginEndRec theBeginEndRec = (BeginEndRec) alRecs.get(ni);
+ int ndiff = theBeginEndRec.nend - theBeginEndRec.nbegin;
+ sbout.append(",");
+ sbout.append(ndiff);
+ //pw.print(",");
+ //pw.print(ndiff);
+ }
+ sbout.append("\t");
+ sbout.append(0);
+ //pw.print("\t");
+ //pw.print(0);
+ for (int ni = 0; ni < nsize; ni++)
+ {
+ int nloc = ((BeginEndRec) alRecs.get(ni)).nbegin;
+ sbout.append(",");
+ sbout.append(nloc);
+ //pw.print(",");
+ //pw.print(nloc);
+ }
+ sbout.append("\n");
+ // pw.println();
+ btformat = sbout.toString().getBytes();
+ pwzip.write(btformat,0,btformat.length);
+ }
+ }
+ pwzip.finish();
+ pwzip.close();
+ }
+ else
+ {
+ PrintWriter pw = new PrintWriter(new FileWriter(szoutputfileprefix+ChromHMM.SZBROWSEREXPANDEDEXTENSION+".bed"));
+ pw.println("track name=\"Expanded_"+szsegmentationname+"\" description=\""+szsegmentationname+" ("+ChromHMM.convertCharOrderToStringOrder(szLabelFull.charAt(0))
+ +" ordered)"+"\" visibility=2 itemRgb=\"On\"");
+ int nbrowserend = (int) (((Integer)hmchromMax.get(szChroms[0])).intValue()*.001)+1;
+ pw.println("browser position "+szChroms[0]+":1-"+nbrowserend);
+
+ for (int nchrom = 0; nchrom < szChroms.length; nchrom++)
+ {
+ String szcurrchrom = szChroms[nchrom];
+ HashMap hmcoords = new HashMap();
+
+ //stores the set of interval coordinates for each chromosome and label
+ brsegment = Util.getBufferedReader(szsegmentfile);
+ while ((szLine = brsegment.readLine())!=null)
+ {
+ StringTokenizer st = new StringTokenizer(szLine,"\t");
+ String szchrom = st.nextToken();
+ if (szchrom.equals(szcurrchrom))
+ {
+ int nbegin = Integer.parseInt(st.nextToken());
+ int nend = Integer.parseInt(st.nextToken());
+ szLabelFull = st.nextToken();
+ String szLabel = szLabelFull.substring(1);
+
+ ArrayList alRecs = (ArrayList) hmcoords.get(szLabel);
+ if (alRecs ==null)
+ {
+ //creating first entry for chromsome and coordinate
+ alRecs = new ArrayList();
+ hmcoords.put(szLabel,alRecs);
+ }
+ alRecs.add(new BeginEndRec(nbegin,nend));
+ }
+ }
+ brsegment.close();
+
+ //UCSC browser seems to reverse the ordering of browser track files
+ for (int nlabel = szLabels.length-1; nlabel >=0; nlabel--)
+ {
+ String szcolor = (String) hmcolor.get(""+szLabels[nlabel]);
+
+ //omits those segment labels not observed at all on chromosome
+ ArrayList alRecs = (ArrayList) hmcoords.get(szLabels[nlabel]);
+ if (alRecs == null) continue;
+
+ int nmax = ((Integer) hmchromMax.get(szChroms[nchrom])).intValue();
+
+ //this forces browser to display segment until the end of the chromosome
+ alRecs.add(new BeginEndRec(nmax-1,nmax));
+
+ int nsize = alRecs.size();
+ int nmin = ((BeginEndRec) alRecs.get(0)).nbegin;
+ int nfinalend = nmax;
+
+ String szoutlabel;
+ String szsuffix;
+ if ((szsuffix = (String) hmlabelExtend.get((String) hmlabelToFull.get(szLabels[nlabel])))!=null)
+ {
+ szoutlabel = szLabels[nlabel]+"_"+szsuffix;
+ }
+ else
+ {
+ szoutlabel = szLabels[nlabel];
+ }
+
+ pw.print(szcurrchrom+"\t"+0+"\t"+nfinalend+"\t"+szoutlabel+"\t0\t.\t"+nmin+"\t"+nfinalend+"\t"+szcolor+"\t"+(nsize+1)+"\t");
+ pw.print(0); //forcing the display to start at the beginning of the chromosome
+ for (int ni = 0; ni < nsize; ni++)
+ {
+ BeginEndRec theBeginEndRec = (BeginEndRec) alRecs.get(ni);
+ int ndiff = theBeginEndRec.nend - theBeginEndRec.nbegin;
+ pw.print(",");
+ pw.print(ndiff);
+ }
+ pw.print("\t");
+ pw.print(0);
+ for (int ni = 0; ni < nsize; ni++)
+ {
+ int nloc = ((BeginEndRec) alRecs.get(ni)).nbegin;
+ pw.print(",");
+ pw.print(nloc);
+ }
+ pw.println();
+ }
+ }
+ pw.close();
+ }
+ }
}
=====================================
edu/mit/compbio/ChromHMM/ChromHMM.java
=====================================
@@ -1591,7 +1591,7 @@ public class ChromHMM
System.out.println("Writing to file "+szfile);
}
- pw.print("state ("+szorder+" order)");
+ pw.print("State ("+szorder+" order)");
for (int ni = 0; ni < datasets.length; ni++)
{
pw.print("\t"+datasets[colordering[ni]]);
@@ -1644,7 +1644,7 @@ public class ChromHMM
System.out.println("Writing to file "+szfile);
}
- pw.print("state (from\\to) ("+szorder+" order)");
+ pw.print("State (from\\to) ("+szorder+" order)");
for (int ni = 0; ni < numstates; ni++)
{
pw.print("\t"+(ni+1));
@@ -12848,7 +12848,7 @@ public class ChromHMM
if (szcommand.equalsIgnoreCase("Version"))
{
- System.out.println("This is Version 1.20 of ChromHMM (c) Copyright 2008-2012 Massachusetts Institute of Technology");
+ System.out.println("This is Version 1.21 of ChromHMM (c) Copyright 2008-2012 Massachusetts Institute of Technology");
}
else if ((szcommand.equals("BinarizeBam"))||(szcommand.equalsIgnoreCase("BinarizeBed")))
{
@@ -13308,39 +13308,47 @@ public class ChromHMM
boolean bprintimage = true;
int nargindex = 1;
- if (args.length == 5)
+
+ if (args.length <= 2)
{
bok = false;
- try
- {
- if (args[nargindex].equals("-color"))
- {
- String szcolor = args[++nargindex];
- StringTokenizer stcolor = new StringTokenizer(szcolor,",");
- if (stcolor.countTokens()==3)
- {
- nr = Integer.parseInt(stcolor.nextToken());
- ng = Integer.parseInt(stcolor.nextToken());
- nb = Integer.parseInt(stcolor.nextToken());
- }
- else
- {
- bok = false;
- }
- }
- else if (args[nargindex].equals("-noimage"))
- {
- bprintimage = false;
- }
- else
- {
- bok = false;
- }
- }
- catch (NumberFormatException ex)
- {
- bok = false;
- }
+ }
+ else
+ {
+ try
+ {
+ while (nargindex < args.length-3)
+ {
+ if (args[nargindex].equals("-color"))
+ {
+ String szcolor = args[++nargindex];
+ StringTokenizer stcolor = new StringTokenizer(szcolor,",");
+ if (stcolor.countTokens()==3)
+ {
+ nr = Integer.parseInt(stcolor.nextToken());
+ ng = Integer.parseInt(stcolor.nextToken());
+ nb = Integer.parseInt(stcolor.nextToken());
+ }
+ else
+ {
+ bok = false;
+ }
+ }
+ else if (args[nargindex].equals("-noimage"))
+ {
+ bprintimage = false;
+ }
+ else
+ {
+ bok = false;
+ }
+ nargindex++;
+ }
+ }
+ catch (NumberFormatException ex)
+ {
+ bok = false;
+ }
}
if (nargindex != args.length-3)
@@ -13476,7 +13484,7 @@ public class ChromHMM
{
breadposterior = true;
}
- else if (args[nargindex].equals("-readstatesbyline"))
+ else if ((args[nargindex].equals("-readstatesbyline"))||(args[nargindex].equals("-readstatebyline")))
{
breadstatebyline = true;
}
@@ -13602,7 +13610,7 @@ public class ChromHMM
{
bprintposterior = true;
}
- else if (args[nargindex].equals("-printstatesbyline"))
+ else if ((args[nargindex].equals("-printstatesbyline"))||(args[nargindex].equals("-printstatebyline")))
{
bprintstatebyline = true;
}
@@ -13694,7 +13702,7 @@ public class ChromHMM
if (!bok)
{
System.out.println("usage: MakeSegmentation [-b binsize][-f inputfilelist][-gzip][-i outfileID][-l chromosomelengthfile][-lowmem][-many][-nobed]"+
- "[-printposterior][-printstatesbyline][-scalebeta][-splitrows]"+
+ "[-printposterior][-printstatebyline][-scalebeta][-splitrows]"+
" modelfile inputdir outputdir");
}
}
@@ -13703,7 +13711,7 @@ public class ChromHMM
String szcolormapping = null;
String szlabelmapping = null;
boolean bgzip = false;
-
+ boolean blowmem = false;
int nargindex = 1;
int numstates = -1;
@@ -13722,6 +13730,10 @@ public class ChromHMM
//the -l is for backwards compatibility
szlabelmapping = args[++nargindex];
}
+ else if (args[nargindex].equals("-lowmem"))
+ {
+ blowmem = true;
+ }
else if (args[nargindex].equals("-n"))
{
numstates = Integer.parseInt(args[++nargindex]);
@@ -13742,7 +13754,14 @@ public class ChromHMM
BrowserOutput theBrowserOutput = new BrowserOutput(szsegmentfile,szcolormapping,szlabelmapping,
szsegmentationname, szoutputfileprefix,numstates,bgzip);
theBrowserOutput.makebrowserdense();
- theBrowserOutput.makebrowserexpanded();
+ if (blowmem)
+ {
+ theBrowserOutput.makebrowserexpandedLowMem();
+ }
+ else
+ {
+ theBrowserOutput.makebrowserexpanded();
+ }
}
else
{
@@ -13751,7 +13770,7 @@ public class ChromHMM
if (!bok)
{
- System.out.println("usage: MakeBrowserFiles [-c colormappingfile][-gzip][-m labelmappingfile][-n numstates] segmentfile segmentationname outputfileprefix");
+ System.out.println("usage: MakeBrowserFiles [-c colormappingfile][-gzip][-lowmem][-m labelmappingfile][-n numstates] segmentfile segmentationname outputfileprefix");
}
}
else if (szcommand.equalsIgnoreCase("OverlapEnrichment"))
@@ -14323,7 +14342,7 @@ public class ChromHMM
{
bnoorderrows = true;
}
- else if (args[nargindex].equals("-printstatebyline"))
+ else if ((args[nargindex].equals("-printstatebyline"))||(args[nargindex].equals("-printstatesbyline")))
{
bprintstatebyline = true;
}
@@ -14559,7 +14578,14 @@ public class ChromHMM
szprefix,szoutputdir+"/"+szprefix,numstates,bgzip);
theBrowserOutput.makebrowserdense();
- theBrowserOutput.makebrowserexpanded();
+ if (blowmem)
+ {
+ theBrowserOutput.makebrowserexpandedLowMem();
+ }
+ else
+ {
+ theBrowserOutput.makebrowserexpanded();
+ }
if (bgzip)
{
=====================================
edu/mit/compbio/ChromHMM/Preprocessing.java
=====================================
@@ -2487,6 +2487,12 @@ public class Preprocessing
nfilecount++;
}
}
+
+ if (nfilecount == 0)
+ {
+ throw new IllegalArgumentException("No _signal files were found in directory "+szbinneddataDIR);
+ }
+
String[] signalchromfiles = new String[nfilecount];
int nfileindex = 0;
for (int nfile = 0; nfile < allfiles.length; nfile++)
@@ -3110,6 +3116,12 @@ public class Preprocessing
nfilecount++;
}
}
+
+ if (nfilecount == 0)
+ {
+ throw new IllegalArgumentException("No _signal files were found in directory "+szbinneddataDIR);
+ }
+
String[] signalchromfiles = new String[nfilecount];
int nfileindex = 0;
for (int nfile = 0; nfile < allfiles.length; nfile++)
@@ -3979,7 +3991,10 @@ public class Preprocessing
for (int ndir = 0; ndir < hmbrA.length; ndir++)
{
BufferedReader br = (BufferedReader) hmbrA[ndir].get(szcurrfile);
- br.close();
+ if (br != null)
+ {
+ br.close();
+ }
}
}
=====================================
edu/mit/compbio/ChromHMM/StateAnalysis.java
=====================================
@@ -685,13 +685,23 @@ public class StateAnalysis
BufferedReader brinputsegment = Util.getBufferedReader(szinputsegment);
while ((szLine = brinputsegment.readLine())!=null)
{
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
+
String szchrom = st.nextToken();
int nbegincoord = Integer.parseInt(st.nextToken());
int nendcoord = Integer.parseInt(st.nextToken());
if (nbegincoord % nbinsize != 0)
{
- throw new IllegalArgumentException("Binsize of "+nbinsize+" does not agree with input segment "+szLine);
+ throw new IllegalArgumentException("Binsize of "+nbinsize+" does not agree with coordinates in input segment "+szLine+". -b binsize should match parameter value to LearnModel or "+
+ "MakeSegmentation used to produce segmentation. If segmentation is derived from a lift over from another assembly, then the '-b 1' option should be used");
}
int nbegin = nbegincoord/nbinsize;
int nend = (nendcoord-1)/nbinsize;
@@ -1289,13 +1299,23 @@ public class StateAnalysis
BufferedReader brinputsegment = Util.getBufferedReader(szinputsegment);
while ((szLine = brinputsegment.readLine())!=null)
{
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
+
String szchrom = st.nextToken();
int nbegincoord = Integer.parseInt(st.nextToken());
int nendcoord = Integer.parseInt(st.nextToken());
if (nbegincoord % nbinsize != 0)
{
- throw new IllegalArgumentException("Binsize of "+nbinsize+" does not agree with input segment "+szLine);
+ throw new IllegalArgumentException("Binsize of "+nbinsize+" does not agree with coordinates in input segment "+szLine+". -b binsize should match parameter value to LearnModel or "+
+ "MakeSegmentation used to produce segmentation. If segmentation is derived from a lift over from another assembly, then the '-b 1' option should be used");
}
//int nbegin = nbegincoord/nbinsize;
int nend = (nendcoord-1)/nbinsize;
@@ -1431,7 +1451,16 @@ public class StateAnalysis
brinputsegment = Util.getBufferedReader(szinputsegment);
while ((szLine = brinputsegment.readLine())!=null)
{
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
+
String szchrom = st.nextToken();
if (!szchrom.equals(szchromwant))
continue;
@@ -1862,7 +1891,7 @@ public class StateAnalysis
System.out.println("Writing to file "+szoutfile+".txt");
PrintWriter pw = new PrintWriter(new FileWriter(szoutfile+".txt"));
- pw.print("state ("+szstateorder+" order)\tGenome %");
+ pw.print("State ("+szstateorder+" order)\tGenome %");
for (int nfile = 0; nfile < files.length; nfile++)
{
pw.print("\t"+files[nfile]);
@@ -2209,7 +2238,15 @@ public class StateAnalysis
//this loops reads in the segmentation
while ((szLine = brinputsegment.readLine())!=null)
{
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
String szchrom = st.nextToken();
//assumes segments are in standard bed format which to get to
//0-based inclusive requires substract 1 from the end
@@ -2356,8 +2393,16 @@ public class StateAnalysis
while ((szLine = brinputsegment.readLine())!=null)
{
//int numlines = alsegments.size();
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
String szchrom = st.nextToken();
if (!szchromwant.equals(szchrom))
continue;
@@ -2591,7 +2636,15 @@ public class StateAnalysis
//this loops reads in the segmentation
while ((szLine = brinputsegment.readLine())!=null)
{
- StringTokenizer st = new StringTokenizer(szLine,"\t ");
+ StringTokenizer st;
+ if (bstringlabels)
+ {
+ st = new StringTokenizer(szLine,"\t");
+ }
+ else
+ {
+ st = new StringTokenizer(szLine,"\t ");
+ }
String szchrom = st.nextToken();
//assumes segments are in standard bed format which to get to
//0-based inclusive requires substract 1 from the end
@@ -3785,7 +3838,7 @@ public class StateAnalysis
String[] collabels = new String[theRecEmissionFileCompareA.length];
- pwcompare.print("state");
+ pwcompare.print("State");
for (ncol = 0; ncol < theRecEmissionFileCompareA.length; ncol++)
{
collabels[ncol] = ""+theRecEmissionFileCompareA[ncol].numstates;
View it on GitLab: https://salsa.debian.org/med-team/chromhmm/-/commit/bd1ced357ad13d08457efd9f61d467e43cd69cb6
--
View it on GitLab: https://salsa.debian.org/med-team/chromhmm/-/commit/bd1ced357ad13d08457efd9f61d467e43cd69cb6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200715/65d426f9/attachment-0001.html>
More information about the debian-med-commit
mailing list