Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed 'resorces' from build.xml

  • Loading branch information...
commit 69dfe59bc064bbc8c3f98aeb0ccf1b57e233524d 1 parent 98a1772
@vadimzalunin authored
View
25 .classpath
@@ -1,12 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="lib" path="lib/jcommander-1.7.jar"/>
- <classpathentry kind="lib" path="lib/sam-1.79.jar" sourcepath="/picard/src/java"/>
- <classpathentry kind="lib" path="lib/picard-1.79.jar" sourcepath="/picard/trunk/src/java"/>
- <classpathentry kind="lib" path="lib/ega-Cipher.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="lib" path="lib/jcommander-1.7.jar"/>
+ <classpathentry kind="lib" path="lib/sam-1.79.jar" sourcepath="/picard/src/java"/>
+ <classpathentry kind="lib" path="lib/picard-1.79.jar" sourcepath="/picard/trunk/src/java"/>
+ <classpathentry kind="lib" path="lib/ega-Cipher.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
4 build.number
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Tue Nov 20 13:25:29 GMT 2012
-build.number=130
+#Tue Nov 20 15:47:51 GMT 2012
+build.number=137
View
4 build/build.xml
@@ -97,10 +97,10 @@
<exclude name="**/Crambone.java" />
<classpath refid="classpath" />
</javac>
- <copy todir="${classes}">
+ <!-- copy todir="${classes}">
<fileset dir="${basedir}/src/main/resources" includes="**/*">
</fileset>
- </copy>
+ </copy -->
</target>
<target name="help">
View
BIN  cramtools-1.0.jar
Binary file not shown
View
57 src/main/java/net/sf/cram/Bam2Cram.java
@@ -217,32 +217,37 @@ public static void main(String[] args) throws IOException,
System.exit(1);
}
- if (params.bamFile == null) {
- System.out.println("A BAM file is required. ");
- System.exit(1);
- }
-
Log.setGlobalLogLevel(params.logLevel);
char[] pass = null;
if (params.encrypt) {
- if (System.console() == null)
- throw new RuntimeException("Cannot access console.") ;
- pass = System.console().readPassword() ;
+ if (System.console() == null)
+ throw new RuntimeException("Cannot access console.");
+ pass = System.console().readPassword();
}
File bamFile = params.bamFile;
SAMFileReader
.setDefaultValidationStringency(ValidationStringency.SILENT);
- SAMFileReader samFileReader = new SAMFileReader(bamFile);
+
+ SAMFileReader samFileReader = null;
+ if (params.bamFile == null) {
+ log.warn("No input file, reading from input...");
+ samFileReader = new SAMFileReader(System.in);
+ } else
+ samFileReader = new SAMFileReader(bamFile);
+
ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
.getReferenceSequenceFile(params.referenceFasta);
ReferenceSequence sequence = null;
+ List<SAMRecord> samRecords = new ArrayList<SAMRecord>(
+ params.maxContainerSize);
+ SAMRecordIterator iterator = samFileReader.iterator();
{
String seqName = null;
- SAMRecordIterator iterator = samFileReader.iterator();
SAMRecord samRecord = iterator.next();
+ samRecords.add(samRecord);
seqName = samRecord.getReferenceName();
if (samFileReader.getFileHeader().getReadGroups().isEmpty()
@@ -254,21 +259,23 @@ public static void main(String[] args) throws IOException,
samFileReader.getFileHeader().addReadGroup(readGroup);
}
- iterator.close();
sequence = referenceSequenceFile.getSequence(seqName);
}
- List<SAMRecord> samRecords = new ArrayList<SAMRecord>(
- params.maxContainerSize);
QualityScorePreservation preservation = new QualityScorePreservation(
params.qsSpec);
- SAMRecordIterator iterator = samFileReader.iterator();
-
int prevSeqId = -1;
byte[] ref = sequence.getBases();
- FileOutputStream fos = new FileOutputStream(params.outputCramFile);
- OutputStream os = new BufferedOutputStream(fos);
+
+ OutputStream os;
+ if (params.outputCramFile != null) {
+ FileOutputStream fos = new FileOutputStream(params.outputCramFile);
+ os = new BufferedOutputStream(fos);
+ } else {
+ log.warn("No output file, writint to STDOUT.");
+ os = System.out;
+ }
if (params.encrypt) {
CipherOutputStream_256 cos = new CipherOutputStream_256(os, pass,
@@ -276,8 +283,8 @@ public static void main(String[] args) throws IOException,
os = cos.getCipherOutputStream();
}
- CramHeader h = new CramHeader(1, 0, params.bamFile.getName(),
- samFileReader.getFileHeader());
+ CramHeader h = new CramHeader(1, 0, params.bamFile == null ? "STDIN"
+ : params.bamFile.getName(), samFileReader.getFileHeader());
ReadWrite.writeCramHeader(h, os);
long bases = 0;
@@ -286,6 +293,9 @@ public static void main(String[] args) throws IOException,
BLOCK_PROTO.recordsPerSlice = params.maxSliceSize;
do {
+ if (params.outputCramFile == null && System.out.checkError())
+ return;
+
SAMRecord samRecord = iterator.next();
if (samRecord.getReferenceIndex() != prevSeqId
|| samRecords.size() >= params.maxContainerSize) {
@@ -358,7 +368,6 @@ public static void main(String[] args) throws IOException,
iterator.close();
samFileReader.close();
os.close();
- fos.close();
StringBuilder sb = new StringBuilder();
sb.append(String.format("STATS: core %.2f b/b", 8f * coreBytes / bases));
@@ -368,8 +377,9 @@ public static void main(String[] args) throws IOException,
* externalBytes[i] / bases));
log.info(sb.toString());
- log.info(String.format("Compression: %.2f b/b.",
- (8f * params.outputCramFile.length() / bases)));
+ if (params.outputCramFile != null)
+ log.info(String.format("Compression: %.2f b/b.",
+ (8f * params.outputCramFile.length() / bases)));
}
@Parameters(commandDescription = "BAM to CRAM converter. ")
@@ -421,5 +431,8 @@ public static void main(String[] args) throws IOException,
@Parameter(names = { "--capture-all-tags" }, description = "Capture all tags.")
boolean captureAllTags = false;
+
+ @Parameter(names = { "--input-is-sam" }, description = "Input is in SAM format.")
+ boolean inputIsSam = false;
}
}
View
24 src/main/java/net/sf/cram/Cram2Bam.java
@@ -70,31 +70,31 @@ public static void main(String[] args) throws IOException,
System.exit(1);
}
- if (params.cramFile == null) {
- System.out.println("A CRAM input file is required. ");
- System.exit(1);
- }
-
Log.setGlobalLogLevel(params.logLevel);
char[] pass = null;
if (params.decrypt) {
- if (System.console() == null)
- throw new RuntimeException("Cannot access console.") ;
- pass = System.console().readPassword() ;
+ if (System.console() == null)
+ throw new RuntimeException("Cannot access console.");
+ pass = System.console().readPassword();
}
ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
.getReferenceSequenceFile(params.reference);
- FileInputStream fis = new FileInputStream(params.cramFile);
- InputStream is = new BufferedInputStream(fis);
+ InputStream is;
+ if (params.cramFile != null) {
+ FileInputStream fis = new FileInputStream(params.cramFile);
+ is = new BufferedInputStream(fis);
+ } else
+ is = System.in;
+
if (params.decrypt) {
CipherInputStream_256 cipherInputStream_256 = new CipherInputStream_256(
is, pass, 128);
is = cipherInputStream_256.getCipherInputStream();
-// is = new SeekableCipherStream_256(new SeekableFileStream(
-// params.cramFile), pass, 1, 128);
+ // is = new SeekableCipherStream_256(new SeekableFileStream(
+ // params.cramFile), pass, 1, 128);
}
CramHeader cramHeader = ReadWrite.readCramHeader(is);
Please sign in to comment.
Something went wrong with that request. Please try again.