Skip to content
Browse files

minor fixes.

  • Loading branch information...
1 parent 11e31fa commit f34f64a8224a48da1818039ad88d2be496a2290b @vadimzalunin committed
View
2 README
@@ -66,6 +66,8 @@ D read positions flanking a deletion
M reads with mapping quality score higher than 40
m reads with mapping quality score lower than 40
+By default no qualkity scores will be preserved.
+
Check for more on our web site:
http://www.ebi.ac.uk/ena/about/cram_toolkit
View
BIN cramtools-1.0.jar
Binary file not shown.
View
15 src/main/java/net/sf/cram/Bam2Cram.java
@@ -251,7 +251,7 @@ public static void main(String[] args) throws IOException,
SAMRecord samRecord = iterator.next();
samRecords.add(samRecord);
seqName = samRecord.getReferenceName();
- prevSeqId = samRecord.getReferenceIndex() ;
+ prevSeqId = samRecord.getReferenceIndex();
if (samFileReader.getFileHeader().getReadGroups().isEmpty()
|| samFileReader.getFileHeader().getReadGroup(
@@ -270,7 +270,6 @@ public static void main(String[] args) throws IOException,
QualityScorePreservation preservation = new QualityScorePreservation(
params.qsSpec);
-
byte[] ref = sequence.getBases();
OutputStream os;
@@ -278,8 +277,10 @@ public static void main(String[] args) throws IOException,
if (params.outputCramFile != null) {
FileOutputStream fos = new FileOutputStream(params.outputCramFile);
os = new BufferedOutputStream(fos);
- index = new Index(new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(
- new File(params.outputCramFile + ".crai")))));
+ if (params.createIndex)
+ index = new Index(new GZIPOutputStream(
+ new BufferedOutputStream(new FileOutputStream(new File(
+ params.outputCramFile + ".crai")))));
} else {
log.warn("No output file, writint to STDOUT.");
os = System.out;
@@ -380,7 +381,8 @@ public static void main(String[] args) throws IOException,
iterator.close();
samFileReader.close();
os.close();
- index.close() ;
+ if (index != null)
+ index.close();
StringBuilder sb = new StringBuilder();
sb.append(String.format("STATS: core %.2f b/b", 8f * coreBytes / bases));
@@ -447,5 +449,8 @@ public static void main(String[] args) throws IOException,
@Parameter(names = { "--input-is-sam" }, description = "Input is in SAM format.")
boolean inputIsSam = false;
+
+ @Parameter(names = { "--create-index" }, hidden = true, description = "Create index file.")
+ boolean createIndex = false;
}
}
View
33 src/main/java/net/sf/cram/stats/CompressionHeaderFactory.java
@@ -125,18 +125,17 @@ public CompressionHeader build(List<CramRecord> records) {
}
{ // read name encoding:
- // HuffmanParamsCalculator calculator = new
- // HuffmanParamsCalculator();
- // for (CramRecord r : records)
- // calculator.add(r.getReadName().length());
- // calculator.calculate();
- //
- // h.eMap.put(EncodingKey.RN_ReadName, ByteArrayLenEncoding.toParam(
- // HuffmanIntegerEncoding.toParam(calculator.values(),
- // calculator.bitLens()), ExternalByteArrayEncoding
- // .toParam(readNameID)));
- h.eMap.put(EncodingKey.RN_ReadName,
- ByteArrayStopEncoding.toParam((byte) 0, readNameID));
+ HuffmanParamsCalculator calculator = new HuffmanParamsCalculator();
+ for (CramRecord r : records)
+ calculator.add(r.getReadName().length());
+ calculator.calculate();
+
+ h.eMap.put(EncodingKey.RN_ReadName, ByteArrayLenEncoding.toParam(
+ HuffmanIntegerEncoding.toParam(calculator.values(),
+ calculator.bitLens()), ExternalByteArrayEncoding
+ .toParam(readNameID)));
+ // h.eMap.put(EncodingKey.RN_ReadName,
+ // ByteArrayStopEncoding.toParam((byte) 0, readNameID));
}
{ // records to next fragment
@@ -174,7 +173,8 @@ public CompressionHeader build(List<CramRecord> records) {
h.eMap.put(EncodingKey.TN_TagNameAndType, HuffmanIntegerEncoding
.toParam(calculator.values(), calculator.bitLens()));
-// h.eMap.put(EncodingKey.TN_TagNameAndType, ExternalByteArrayEncoding.toParam(tagValueExtID));
+ // h.eMap.put(EncodingKey.TN_TagNameAndType,
+ // ExternalByteArrayEncoding.toParam(tagValueExtID));
}
{ // tag values
@@ -220,9 +220,10 @@ public CompressionHeader build(List<CramRecord> records) {
c.bitLens()),
ExternalByteArrayEncoding.toParam(tagValueExtID)));
}
-
- for (Integer key:h.tMap.keySet()) {
- log.debug(String.format("TAG ENCODING: %d, %s", key, h.tMap.get(key))) ;
+
+ for (Integer key : h.tMap.keySet()) {
+ log.debug(String.format("TAG ENCODING: %d, %s", key,
+ h.tMap.get(key)));
}
// for (CramRecord r : records) {

0 comments on commit f34f64a

Please sign in to comment.
Something went wrong with that request. Please try again.