Comments (4)
That's great to hear that it's getting use!
Just yesterday, I added fai.chrom_len()
which exposes faidx_seq_len
and I just now pushed a way to expose faidx_iseq by using []. You can see the tests in the commit for an example.
with these changes you can write something like:
for x in 0..fai.len-1:
var L = fai.chrom_len(fai[i])
...
For why/how it is slow, can you show an example so I can test? It should be similar speed to pysam, but it does have to make a copy of the string because (as you know) a cstring is not the same as a string in nim.
Please let me know any additional issues you encounter.
from hts-nim.
and also re the performance, you are compiling with -d:release
yes?
from hts-nim.
Thanks I just saw the chrom_len() after I posted. My test was just chr1
from GRCh38 (https://api.gdc.cancer.gov/data/62f23fad-0f24-43fb-8844-990d531947cf). so fa.get("chr1")
in nim and fa.fetch(region="chr1")
in pysam...
Ok after doing a much better "test" i actually see similar stats:
- python:
169.11user 41.20system 3:30.34elapsed 99%CPU (0avgtext+0avgdata 990340maxresident)k
import pysam
fa = pysam.FastaFile("/mnt/SCRATCH/refdata/GRCh38.d1.vd1.fa")
for i in range(100):
seq = fa.fetch(region="chr1")
fa.close()
- nim:
168.89user 17.64system 3:06.55elapsed 99%CPU (0avgtext+0avgdata 493344maxresident)k
import hts
when isMainModule:
var
fafil = "/mnt/SCRATCH/refdata/GRCh38.d1.vd1.fa"
fa: Fai
chrom = "chr1"
discard open(fa, fafil)
for i in 0..<100:
var bases = fa.get(chrom)
So, I think you can ignore that statement
from hts-nim.
great! let me know if you hit any more issues.
from hts-nim.
Related Issues (20)
- VCF: Clear all INFO field HOT 2
- Multiple iterators with items*(v:VCF) HOT 3
- hts-1.10 assertion failed HOT 3
- bai index HOT 8
- Write to bam/cram instead of sam HOT 3
- Version bump HOT 3
- Static binary not working from AMD nodes HOT 6
- Failure to compile when using new Nim Gas (ORC and ARC) HOT 2
- No public facing method for closing Fai file HOT 3
- Version tag in 0.3.13 is wrong HOT 1
- Static build with libRmath-nim library causing undefined reference HOT 3
- Error: unhandled exception: invalid bgzf file [ValueError]
- Get list of INFO and FORMAT keys from Header HOT 1
- Is there any way to get the variant's row index when using the iterator query() HOT 2
- Modifying GT from ivcf and write to ovcf for multiple pairs of inputs and outputs HOT 6
- Issues with nimble test HOT 6
- Trouble with newRecord "undeclared identifier" in bam HOT 7
- Question about multiple nalts for single record HOT 4
- Question: changing BAM alignment records in place HOT 4
- Closing BGZI gives a 'munmap_chunk(): invalid pointer' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hts-nim.