# Tag Info

Accepted

### How to count reads in bam per bed interval with bedtools

The order of -a and -b switched at some point. You want: ...
• 19.3k
Accepted

Accepted

...
• 19.3k

### Merging regions according to their identifier

If I understand correctly, you could create dummy chromosomes made by merging chromosome and identifier, merge with bedtools, split back chromosomes and identifiers. E.g. ...
• 659
Accepted

### How to create a .bed file from .fasta?

Here is a fun little python script I cooked up for the occasion. It will take a standard fasta file as a command-line argument and turn it into the proper bed format. Using your example fasta: ...
• 601

### Parse out exon coordinates from bed file for each gene

There are multiple ways to go about it. On the command line you can make a 1 line BED file: chr1 11868 12227 And then ...
• 19.3k
Accepted

### Merging bed records based on name

Although you don't mention it, I'm guessing you're using bedtools v2.26.0. Version 2.26.0 of groupBy has a bug in it, which you've encountered (it was fixed shortly after release, so you'll either ...
• 130
Accepted

### How to best detect the "peaks" in RNA-seq data that are not assigned to any gene?

Basically what you're discovering is that there are unannotated expressed features, so your task isn't really finding peaks, but rather finding novel expressed transcripts. For that, you can use ...
• 19.3k

### Merging bed records based on name

You could do this with the CGAT toolkit: cgat bed2bed --method=merge --merge-by-name -I bed_with_gene_ids.bed Installing such ...
• 3,201

### How to create a .bed file from .fasta?

I'm assuming the FASTA header contains all the information you want. You can easily generate a proper bed file with Biopython: ...
• 3,462

### How can I calculate coverage at single bases using a bam file?

Note: not yet tested, so there may be some additional fiddling with command line options needed The per-base depth can be obtained from samtools depth (-a includes zero-coverage positions): ...
• 11.5k

### How can I calculate coverage at single bases using a bam file?

git clone https://github.com/lh3/htsbox cd htsbox && make ./htsbox pileup -cCf ref.fa aln.bam | less -S This output a VCF containing positions covered by ...
• 5,645

### How to do bedtools intersection using pandas alone?

I don't think Pandas has this implemented functionality out-of-the-box. Even if it did, solutions not designed specifically for bioinformatics probably rarely handle intervals on different chromosomes ...
• 4,898
Accepted

### bedtool intersect multiple bed files

If you want to find the intersection between ALL your bedfiles, you can try multiIntersectBed (available since bedtools 2.14.3). It should work like this : ...
Accepted

### How to detect bedtools version used by pybedtools (in order to correctly preserve strand information when merging gtf records)

pybedtools assumes that bedtools is in your path and bedtools itself will return the version with bedtools --version. So: ...
• 19.3k

### Merging regions according to their identifier

Here is a fairly simple (and hopefully readable) native Python solution. It assumes that the bed file is sorted prior to parsing: ...
• 3,462
Accepted

### How to split bedfile into non-overlapping regions and compute aggregation function on duplicate segments

To make disjoint intervals, you could use BEDOPS bedops --partition, piping to bedmap --mean to get the mean signal over ...
• 3,045

### How to create a .bed file from .fasta?

If your headers are always of the form >chrZ:a-b, where chrZ is a chromosome name, a is a ...
• 3,045

### How to create a .bed file from .fasta?

The UCSC format you linked to isn't a BED file, your method should never produce it. What you posted as your desired output is also not a BED file. Below is a BED file: ...
• 19.3k
Accepted

### Comparing two files with overlapping regions and get their associated information

You can use bedtools intersect and cut the results: ...
• 19.3k
Accepted

### Merging regions according to their identifier

The following python script will do what you want and should be relatively memory efficient. It processes a single chromosome at a time, so either sort the input or ensure that at least entries in a ...
• 19.3k

### Parse out exon coordinates from bed file for each gene

Via BEDOPS bedops -n and Unix I/O streams: \$ echo -e "chr1\t11868\t12227" | bedops -n 1 exon.bed - > answer.bed Or, if you ...
• 3,045

### Using column 2 of one file to match with two columns of another file, and append

Pipe a modified form of the second file to BEDOPS bedmap and the first file, then pipe that result to cut out desired columns: ...
• 3,045

### Merging bed records based on name

You can do this easily with Hail. Hail primarily uses BED files to annotate genetic datasets (see the last annotate_variants_table example), but you can manipulate BED files using Hail's general ...
• 261

### Unable to install bedtools on windows 10 ubuntu

My personal advice would be to avoid compiling tools like this if you can avoid it, especially where you are using a "barebones" setup like the one you get with WSL Ubunutu as you'll almost always run ...
• 3,201
Accepted

### Extracting the number SNP in each range

There is like a thousand different ways how to achieve this. You could use a specialised software for this (like bedtools) or calculate it simply in R. R solution: You can make a function that ...
• 5,287
Accepted

### bedtools feature out of bounds

There is no chromosome named chr10, but there is one named 10. The problem is that you're mixing chromosome name systems with a ...
• 19.3k

### bedtools intersect on very large .bam file - -sorted confusion

It sounds like bedtools is behaving properly. The bam file is sorted by read name only if you used the -n option in samtools sort...
• 61