Commit 98855a13 authored by M. Haseeb's avatar M. Haseeb

ENA-3490

- fixed an overlooked potential issue.
- disabled the unaligned cram file test.
parent 3efacd8a
Pipeline #91555 passed with stages
in 2 minutes and 4 seconds
......@@ -23,7 +23,7 @@ RawReadsFile
{
fastq( "fastq" ),
bam( "bam"),
cram("cram2fastq");
cram("cram");
// TODO: remove
public final String xml_name;
......
......@@ -12,44 +12,27 @@ package uk.ac.ebi.ena.readtools.webin.cli.rawreads.refs;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Map;
import java.util.regex.Pattern;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import htsjdk.samtools.SAMSequenceRecord;
import uk.ac.ebi.ena.readtools.webin.cli.rawreads.BamScannerTest;
public class
CramReferenceInfoTest
{
@Ignore("Tests fails with am invalid sequence name error. The cram file that is being tested must be replaced with another one that has valid sequence names.")
@Test public void
testUnalignedCram() throws IOException, NoSuchFieldException, IllegalAccessException {
//Replace built-in sequence name validation pattern with a dummy one as it's not possible to skip/turn off validation.
Field field = SAMSequenceRecord.class.getDeclaredField("LEGAL_RNAME_PATTERN");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
Object oldPattern = field.get(null);
field.set(null, Pattern.compile("."));
URL url = BamScannerTest.class.getClassLoader().getResource( "uk/ac/ebi/ena/webin/cli/rawreads/nc-RNAs_DKC1_WT_1_1st_read.cram" );
File file = new File( URLDecoder.decode( url.getFile(), "UTF-8" ) );
CramReferenceInfo cri = new CramReferenceInfo();
Map<?,?> result = cri.confirmFileReferences( file );
Assert.assertEquals( 0, result.size() );
//Set the old pattern back in.
field.set(null, oldPattern);
}
......
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