Unverified Commit 9425069e authored by haseeb-gh's avatar haseeb-gh Committed by GitHub

Merge pull request #1 from enasequence/ENA-3490

Ena 3490
parents 44e11d1b 98855a13
Pipeline #91675 passed with stages
in 2 minutes and 4 seconds
......@@ -15,3 +15,7 @@ gradle-app.setting
/bin/
/.classpath
/.project
/.idea
pom.xml
......@@ -2,6 +2,7 @@ plugins {
id "io.github.ddimtirov.codacy" version "0.1.0"
id 'org.hidetake.ssh' version '2.9.0'
id "com.github.johnrengelman.shadow" version "4.0.1"
id "com.diffplug.gradle.spotless" version "4.5.1"
}
......@@ -20,7 +21,7 @@ wrapper{
group = 'uk.ac.ebi.ena'
ext.version_base = '1.1.11'
ext.version_base = '1.2.0'
version = version_base
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
......@@ -77,7 +78,7 @@ dependencies {
implementation( group: 'net.java.dev.jna', name: 'jna', version: '5.2.0' )
implementation( group: 'org.apache.commons', name: 'commons-compress', version: '1.19' )
implementation( group: 'com.beust', name: 'jcommander', version: '1.72' )
implementation( group: 'com.github.samtools', name: 'htsjdk', version: '2.17.0' )
implementation( group: 'com.github.samtools', name: 'htsjdk', version: '2.21.3' )
implementation( "org.jdom:jdom:2.0.2" )
implementation( group: 'com.google.guava', name: 'guava', version: '27.0.1-jre' )
implementation( group: 'uk.ac.ebi.ena.webin-cli', name: 'webin-cli-validator', version: '1.0.7' )
......@@ -142,3 +143,21 @@ task writePom {
compileJava.dependsOn( writePom )
spotless {
java {
licenseHeader('''/*
* Copyright 2010-2020 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/''')
importOrder 'java', 'javax', 'org', 'com', '', 'uk'
removeUnusedImports()
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.ac.ebi.ena</groupId>
<artifactId>readtools</artifactId>
<version>1.1.11</version>
<inceptionYear>2019</inceptionYear>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.github.samtools</groupId>
<artifactId>htsjdk</artifactId>
<version>2.17.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>uk.ac.ebi.ena.webin-cli</groupId>
<artifactId>webin-cli-validator</artifactId>
<version>1.0.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@NS500217:5:H0LYWAGXX:3:11511:21059:10687
TATGACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCT
+
FFFFAFFFFFFFFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:21511:12020:2129
TATGACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCT
+
FFFFAFFFFFFFF<FFAFFFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF<FFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:11611:19700:17285
CACAAAGCACCCAACTTACACTTAGGAGATTTCAACTTACTTGACCGC
+
FFFFFAFF.FFFF.FFFFFFFFFAFFFFFFFFFF7FFFFFFFF<FFFF
@NS500217:5:H0LYWAGXX:4:23505:18760:12980
CACAAAGCACCCAACTTACACTTAGGAGATTTCAACTTAACTTGACCGC
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:3:23502:21603:13525
TTTGGGGCCTTTGCTTAGTTGTATATAGCCTAGAATTTTTCGTTCGGTAAGCATTAGGAATGCCATTGCGATTAGAATGGGTACAATGAGGAGTAGGAGGTTGGCCAT
+
FFFFFFFFFFFFFFFF<FFFFFAFFFFFFFFAFFFFFFFFFFFFFFFFFFFFFFF<FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:2:12206:18866:15559
ATAATCATAATGGCTATAGCAATAAAACTTGGAATAGCCCCCTTCACTTC
+
FFFAFFFFFFFFFFFFFFFFFFFFFAFFF<FFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:23610:13293:5505
ATAATCATAATGGCTATAGCAATAAAACTAGGAATAGCCCCCTTTCACTTC
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:2:12312:2699:16692
ATAATCATAATGGCTATAGCAATAAAACTAGGAATAGCCCCCTTTCACTTCTCTGAAA
+
.<FAFFAFFF7F<F)FFAFF<A<FAF.FFF<AFAFAFF7)))...FF)<<F7FF)..A
@NS500217:5:H0LYWAGXX:1:21101:20707:18006
GCGGGGAAACGCCATATCGGGGGCACCGATTATTAGGGGAACTAGTCAGTTGCCAAAGCCTCCGATTAT
+
FFFFFFFFFFFFFFFFFFFFFFFFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:13612:25950:16613
CCGTAGGAGGAGACCCCATTCTATACCAACACCTAT
+
FFFFFFFFFFFF7F<FF<FFFFFFFFA7)F<FFFFF
@NS500217:5:H0LYWAGXX:3:22403:3736:18670
CCGTAGGAGGAGACCCCATTCTATACCAACACCTATTCTGATTTTTCGGTCACCCTGAAGTTTATATTCTTATCCTACAGGCTTCG
+
FFFF<FFFFFFF.F.FFFFFFFFF<<FF.F7FFFFF7F<FFFFFAFFFFFF.F.FFFFF..F.FFAFFAF7FFFFF.AFFFFF7FF
@NS500217:5:H0LYWAGXX:2:23103:12271:18797
CCGGAGGAGGAGACCCCATTCTATACCAACACCTATTCTGATTTTTCGGTCACCCTGAAGTTTATATTCTTATCCTACCAGGCTTCG
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFFFFFFFFFFFFFAFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:23503:6059:2979
TTCTTCCCACAACACTTTCTCGTCCTATCCGGAATGCCCCGACGTT
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:21505:25722:12819
TTGTAGACCTACTTGCGCTGCATGTGCCATTAAGATATATAGGATTTAGCCTATAATTTAACTTTGACAAAGTTATG
+
FFFFFFAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAFFFFFFF<FFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:23402:9633:1389
AAGGTGATAAGCTCTTCTATGATAGGGGAAGTAGCGTCTTGTAGACCTACTTGCGCTGCAT
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:4:13501:11745:14464
GAGGACTACTCAAAACCATACCTCTCACTTCAAC
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:3:21502:4087:3595
GAGGACTACTCAAAACCATACCTTTCACTTC
+
FFAFFFFFFFFFAFAFFF<<FFF7FF<FFFF
@NS500217:5:H0LYWAGXX:1:23104:26650:4310
TCGTAAGAAGGCCTAGATAGGGGATTGTGCGGTGTGTGATGCTAGGGTAGATATGATA
+
.FF<A<FF.FF<F.)F)F.FAFA7F.FFF)AFAFAFFF.FF7F<FFF77FF..FF.))
@NS500217:5:H0LYWAGXX:4:22508:2401:19206
TCGTAAGAAGGCCTAGATAGGGGATTGTGCGGTGTGTGATGCTAGGGTAGA
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@NS500217:5:H0LYWAGXX:2:12305:7042:12582
ACCCCATCCAACATCTCCGCATGATGAAACTTCGGCTCACTC
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
This diff is collapsed.
This diff is collapsed.
@HISEQ:115:C48GRACXX:2:2213:14199:71612
ATTCGGCCGGGTTCCCCTTGTCTTGGCCACCCTAAACGAAGTGCTCTCAAACGATGAGGGCGCCCCGGGTGCATCGGCCCCAGAAGAACAACCCCCCCCTT
+
BBBFFFBFFFFFFIIBFIFIIBBFFFFFBFFFFFIIIIFFF'<BFFFIFFFIIFFFFFBF<<BFFFFFF00<BBBFB<BFFBB<7<BBFFB'7<77<BB'0
This diff is collapsed.
This diff is collapsed.
@MS8_28239:1:2103:5729:24131/1
ACCATCCAATTTGATTGGGAATTATCTGTGTTACAAATTTTTGATCCCAGGCTGGTAAAAAATGTAAACTTTTAGCCCATAAGAATAGAAACAGATGCCAGGCCAATAACTCAAACAGAGCTATGACGCTATCAATTTTTAGCAAGACGG
+
11>11@1C@DFFGB3B1FA1A1FG3B3F3B30DFH11AAF21AFHFECGHAGHFCBFHHHHGFGAFHHE2BA1ABFAFGHHBFBHE@GH11F>GHHGHCG1/C/F/B1FF@F1FGHAGC0F1121GGCEGGGHFHEFGG1G0GFH0FGC<
@MS8_28239:1:1102:29533:14840/1
TAGCGTGTATTGTTGCCTTGTACACACCGCTCGTCACGCAATATCAATATACTGGGTATAGAACTCCAGGCGTTAACCTGTAGAGTTGAGATGGAAACAGCCGGAAATGTAATTTTACGCCCTTAACGTAAAGATCATTTATGAAATAGA
+
BCBBABBAFFFFFGGGGGGGGGHHHFEGGGGGAABBBABEFGHHHHHHHHHHHHBGBGHEHHGHHHHHHAFEBFFGHHHHFHHHHGGHGBHHHBFHHHHHHHEGEGG3FFGHHHHHHHGGGGGHHHHGCHHEHFGHHGHHHHHHHHHHHG
@MS8_28239:1:1110:13781:22729/1
TAGCGTGTATTGTTGCTGTGAGGAAACTACATTAAAGGAAATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGAGCCAATATCTCGTATGCCGTCTTCTGCTTGAAAAAAAAAAAAAACACCACGCACCACACCGACATCCA
+
CCCCCCCCFFFFGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHGGGGGHHHGGFGGHHHHHHGHHGHHGGGGGGGGGGHH1GFGGHGHHHHHHGGFHHHHGFGHGHHHHHHGHHFHHGGGGF?---........-::CG..:----:0/0
@MS8_28239:1:2103:5729:24131/2
CTTGAGGCAGTTTGTTCCCTATCTACCGTTTTATCTTTGCATGGATGATGATACGTTAAGTTCTATGAAAAATTTATCCGTCTTGCTAAAAATTGATAGCGTCATAGCTCTGTTTGAGTTATTTGCCTGGCATCTGTTTCTATTCTTATG
+
A1>A11B1>>>3A31B33BFB1A33FG?ABGEGH2GFD112D2ABBG12GE2D1BG0A/FA22DDFFHEHHFGHHGH2AE/FA/1AFH2BGHHHFFHBF1>>EEFFF1@FGB2BFB@/FG2F@2BDEH1CG0G011FGH2FDGHF2>2B1
@MS8_28239:1:1102:29533:14840/2
CCTTTAATGTAGTTTCCTCACAGCTTTATTCGGTCCAAAGTACGCGATCTCTTGTATGGTAATAGGGCTTAAACCAACAACATAACATTTTTTAGTCCCATGCTAATCTATTTCATAAATGATCTTTACGTTAAGGGCGTAAAATTACCT
+
BBBBBFFFFFFFGFGGGGGGGGFHHGBFHHHFBBEEFFHFEGHGGGGGGGHHHGGFHHGGHHHHHFFFHHHFHHHHHGGGHHGHGHGGHHHHGHHGFGHHHFGHGHHBHFHHHHHGHHGHHHHHHHHHHGEGHGBFFGGCFGHGFHHHFH
@MS8_28239:1:1110:13781:22729/2
CCTTTAATGTAGTTTCCTCACCGCAACAATACACCCTAAGATCGGAAGAGCGGCGTGTAGGGGAAGAGTGTAGAGGAAAGTGGAGAACTCCGGGGGCGCCGGCGCCATTAAAAAAAAAAAGAGAAGGAGGATGAGGACAGATAACGCAGG
+
>AAAA1BD3D@B3FG3FAA1A11A0A0AF1B1AB0B00B0B2BGG/AAB0BA//A//?BDFG/?EE0G@F1D121E00B01B1F/101111?E/</<////----<.<0<DFFFCC?-?-..////.....//////---/////-----
/*******************************************************************************
* Copyright 2013 EMBL-EBI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package htsjdk.samtools.cram.encoding.reader;
import java.io.EOFException;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import htsjdk.samtools.cram.encoding.reader.AbstractReader;
import htsjdk.samtools.cram.encoding.reader.DataReader;
import htsjdk.samtools.cram.structure.ReadTag;
import htsjdk.samtools.cram.structure.SubstitutionMatrix;
import htsjdk.samtools.util.SequenceUtil;
public abstract class AbstractFastqReader extends AbstractReader {
private ReadFeatureBuffer rfBuf = new ReadFeatureBuffer();
public boolean reverseNegativeReads = true;
public boolean appendSegmentIndexToReadNames = true;
public byte[] referenceSequence;
public int flags;
public int compressionFlags;
public int mateFlags;
public int readLength;
public int prevAlStart;
public byte[] readName;
public static final int maxReadBufferLength = 1024 * 1024;
public byte[] bases = new byte[maxReadBufferLength];
public byte[] scores = new byte[maxReadBufferLength];
private Map<Integer, Integer> nameCache = new HashMap<Integer, Integer>();
public long counterOffset = 0;
public int defaultQS = '?';
public int ignoreReadsWithFlags = 256 | 2048;
public SubstitutionMatrix substitutionMatrix;
public int recordCounter = 0;
/**
* For now this is to identify the right buffer to use.
*
* @param flags
* read bit flags
* @return 0 for non-paired or other rubbish which could not be reliably
* paired, 1 for first in pair and 2 for second in pair
*/
protected int getSegmentIndexInTemplate(int flags) {
if ((flags & 1) == 0)
return 0;
if ((flags & 64) != 0)
return 1;
else
return 2;
}
protected abstract byte[] refSeqChanged(int seqID);
public void read() throws IOException {
int seqId = refId;
readName = null;
try {
flags = bitFlagsCodec.readData();
compressionFlags = compressionBitFlagsCodec.readData();
if (refId == -2) {
seqId = refIdCodec.readData();
}
readLength = readLengthCodec.readData();
if (APDelta)
prevAlStart += alignmentStartCodec.readData();
else
prevAlStart = alignmentStartCodec.readData();
readGroupCodec.readData();
if (captureReadNames)
readName = readNameCodec.readData();
// mate record:
if ((compressionFlags & CramFlags.DETACHED_FLAG) != 0) {
mateFlags = mateBitFlagCodec.readData();
if (!captureReadNames)
readName = readNameCodec.readData();
mateReferenceIdCodec.readData();
mateAlignmentStartCodec.readData();
insertSizeCodec.readData();
detachedCount++;
} else if ((compressionFlags & CramFlags.HAS_MATE_DOWNSTREAM_FLAG) != 0) {
int distance = distanceToNextFragmentCodec.readData();
nameCache.put(recordCounter + distance + 1, recordCounter);
}
if (readName == null) {
// check cache:
if (nameCache.containsKey(recordCounter)) {
int order = nameCache.remove(recordCounter);
readName = Long.toString(order + counterOffset).getBytes();
} else
readName = Long.toString(recordCounter + counterOffset).getBytes();
}
Integer tagIdList = tagIdListCodec.readData();
byte[][] ids = tagIdDictionary[tagIdList];
if (ids.length > 0) {
for (int i = 0; i < ids.length; i++) {
int id = ReadTag.name3BytesToInt(ids[i]);
DataReader<byte[]> dataReader = tagValueCodecs.get(id);
try {
dataReader.readData();
} catch (EOFException e) {
throw e;
}
}
}
if ((flags & CramFlags.SEGMENT_UNMAPPED_FLAG) == 0) {
byte[] refBases = referenceSequence;
if (seqId != refId)
refBases = refSeqChanged(seqId);
rfBuf.readReadFeatures(this);
rfBuf.restoreReadBases(readLength, prevAlStart, refBases, substitutionMatrix, bases);
mappingScoreCodec.readData();
} else {
for (int i=0; i<readLength; i++)
bases[i] = baseCodec.readData();
}
Arrays.fill(scores, 0, readLength, (byte) (defaultQS - 33));
if ((compressionFlags & CramFlags.FORCE_PRESERVE_QS_FLAG) != 0) {
for (int i=0; i<readLength; i++)
scores[i] = qualityScoreCodec.readData();
} else {
if ((flags & CramFlags.SEGMENT_UNMAPPED_FLAG) == 0) {
rfBuf.restoreQualityScores(readLength, prevAlStart, scores);
}
}
if ((flags & ignoreReadsWithFlags) != 0)
return;
for (int i = 0; i < readLength; i++)
if (scores[i] == -1)
scores[i] = (byte) defaultQS;
else
scores[i] += 33;
if (reverseNegativeReads && (flags & CramFlags.NEGATIVE_STRAND_FLAG) != 0) {
SequenceUtil.reverseComplement(bases, 0, readLength);
SequenceUtil.reverse(scores, 0, readLength);
}
writeRead(readName, flags, bases, scores);
recordCounter++;
} catch (Exception e) {
System.err.printf("Failed at record %d. \n", recordCounter);
if (readName != null)
System.err.println("read name: " + new String(readName));
throw new RuntimeException(e);
}
}
/**
* Write the read. The read here is basically a fastq read with an addition
* of SAM bit flags. Specific implementations should take care of further
* cashing/pairing/filtering and actual writing of reads.
* <p>
* The contract is
* <ul>
* <li>no supplementary reads will appear in this method.
* <li>reads on negative strand will be reverse complimented to appear as if
* on positive strand.
* </ul>
*
* @param name
* read name
* @param flags
* SAM bit flags
* @param bases
* read bases
* @param scores
* fastq quality scores (phred+33)
*/
protected abstract void writeRead(byte[] name, int flags, byte[] bases, byte[] scores);
public abstract void finish();
}
/*
* Copyright 2019 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package htsjdk.samtools.cram.encoding.reader;
/**
* Created by vadim on 28/07/2015.
*/
class CramFlags {
static final int MULTI_FRAGMENT_FLAG = 0x1;
static final int PROPER_PAIR_FLAG = 0x2;
static final int SEGMENT_UNMAPPED_FLAG = 0x4;
static final int NEGATIVE_STRAND_FLAG = 0x10;
static final int FIRST_SEGMENT_FLAG = 0x40;
static final int LAST_SEGMENT_FLAG = 0x80;
static final int SECONDARY_ALIGNMENT_FLAG = 0x100;
static final int VENDOR_FILTERED_FLAG = 0x200;
static final int DUPLICATE_FLAG = 0x400;
static final int SUPPLEMENTARY_FLAG = 0x800;
static final int MATE_NEG_STRAND_FLAG = 0x1;
static final int MATE_UNMAPPED_FLAG = 0x2;
static final int FORCE_PRESERVE_QS_FLAG = 0x1;
static final int DETACHED_FLAG = 0x2;
static final int HAS_MATE_DOWNSTREAM_FLAG = 0x4;
static final int UNKNOWN_BASES = 0x8;
}
/*
* Copyright 2019 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package htsjdk.samtools.cram.encoding.reader;
public interface IRead extends Comparable<IRead> {
public long getAge();
public void setAge(long age);
}
\ No newline at end of file
/*******************************************************************************
* Copyright 2013 EMBL-EBI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package htsjdk.samtools.cram.encoding.reader;
import java.nio.ByteBuffer;
public class ReaderToFastq extends AbstractFastqReader {
public static final int BUF_SIZE = 1024 * 1024 * 10;
public ByteBuffer[] bufs;
public ReaderToFastq() {
this(BUF_SIZE);
}
public ReaderToFastq(int bufSize) {
bufs = new ByteBuffer[3];
for (int i = 0; i < bufs.length; i++)
bufs[i] = ByteBuffer.allocate(bufSize);
}
@Override
protected void writeRead(byte[] name, int flags, byte[] bases, byte[] scores) {
int indexInTemplate = getSegmentIndexInTemplate(flags);
ByteBuffer buf = bufs[indexInTemplate];
buf.put((byte) '@');
buf.put(readName);
if (appendSegmentIndexToReadNames && indexInTemplate > 0) {
buf.put((byte) '/');
byte segmentIndex = (byte) (48 + indexInTemplate);
buf.put(segmentIndex);
}
buf.put((byte) '\n');
buf.put(bases, 0, readLength);
buf.put((byte) '\n');
buf.put((byte) '+');
buf.put((byte) '\n');
if (scores != null)
buf.put(scores, 0, readLength);
else
for (int i = 0; i < readLength; i++)
buf.put((byte) 33);
buf.put((byte) '\n');
}
@Override
public void finish() {
}
@Override
protected byte[] refSeqChanged(int seqID) {
throw new RuntimeException("not implemented.");
}
}
/*******************************************************************************
* Copyright 2013 EMBL-EBI
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package uk.ac.ebi.ena.readtools.cram;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;