23 votes
Accepted

Convert a BAM file from one reference to another?

You're the second person I have ever seen using NCBI "chromosome names" (they're more like supercontig IDs). Normally I would point you to a resource providing mappings between chromosome names, but ...
user avatar
  • 19.3k
14 votes

How to convert FASTA to BED

You can do this easily with bioawk, which is a version of awk with added features facilitating bioinformatics: ...
user avatar
  • 2,930
12 votes
Accepted

How to convert fasta file to tab delimited file

If you have multi-line fasta files, as is very common, you can use these scripts1 to convert between fasta and tbl (sequence_name <TAB> sequence) format: ...
user avatar
  • 7,957
12 votes

Convert bam file to highly compressible bam

You can just set the fields you don't need to *: ...
user avatar
  • 19.3k
11 votes

How to convert FASTA to BED

It's good practice to have your FASTA indexed, so you can leverage the .fai you are likely to already have. If not, you can just ...
user avatar
11 votes
Accepted

BAM to BigWig without intermediary BedGraph

This can be done in R very easily from an indexed .bam file. Given single-end file for sample1. ...
user avatar
  • 1,468
11 votes

How to convert fasta file to tab delimited file

There is a very simple BioPython solution, that is minimal, readable, and handles multi-line fasta: ...
user avatar
  • 3,462
8 votes
Accepted

How to convert a binary matrix of gene presence or absence into a fasta sequence

It's not a fasta file, but: ...
user avatar
  • 19.3k
8 votes

How to convert fasta file to tab delimited file

assuming there is only one sequence line per record, use paste with two 'stdin' cat your.fasta | paste - -
user avatar
  • 1,473
7 votes

How to convert fasta file to tab delimited file

You can use these commands: perl -pe 's/>(.*)/>\1\t/g; s/\n//g; s/>/\n>/g' sequences.fa | grep -v '^$' Explanation: Append a tab to every header ...
user avatar
7 votes
Accepted

How to transform a DNAStringSet from the Bioconductor package Biostrings to a data frame?

According to the documentation (?Biostrings::DNAStringSet): width(x): A vector of non-negative integers containing the number ...
user avatar
6 votes

How to convert FASTA to BED

You could adapt this awk one-liner. Note that it assumes that sequence IDs are not longer than 100 characters and that there is no description following the sequence ID on the header line. ...
user avatar
  • 646
6 votes
Accepted

How to convert fastq to fast5

NOTICE: I have altered my answer slightly from the original as I have turned the original script into a pip installable program (with tests) and have updated the ...
user avatar
6 votes
Accepted

How to convert BED to GFF3

Galaxy has API and API-consuming libraries (such as BioBlend) that will allow you to interactively script against it without opening the graphical interface at all. However you can also take almost ...
user avatar
  • 176
6 votes
Accepted

How to extract / convert gff3 CDS sequences to multifasta

I like bedtools getfasta. My typical option set is bedtools getfasta -fi <reference> -bed <gff_file> -name -s. Be ...
user avatar
  • 2,566
5 votes
Accepted

How to safely and efficiently convert subset of bam to fastq?

I'm not aware of any pre-made program to do this, so I wrote one for you. This will take a BAM file with any ordering and produce properly ordered gzipped fastq files with the filtering as you ...
user avatar
  • 19.3k
5 votes
Accepted

How to convert GFF3 to GTF2

The following bit of python code should work: ...
user avatar
  • 19.3k
5 votes

How to convert the .vcf (imputed) file with GT:GP format to GT:DS?

You can do this in Hail. Here's the rough code to do it (0.1 versions). Setup: from hail import * hc = HailContext() Import the .gen file. VCF works too: <...
user avatar
  • 151
5 votes

How to convert fasta file to tab delimited file

A very useful tool for this kind of data manipulation is bioawk: ...
user avatar
  • 2,930
5 votes
Accepted

Convert SRA to FastA

Finally, I found an alternative to the SRA translation: a link that works! For those of you interested in knowing how to download FastA files from NCBI using an accession number, try the following ...
user avatar
  • 221
5 votes

Can a gff file be converted to a fasta file?

A gff is a file of annotation. It generally doesn't include sequence information, so you can not inter-convert. But the file on your page has a fasta entry at the bottom.. I'd just grab the bottom ...
user avatar
  • 1,688
5 votes

Can a gff file be converted to a fasta file?

You can use GFF utilities to get a fasta sequence from a GFF file using a reference genome file.
user avatar
  • 321
5 votes
Accepted

How could I match atom orders between a .mol2 and a .pdb?

Atom reordering is a common problem in compchemistry. Rdkit (a python package) can do this, but it is limited by the formats it can read and mol2 files are a bit hit or miss. It works really well ...
user avatar
  • 3,434
4 votes
Accepted

How to convert FASTA to BED

We have many excellent answers! This will be an excellent reference for future users. I found what exactly what I was asking in my question: https://www.biostars.org/p/191052/ ...
user avatar
  • 2,639
4 votes

Convert a BAM file from one reference to another?

The "right" solution would be realignment, but that's expensive and most of us would not go that route. My preferred solution would be to convert the bed file, as opposed to the bam. Here's why: 1) ...
user avatar
4 votes

How to convert FASTA to BED

Here is an approach with BioPython. The with statement ensures both the input and output file handles are closed and a lazy ...
user avatar
  • 3,462
4 votes

How to convert FASTA to BED

Inspired by this answer to a related question on read length distributions, you could do this with Biopython: ...
user avatar
4 votes
Accepted

Customizing bigWig file

There's no equivalent to the wiggle header in bigWig (or bigBed) files, which is why UCSC uses the file name. This is actually the reason for the track line stuff that you linked to, since you can ...
user avatar
  • 19.3k
4 votes
Accepted

How can I convert SCF trace files to ABI files?

Apparently convert_trace does not do a good parameter checking and silently sets ZTR as default if it does not recognise a valid output format. I don't know of any ...
user avatar
  • 744
4 votes

BAM to BigWig without intermediary BedGraph

Just for reference, there is a not very in depth, but first-hand reasoning (Jim Kent) given here about why bedGraphToBigWig does not support streaming http://genome.soe.ucsc.narkive.com/2S1Z3VpG/...
user avatar
  • 186

Only top scored, non community-wiki answers of a minimum length are eligible