Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bionode-sam

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bionode-sam - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

35

cli.js

@@ -10,3 +10,2 @@ #!/usr/bin/env node

console.log(command)
// if (args.length === 0) { throw Error('Please specify command and files') }

@@ -20,10 +19,30 @@ // else if (args.length === 1) { throw Error('Please provide a SRA file') }

var samStream = sam(args)
process.stdin.setEncoding('utf8');
samStream.on('data', function(data) {
process.stdout.write(data[0]+' -> '+data[1]+'\n')
})
if (!process.stdin.isTTY) {
process.stdin.on('data', function(data) {
var data = data.trim()
if (data === '') { return }
args.push(data.trim())
var samStream = sam(args)
samStream.pipe(JSONstringify()).pipe(process.stdout)
samStream.on('error', console.log)
})
}
samStream.on('error', function(error) {
console.error(error)
})
else {
var samStream = sam(args)
samStream.pipe(JSONstringify()).pipe(process.stdout)
samStream.on('error', console.log)
}
function JSONstringify() {
var stream = through.obj(transform)
return stream
function transform(obj, enc, next) {
try { obj = JSON.stringify(obj) }
catch(e) {}
if (obj !== '') { this.push(obj + '\n') }
next()
}
}

@@ -37,6 +37,6 @@ var path = require('path')

if (Arg1Ext === 'sam' && Arg2Ext === 'bam') {
if (Arg1Ext === 'sam') {
// sam to bam conversion
// samtools view -bS -o aln.bam aln.sam
console.log('sam -> bam')
obj[1] = obj[1] || obj[0].replace('.sam', '.bam')
multi = true

@@ -58,2 +58,8 @@ var samToBam = spawn(samPath, [ 'view', '-bS', '-o', obj[1].replace('.bam', '.unsorted.bam'), obj[0] ])

else {
var output = {
sam: obj[0],
bam: obj[1],
operation: "sam -> bam"
}
self.push(output)
next()

@@ -102,3 +108,3 @@ }

else if (obj[0].indexOf('.fa') !== -1 && Arg2Ext === 'bam' && Arg3Ext === 'bcf') {
else if (obj[0].indexOf('.fna') !== -1 && Arg2Ext === 'bam' && Arg3Ext === 'bcf') {
// bam to bcf conversion with reference

@@ -105,0 +111,0 @@ // samtools mpileup -C50 -uf ref.fa aln.bam > aln.bcf

{
"name": "bionode-sam",
"description": "Node.js wrapper for samtools.",
"version": "0.0.3",
"version": "0.0.4",
"homepage": "http://github.com/bionode/bionode-sam",

@@ -6,0 +6,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc