Commit 055e7ce6 authored by Charles Girardot's avatar Charles Girardot

corrected bug in which UMI was not added to header in demultiplex-illu

SE mode
parent 6d127999
......@@ -526,9 +526,6 @@ public abstract class AbstractJemultiplexer extends CommandLineProgram {
protected String[] customCommonCommandLineValidation(List<String> messages) {
/*
* Check barcode option are consitent
*
......
......@@ -448,7 +448,8 @@ public class JemultiplexerIllumina extends AbstractJemultiplexer {
}else if(!is_unassigned){
//single end
write(r1, BCLEN_1, XTRIMLEN_1, ZTRIMLEN_1, fwdW, (bc1 == null ? null : bc1.barcode), ADD_BARCODE_TO_HEADER, false);
// write(r1, BCLEN_1, XTRIMLEN_1, ZTRIMLEN_1, fwdW, (bc1 == null ? null : bc1.barcode), ADD_BARCODE_TO_HEADER, false); //bug reported by Mark Heron
writeWithIndexFiles(r1, BCLEN_1, XTRIMLEN_1, ZTRIMLEN_1, fwdW, (bc1 == null ? null : bc1.barcode), ADD_BARCODE_TO_HEADER);
}else{
/*
* is_unassigned == TRUE situation
......@@ -912,7 +913,7 @@ public class JemultiplexerIllumina extends AbstractJemultiplexer {
*/
//clip off the '1:N:0'
String commonHeader = r1.getReadHeader().split("\\s+")[0]; //take any of the two, once '1:N:0' is clipepd they are similar
String commonHeader = r1.getReadHeader().split("\\s+")[0]; //take any of the two, once '1:N:0' is clipped they are similar
if(READ_NAME_REPLACE_CHAR == null){
//then we add back a space
commonHeader += " ";
......
......@@ -30,6 +30,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.embl.cg.utilitytools.utils.StringUtil;
import org.embl.gbcs.je.jemultiplexer.BarcodePosition;
import org.embl.gbcs.je.jemultiplexer.JemultiplexerIllumina;
import org.junit.After;
import org.junit.Assert;
......@@ -91,6 +92,59 @@ public class JemultiplexerIlluminaFunctionalTest extends BaseTesterForJemultiple
}
@Test
public void testWithIndexFilesAndUMISE(){
try {
File bcFile = new File(JemultiplexerIlluminaFunctionalTest.class.getResource("barcodes_SE.txt").toURI()) ;
File f1 = new File(JemultiplexerIlluminaFunctionalTest.class.getResource("file_1_sequence.txt").toURI());
File i1 = new File(JemultiplexerIlluminaFunctionalTest.class.getResource("IDX_1_sequence.txt").toURI());
File outdir = f1.getParentFile();
String[] argv = new String[] {
"F1="+f1.getAbsolutePath(),
"I1="+i1.getAbsolutePath(),
"BF="+bcFile.getAbsolutePath(),
"LEN=8",
"BPOS=READ_1",
"XT=0",
"Q=0", //make sure quality is not considered
"O="+outdir.getAbsolutePath(),
"GZ=false",
"UN=false",
"ASYNC=false",
"READ_NAME_REPLACE_CHAR=:"
};
JemultiplexerIllumina j = new JemultiplexerIllumina();
//parse
Assert.assertEquals(0, j.instanceMain(argv));
Assert.assertTrue(j.ADD_BARCODE_TO_HEADER);
Assert.assertTrue(j.CLIP_BARCODE);
Assert.assertTrue(j.BARCODE_READ_POS == BarcodePosition.READ_1);
Assert.assertNotNull(j.READ_NAME_REPLACE_CHAR);
//check header format
Map<String, String> m = fetchBarcodesInHeader(new File(outdir, "sample1_SE.txt")); //CACTGT is the BC
for (String h : m.values()) {
log.debug(h);
Assert.assertTrue("Wrong sample barcode", h.contains("CACTGT"));
Assert.assertTrue("Wrong UMI length", h.replace("CACTGT:","").length() == 8);
}
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
@Test
public void testWithIndexFilesSE(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment