Code Monkey home page Code Monkey logo

bioruby-samtools's People

Contributors

andrew avatar bpow avatar danmaclean avatar fstrozzi avatar gusevfe avatar homonecloco avatar jirapong avatar moskyt avatar rjpbonnal avatar stveep avatar wwood avatar yp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bioruby-samtools's Issues

Writing alignments to file

Is it possible to write alignments to file?

E.g. I want to process an existing .bam file by removing a part of the sequence. How do I do that?

Parsing Alignment Object

First, thanks for implementing this, it has been very handy for me. I was wondering if there were methods available to iterate through an alignment object for each residue position and specifically look for differences between the query and target sequences. The way the alignment object looks to be structured, I can get access to the individual query and target sequences, but it looks like the only way to actually get the alignment is to parse the cigar string, and recreate the alignment from that? Is there a way to easily do that? My google foo is failing me here, but maybe you can point me in the right direction?

Thanks in advance!

Dependency issues

I was trying to install bio-samtools and I got a long error that boiled down to this:

gcc -c -g -Wall -O2 -m64 -fPIC  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1 -I. bgzf.c -o bgzf.o
In file included from /usr/include/stdio.h:28:0,
             from bgzf.c:29:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

I was able to get past that by installing the package gcc-multilib (I'm on Ubuntu Oneiric). Then ran into this one:

/usr/bin/ld: skipping incompatible /lib/libncurses.so.5 when searching for libncurses.so.5
/usr/bin/ld: cannot find libncurses.so.5
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../libtinfo.so when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../libtinfo.a when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/libtinfo.so when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/libtinfo.a when searching for -ltinfo
/usr/bin/ld: cannot find -ltinfo
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[1]: *** [samtools] Error 1
make[1]: Leaving directory `/home/ben/.rvm/gems/ruby-1.9.3-p125/gems/bio-samtools-0.5.2/ext/samtools-0.1.18'

This is using 1.9.3. Is there an easy fix for this? I'm kind of content not to worry about fixing it as I can just use another computer, but still, annoying.. For the record I'm able to compile samtools directly without issue.

Is there any way to specify an existing samtools installation instead of getting bio-samtools to download and compile? Maybe some flag with I run gem install bio-samtools? This may also be useful for people using other platforms - I notice there's a line e.g. sh "tar xvfj samtools-0.1.18.tar.bz2" in the ext/Rakefile that is unlikely to work on windows (I'm guessing, untested).

Review the new options for sort

Samtools 1.x has different options to sort. Right now, the unit test pass, but we need to check all the possible options.

Bioruby-samtools fails to install samtools

When untarring the samtools bzip file: (stdin) is not a bzip file.

Running ruby 2.2.1 installed fresh from RVM on Arch linux

>gem install bio-samtools-2.3.3.gem 
Fetching: bio-svgenes-0.4.1.gem (100%)
Successfully installed bio-svgenes-0.4.1
Fetching: bio-1.5.0.gem (100%)
Successfully installed bio-1.5.0
Building native extensions.  This could take a while...
ERROR:  Error installing bio-samtools-2.3.3.gem:
        ERROR: Failed to build gem native extension.

    /home/matt/.rvm/rubies/ruby-2.2.1/bin/ruby mkrf_conf.rb

/home/matt/.rvm/rubies/ruby-2.2.1/bin/ruby -rubygems /home/matt/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/rake-10.4.2/bin/rake RUBYARCHDIR=/home/matt/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/bio-samtools-2.3.3 RUBYLIBDIR=/home/matt/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/bio-samtools-2.3.3
tar xvfj samtools-0.1.19.tar.bz2
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now
rake aborted!
Command failed with status (2): [tar xvfj samtools-0.1.19.tar.bz2...]
/home/matt/.rvm/gems/ruby-2.2.1/gems/bio-samtools-2.3.3/ext/Rakefile:18:in `block in <top (required)>'
Tasks: TOP => default => compile
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /home/matt/.rvm/gems/ruby-2.2.1/gems/bio-samtools-2.3.3 for inspection.
Results logged to /home/matt/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/bio-samtools-2.3.3/gem_make.out




>cd /home/matt/.rvm/gems/ruby-2.2.1/gems/bio-samtools-2.3.3/ext
>ls -la
-rw-r--r-- 1 matt users  560 Oct 21 19:54 Makefile-bioruby.patch
-rw-r--r-- 1 matt users  264 Oct 21 19:54 Makefile-suse.patch
-rw-r--r-- 1 matt users 1.5K Oct 21 19:54 mkrf_conf.rb
-rw-r--r-- 1 matt users 1.2K Oct 21 19:54 Rakefile
-rw-r--r-- 1 matt users  639 Oct 21 19:54 samtools-0.1.19.tar.bz2
>file samtools-0.1.19.tar.bz2
samtools-0.1.19.tar.bz2: HTML document, ASCII text

Undefined variable "files" in Bio/DB/Sam.rb:28 in initialize

Found and fixed a teeny issue. Recently installed bio-samtools today, 2015/02/25 and encountered an error:

NameError: undefined local variable or method files' for #<Bio::DB::Sam:0x00000001ecb868> from /home/mrals/.rvm/gems/ruby-2.1.2/gems/bio-samtools-2.3.0/lib/bio/db/sam.rb:28:ininitialize'
from (irb):3:in new' from (irb):3 from /home/mrals/.rvm/rubies/ruby-2.1.2/bin/irb:11:in

'

This was resolved by inspecting the initialize method, at line 28, where the IOError refers to a "files" variable that was defined, and likely corresponds to the variable "@files." This fixed the error for me during initialization of a Bio::DB::Sam object. Cheers and thank you!

bio-samtools fail to compile samtools binary due to non-allowed redirection

gem install bio-samtools -v '2.3.3' Building native extensions. This could take a while... ERROR: Error installing bio-samtools: ERROR: Failed to build gem native extension. rake aborted! redirection forbidden: http://sourceforge.net/projects/samtools/files/samtools/1.2/samtools-1.2.tar.bz2/download -> https://sourceforge.net/projects/samtools/files/samtools/1.2/samtools-1.2.tar.bz2/download rake failed, exit code 1

i see that this has been fixed with v2.3.5

could you please publish this to rubygems

alternatively you could also include github link to samtools archive instead of sourceforge links
https://github.com/samtools/samtools/releases

Bio::DB::Sam class fetch/view does not recognize chromosomes; samools executes correctly.

Hello again. I am walking through your wiki and encountering some problems. After loading a file, I'm trying to interact with the alignment objects although the fetch and view methods don't recognize the chromosome that the reads are aligned to (see the header and sample read below). However, the samtools command below is executing correctly. How can I facilitate this?
bio-samtools v2.3.2

>bam=Bio::DB::Sam.new(:bam=>"test_files/test.bam",:fasta=>"test_files/NC_001988.ffn") && bam.open
>bam.fetch("NC_001988.2",0,200) {|x| puts "HELLO"}
Exception: [view] The sequence NC_001988.2 is not in the bam file
    from /Users/Matthew/.rvm/gems/ruby-2.1.2@lci/gems/bio-samtools-2.3.2/lib/bio/db/sam.rb:67:in `view'
    from /Users/Matthew/.rvm/gems/ruby-2.1.2@lci/gems/bio-samtools-2.3.2/lib/bio/db/sam.rb:96:in `fetch'
    from (irb):4
    from /Users/Matthew/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'

>puts `samtools view -h test_files/test.bam NC_001988.2:0-200 | head`
@HD VN:1.0  SO:coordinate
@SQ SN:NC_003030.1  LN:3940880
@SQ SN:NC_001988.2  LN:192000
@PG ID:bowtie2  PN:bowtie2  VN:2.1.0
HWI-ST741:439:H9G3UADXX:2:2103:18990:5489_2:N:0:ATCACG  153 NC_001988.2 7   0   8M2D68M =   7   0   TTGATGGATATAGCATATTTAGGAGGTATTTAAAATGAAAGAATATAAATATACTGTTATTACAGGAGCAAGTACG    JIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJIJJJJJJJJJJJHJJJJJJJJJJHHHHHFFFFFBCC    AS:i:-39    XN:i:0  XM:i:5  XO:i:1  XG:i:2  NM:i:7  MD:Z:0A1A3C1^AT65T1A0   YT:Z:UP

Bio::DB::Sam#mpileup doesn't escape cmdline args

If the name of the reference sequence has | characters in it, the mpileup call fails. e.g. "gi|308171891|ref|NC_014551.1|:1-4"

Gives this error

sh: 1: 308171891: not found
sh: 1: ref: not found
sh: 1: NC_014551.1: not found

This is caused by this line

sam_command = "#{File.join(File.expand_path(File.dirname(__FILE__)),'sam','external','samtools')} mpileup #{sam_opts.join(' ')} 2> /dev/null"

because the | characters are interpreted as pipes. Maybe use Bio::Command instead? It maybe doesn't matter too much in this case, but in general I think it is bad security practice to unescape cmdline parameters like this. This I learned from little bobby tables' mum, but I know from second-hand experience as well (not bio-samtools specifically).

ld returning exit 1 from GCC while compiling extension

Any additional information I can provide?

>which ruby
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-linux]
> bundle install
...
make[1]: Leaving directory '/home/matt/.rvm/gems/ruby-2.1.10@gemset/gems/bio-samtools-2.5.1/ext/samtools-1.3.1/htslib-1.3.1'
gcc -pthread -rdynamic   -o samtools bam_index.o bam_plcmd.o sam_view.o bam_cat.o bam_md.o bam_reheader.o bam_sort.o bedidx.o kprobaln.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o sam_opts.o cut_target.o phase.o bam2depth.o padding.o bedcov.o
bamshuf.o faidx.o dict.o stats.o stats_isize.o bam_flags.o bam_split.o bam_tview.o bam_tview_curses.o bam_tview_html.o bam_lpileup.o bam_quickcheck.o bam_addrprg.o libbam.a htslib-1.3.1/libhts.a -lcurses -lm -lz -ldl
/usr/bin/ld: bam_tview_curses.o: undefined reference to symbol 'keypad'
/usr/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:138: samtools] Error 1
rake aborted!
Command failed with status (2): [make...]

Error during installation

Trying to install on Ubuntu 22.04, and get this error. Does anyone know how to fix it?

$ sudo gem install bio-samtools
Building native extensions. This could take a while...
ERROR: Error installing bio-samtools:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/3.0.0/gems/bio-samtools-2.6.2/ext

/usr/bin/ruby3.0 mkrf_conf.rb

current directory: /var/lib/gems/3.0.0/gems/bio-samtools-2.6.2/ext
/usr/bin/ruby3.0 -I/usr/lib/ruby/vendor_ruby -rrubygems /usr/share/rubygems-integration/all/gems/rake-13.0.6/exe/rake RUBYARCHDIR=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/bio-samtools-2.6.2 RUBYLIBDIR=/var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/bio-samtools-2.6.2
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - https://github.com/samtools/samtools/releases/download/1.6/samtools-1.6.tar.bz2
/var/lib/gems/3.0.0/gems/bio-samtools-2.6.2/ext/Rakefile:11:in initialize' /var/lib/gems/3.0.0/gems/bio-samtools-2.6.2/ext/Rakefile:11:in open'
/var/lib/gems/3.0.0/gems/bio-samtools-2.6.2/ext/Rakefile:11:in block in <top (required)>' /usr/share/rubygems-integration/all/gems/rake-13.0.6/exe/rake:27:in

'
Tasks: TOP => default => download
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /var/lib/gems/3.0.0/gems/bio-samtools-2.6.2 for inspection.
Results logged to /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/bio-samtools-2.6.2/gem_make.out

iterating alignments

Hi,

Just wondering if there is any way to iterate over all alignments in a sam/bam file, without specifying a chromosome & start and stop positions?

i'm thinking an each_alignment method, like iterating over the lines from a samtools view, except giving Alignment objects, rather than a string.

Thanks,
ben

installing while offline

The gem downloads samtools when installing. That can be a serious problem if you need to install it somewhere without internet access -- packaging the gem does not help.

Is there a good way to overcome this? I am not sure if it is feasible to package samtools, if only for licensing issues.

I would be happy to implement the solution if it is decided how it should be done.

Query fasta regions/Fasta database

Hi all,
I'm in the need to iterate over all the references in a fasta file (fasta sequence, pileup and bam entries). I want to do this in parallel and I want some sort of reflexion fromt he Fasta file.
I'm writing a module to wrap this functionality, named

Bio::DB::Fasta

In principle, it is similar to the counterpart in bioperl (http://search.cpan.org/~cjfields/BioPerl-1.6.901/Bio/DB/Fasta.pm)
But the difference here is that it will be mounted on the C API of samtools (basically, because I know how to call it).

First, I'm wondering if someone is aware of somebody working on something like this. Secondly, I want to hear suggestions. At the minute, my priorities are:

-Load a hash with all the contigs/sequences and their length
-Query the full sequence
-Query a region
-Iterate over all the sequences (get all the names of the fasta file, in the order given by the Fai)
-Iterate over a "chunk" of sequences (If you have 100 sequences, you can do some task on 10 blocks of 10 sequences, for example, this should be useful to run in parallel in a cluster).

My main container (at the minute) lives on

Bio::DB::Fasta::FastaFile
Which contains an array of
Bio::DB::Fasta::Entry
and which you query by requesting a
Bio::DB::Fasta::Region

The idea is to have something more than the function

fetch_reference(chromosome, qstart,qend)

Does anyone have suggestions? I think it is too small and too coupled with bioruby-samtools to make a new gem, but I could make a new one if seems appropriate.

Ricardo.

Missing SAMtools methods

SAMtools v1.2 now contains the following methods, missing from bioruby-samtools

'split' splits a file by read group
'bam2fq' converts a BAM to a FASTQ (although extract_reads() does a very similar job)
'stats' generate stats
'flags' explain BAM flags

uninitialized constant Bio::DB::SAM::Tools::FFI

I have downloaded the source and installed the gem using rake install.

However when running the test as ruby test/basictest.rb it reports the following error:
uninitialized constant Bio::DB::SAM::Tools::FFI

samtools sourceforge download fails from open-uri: 'redirection forbidden'

Error building with ruby 2.1.10 due to open-uri. The mkrf_conf.rb and Rakefile both contain http sourceforge urls. These fail to download properly thanks to open-uri. I am surprised this wasn't tested. Running on Arch linux, ruby 2.1.10 with rvm. More information available on request.

>gem install ./bio-samtools-2.3.0.gem
Building native extensions.  This could take a while...
ERROR:  Error installing ./bio-samtools-2.3.0.gem:
        ERROR: Failed to build gem native extension.

    current directory: /home/matt/.rvm/gems/ruby-2.1.10@ngsci/gems/bio-samtools-2.3.0/ext
/home/matt/.rvm/rubies/ruby-2.1.10/bin/ruby mkrf_conf.rb

current directory: /home/matt/.rvm/gems/ruby-2.1.10@ngsci/gems/bio-samtools-2.3.0/ext
/home/matt/.rvm/rubies/ruby-2.1.10/bin/ruby -rubygems /home/matt/.rvm/gems/ruby-2.1.10@ngsci/gems/rake-12.2.1/exe/rake RUBYARCHDIR=/home/matt/.rvm/gems/ruby-2.1.10@ngsci/extensions/x86_64-linux/2.1.0/bio-samtools-2.3.0 RUBYLIBDIR=/home/matt/.rvm/gems/ruby-2.1.10@ngsci/extensions/x86_64-linux/2.1.0/bio-samtools-2.3.0
rake aborted!
redirection forbidden: http://sourceforge.net/projects/samtools/files/samtools/0.1.19/samtools-0.1.19.tar.bz2/download -> https://sourceforge.net/projects/samtools/files/samtools/0.1.19/samtools-0.1.19.tar.bz2/download
/home/matt/.rvm/gems/ruby-2.1.10@ngsci/gems/bio-samtools-2.3.0/ext/Rakefile:10:in `block in <top (required)>'
/home/matt/.rvm/gems/ruby-2.1.10@ngsci/gems/rake-12.2.1/exe/rake:27:in `<main>'
Tasks: TOP => default => download
(See full trace by running task with --trace)

rake failed, exit code 1

Supported ruby versions undeclared in gemspec, ext/Rakefile unsupported with ruby 2.4.2

To avoid the Open-URI redirection issue described in #67, I tried installing the 2.3.0 gem for ruby version 2.4.2. In this case, the redirection is successful, but the rake still fails with a nameerror from Config=>RbConfig constant incompatability between ruby versions. Shouldn't the appropriate ruby versions be declared in the gemspec?

cd samtools-0.1.19
patch < ../Makefile-bioruby.patch
patching file Makefile
patch < ../Makefile-suse.patch
patching file Makefile
Hunk #1 succeeded at 15 with fuzz 1 (offset 2 lines).
rake aborted!
NameError: uninitialized constant Config
Did you mean?  RbConfig
/home/matt/.rvm/gems/ruby-2.4.2@ngsci/gems/bio-samtools-2.3.0/ext/Rakefile:23:in `block (2 levels) in <top (required)>'
/home/matt/.rvm/gems/ruby-2.4.2@ngsci/gems/bio-samtools-2.3.0/ext/Rakefile:19:in `block in <top (required)>'
/home/matt/.rvm/gems/ruby-2.4.2@ngsci/gems/rake-12.2.1/exe/rake:27:in `<main>'
Tasks: TOP => default => compile
(See full trace by running task with --trace)

rake failed, exit code 1

Calling Sam#to_s when Fasta file not specified raises an Exception

If the fasta file is not set when calling Sam.new(), then calling to_s will raise an Exception since it attempts to include the fasta file name (nil). It should probably check for nil and then say 'not set' or something.

irb(main):001:0> require 'bio/db/sam'
=> true
irb(main):002:0> sam = Bio::DB::Sam.new(:bam => 'test.bam')
TypeError: can't convert nil into String
        from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bio-samtools-0.2.0/lib/bio/db/sam.rb:77:in `+'
        from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bio-samtools-0.2.0/lib/bio/db/sam.rb:77:in `to_s'
        from /opt/local/bin/irb1.9:12:in `<main>'

rmdups fails using samtools v1.0+

SAMtools rmdup is broken and hence unit test in test_sam.rb test_rmdup() using SAMtools 1.0 and above fail.
The failure of rmdup in SAMtools v1.0+ is well documented.
samtools/samtools#159
samtools/samtools#252
samtools/samtools#138

I'd suggest at least removing the test until it's fixed.

The unit tests also throws an error (rather than a failure) on:
=> 14: File.delete("test/samples/small/dupes_rmdup.bam")

This line should also be removed for now (dupes_rmdup.bam should be the outfile from the rmdup test).

Region loading issue

Hello again, I found a typo "commad" at line 82 of Bio/DB/Sam.rb that was preventing the execution of the region command for the "fetch" and "view" methods. Thank you.

jruby changed RUBY_DESCRIPTION-- need to update regex to determine library extension

The jruby 1.6.8 RUBY description looked something like:
jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_09) [linux-amd64-java]

However, with 1.7.0, it is changed to:
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [linux-amd64]
or on OS X:
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-10M3909 [darwin-x86_64]

The code for loading the shared library needs to be updated (current code looks for /linux.*java/ or /darwin.*java/, perhaps the regex could be something like /jruby.*linux/?).

libbam.so.1 won't compile in bio-samtools on AMD64, same version does from manual make

When I use the rakefile to install the binaries as a developer (e.g. cd ext; ruby mkrf_conf.rb; rake -f Rakefile;) library compilation fails on my AMD64 box at the libbam.so.1 stage. Oddly running the make manually (without applying the patch in mkrf_conf.rb to the makefile) in the same version of samtools runs fine. Is the make being scuppered by the patch. Im not a whizz with makefiles so couldn't track it down...

Same step goes fine on my Mac

heres the tail of the output from failed install

gcc -shared -Wl,-soname,libbam.so -o libbam.so.1 bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o knetfile.o bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o bam_plcmd.o bam2bcf.o bam2bcf_indel.o sample.o bcftools/bcf.o bcftools/bcfutils.o errmod.o bcftools/fet.o -lc -lz
/usr/bin/ld: bcftools/bcf.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
bcftools/bcf.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libbam.so.1-local] Error 1

View and fetch commands don't retrieve region correctly.

When running the fetch method or view method, the samtools command is malformed, returning all the reads in a file.

~/sandbox >gem list | grep bio-samtools
bio-samtools (2.3.3)
~/sandbox >samtools view spec/test_files/test.bam NC_001988.2:75-75
HWI-ST741:439:H9G3UADXX:2:2103:18990:5489_2:N:0:ATCACG  153 NC_001988.2 7   0   8M2D68M =   7   0   TTGATGGATATAGCATATTTAGGAGGTATTTAAAATGAAAGAATATAAATATACTGTTATTACAGGAGCAAGTACG    JIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJIJJJJJJJJJJJHJJJJJJJJJJHHHHHFFFFFBCC    AS:i:-39    XN:i:0  XM:i:5  XO:i:1  XG:i:2  NM:i:7  MD:Z:0A1A3C1^AT65T1A    YT:Z:UP
HWI-ST741:441:H9DFHADXX:1:2214:9303:82237_2:N:0:ATCACG  145 NC_001988.2 10  42  76M =   191913  191979  ATGCAATTATAGCATATTTAGGAGGTATTTAAAATGAAAGAATATAAATATACTGTTATTACAGGAGCAAGGTCAG    GHGEGIJJIJHIIIGJJJJJJJIJIIGGIIJJJIHHHEGDGICIIGIEIIIJIJIHIJGGGIJHHHBFFFFDDB@@    AS:i:-5 XN:i:0  XM:i:1  XO:i:0  XG:i:0  NM:i:1  MD:Z:71T4   YS:i:0  YT:Z:DP
HWI-ST741:439:H9G3UADXX:2:1202:12969:64751_2:N:0:ATCACG 145 NC_001988.2 72  8   76M =   79  83  CCGATCTAGTTCAGGGATAGGATATGAGGCTGCAAAGGCATTTGCAAAAAGAGGAAAAAATTTAATTATTATTGCC    FFIIIIJJIIIJIHIIJJHIGIHGIIJIIJIDIIHEHGHEIIIIJIJJJJJIHFIJJJJJJJJHHHHHEDDFFC@@    AS:i:-27    XN:i:0  XM:i:5  XO:i:0  XG:i:0  NM:i:5  MD:Z:0A0G2G1A68T0   YS:i:-25    YT:Z:DP
HWI-ST741:439:H9G3UADXX:2:1215:16148:36912_2:N:0:ATCACG 145 NC_001988.2 72  8   76M =   79  83  CCGATCTAGTTCAGGGATAGGATATGAGGCTGCAAAGGCATTTGCAAAAAGAGGAAAAAATTTAATTATTATTGCC    EGHHGGHGHHGGHFFGGFEGGFIHGDDCEGJIGHDGIJHFDGIHEIHHABDEJIEGGIJHFGGBBDFFFEDDD?@@    AS:i:-25    XN:i:0  XM:i:5  XO:i:0  XG:i:0  NM:i:5  MD:Z:0A0G2G1A68T0   YS:i:-25    YT:Z:DP
HWI-ST741:439:H9G3UADXX:2:2215:17172:90892_2:N:0:ATCACG 145 NC_001988.2 72  8   76M =   79  83  CCGATCTAGTTCAGGGATAGGATATGAGGCTGCAAAGGCATTTGCAAAAAGAGGAAAAAATTTAATTATTATTGCC    EHAEGIIJIJJJJJJJJJJIIGIIIGGHHIJJJJJIGFIGJIIIIIJJJIF@JJIIHGIIIHGHHHFHEBDFD@@@    AS:i:-26    XN:i:0  XM:i:5  XO:i:0  XG:i:0  NM:i:5  MD:Z:0A0G2G1A68T0   YS:i:-24    YT:Z:DP
HWI-ST741:441:H9DFHADXX:1:2208:19865:81444_2:N:0:ATCACG 145 NC_001988.2 72  42  76M =   191874  191846  AGGAGCAAGTTCAGGGATAGGATATGAGGCTGCAAAGGCATTTGCAAAAAGAGGAAAAAATTTAATTATTATTGCC    CEC;>EAD>GDFFDAFF=8*?D<DBF?293D?FGFB@9GFFCBFE@IIFHBF4FIFHHE9AFIFFDFFDDD=+=1=    AS:i:-4 XN:i:0  XM:i:1  XO:i:0  XG:i:0  NM:i:1  MD:Z:75T0   YS:i:0  YT:Z:DP
HWI-ST741:441:H9DFHADXX:1:2108:13040:98530_1:N:0:ATCACG 99  NC_001988.2 75  42  76M =   83  84  AGCAAGTTCAGGGATAGGATATGAGGCTGCAAAGGCATTTGCAAAAAGAGGAAAAAATTTAATTATTATTGCTAGA    @CCFFFEFFHHGFGIIIJIDHHHGGEGIEHIJIGIIGIHGIIIFDGIJIGFHGIJJJJJIJHHIJHFHEFBEDFFF    AS:i:0  XN:i:0  XM:i:0  XO:i:0  XG:i:0  NM:i:0  MD:Z:76 YS:i:0  YT:Z:CP
 git:master| ~/sandbox >samtools view spec/test_files/test.bam NC_001988.2:75-75 | wc -l
       7
~/sandbox >irb
2.2.1 :001 > require 'bio-samtools'
 => true
2.2.1 :002 > bam=Bio::DB::Sam.new(:bam => "spec/test_files/test.bam", :fasta => "spec/test_files/test.fa")
 => #<Bio::DB::Sam:0x007f802319a668 @fasta="spec/test_files/test.fa", @bam="spec/test_files/test.bam", @samtools="/Users/Matthew/.rvm/gems/ruby-2.2.1@SCI/gems/bio-samtools-2.3.3/lib/bio/db/sam/external/samtools", @bcftools="/Users/Matthew/.rvm/gems/ruby-2.2.1@SCI/gems/bio-samtools-2.3.3/lib/bio/db/sam/external/bcftools", @last_command=nil>
2.2.1 :003 > reads = []
 => []
2.2.1 :004 > bam.fetch("NC_001988.2",75,75) {|x| reads << x}
 => #<Process::Status: pid 66134 exit 0>
2.2.1 :005 > reads.size
 => 36
2.2.1 :006 > reads = []
2.2.1 :007 > bam.view(chr: "NC_001988.2", start: 75, stop: 75) {|x| reads << x}
 => #<Process::Status: pid 66155 exit 0>
2.2.1 :008 > reads.size
 => 36
~/sandbox >samtools view spec/test_files/test.bam | wc -l
      36

fixmate parameters

bioruby-samtools currently only has the -r option implemented. please add options:
-p Disable FR proper pair check
-c Add template cigar ct tag
-O FORMAT Write output as FORMAT ('sam'/'bam'/'cram')

Is this project using FFI? (Question about current status)

Hello, @homonecloco and bioruby-samtools developers.

Thank you for your great work.

I am kojix2 and I'm now trying to develop ruby-htslib.

Before creating ruby-htslib, I looked for similar projects. Because when reinventing the wheel, it's important to observe previous good projects. I found your bioruby-samtools. I read the README of bioruby-samtools. It said it uses FFI.

Binder of samtools for ruby, on the top of FFI.

But, from looking at the project a bit, it doesn't look like there is any part of it that uses FFI.
Instead, it loos like it is using open3.
I think it probably meant that it used FFI in the past, and now using Open3.
Is that right?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.