Hot answers tagged

9 votes

How I can change the name of multiple files at once in R or terminal?

Use perl-rename. This is usually called rename on Debian-based systems like Ubuntu or Mint, and ...
terdon's user avatar
  • 9,846
6 votes
Accepted

Writing a perl script to holding information for two genes

Perhaps this small test script will help demonstrate some of the principles: ...
Alex Reynolds's user avatar
5 votes
Accepted

How I can change the name of multiple files at once in R or terminal?

just to complete your question, you can do it in R in one line. After setting the directory as your working directory, just type the following: ...
dc37's user avatar
  • 1,021
5 votes

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 ...
Devon Ryan's user avatar
  • 19.6k
5 votes

For what bioinformatics tasks is Biopython more adapted than Bioperl?

Regading the perl vs python discussion, there is no final answer which language is better, but I have some advice for you: Learn the language your colleagues or your advisor use. This way you are ...
Wayne_Yux's user avatar
  • 280
5 votes

For what bioinformatics tasks is Biopython more adapted than Bioperl?

Currently you could use either but a major question is which platform will others be using in the future. AFAIK Perl is only superior to Python for regex. Based on the trend I see for new programmers ...
story's user avatar
  • 1,573
4 votes

For what bioinformatics tasks is Biopython more adapted than Bioperl?

This usually comes down to religious issues, so let me try and steer it back to more objective grounds: What language do you know (better)? Use the library for that one. If you know neither and will ...
agapow's user avatar
  • 788
4 votes

Convert population allele count into population allele frequency by using Perl or Python (translate available Bash into Perl or Python)

I don't know how fast you need it to be, but this R solution runs on 20 million SNPs in under 2 min on my laptop: ...
heathobrien's user avatar
  • 1,816
4 votes
Accepted

Bioperl - how can i print first result of search sequence per iteration?

In the simplest case, if you just want to stop after the first record was printed, you can just add exit (I also corrected the syntax errors you had and added ...
terdon's user avatar
  • 9,846
4 votes
Accepted

Pattern mining from a genomic sequence

echo ">ATGCTTATTGCCCATTTCGTGCATGCATATGCGCATTCGCGATCGATTAGGGATAT" | grep -oP 'TTCG[CGT][ATGC]{1,15}TTCG[CGT]' [CGT] looks ...
haci's user avatar
  • 4,032
3 votes

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 ...
Alex Reynolds's user avatar
3 votes

How I can change the name of multiple files at once in R or terminal?

EDIT: (Based on the comments by @terdon, with minor changes) Try this Perl one-liner. It is recommended for general use, even if your file names contain "unexpected" characters such as newlines. <...
Timur Shtatland's user avatar
3 votes

How I can change the name of multiple files at once in R or terminal?

If your filenames do not contain blank spaces, you can do it with a for-loop in bash: Make a test run with echo so that the ...
Soerendip's user avatar
  • 1,295
3 votes
Accepted

assigning different characters to present and absent genes from blast output using perl or python

I wouldn't do this in Python, myself. This is a very simple text parsing problem and the standard *nix tools will be able to do it very easily. For example with awk:...
terdon's user avatar
  • 9,846
3 votes
Accepted

How to loop multiple function in shell script?

You don't need a loop. You can do the whole thing with a simple awk one-liner: awk -vRS='>' 'FNR>1{ printf ">%s",$0 > "gene"FNR-1".fasta"}' org*fasta ...
terdon's user avatar
  • 9,846
3 votes
Accepted

Barrnap Bacterial rRNA Predictor script permission denied error when running Prokka

My suggestion is to run prokka from within conda by simply downloading miniconda then ...
M__'s user avatar
  • 12.1k
2 votes

replacing SNPs with missing calls with a specific string

A possible approach in plain python: ...
bli's user avatar
  • 3,130
2 votes

Writing a perl script to holding information for two genes

The following Perl documentation pages should be informative: split - for splitting a scalar at all matches of a defined pattern perlreftut - discusses the approach of anonymous variables and how to ...
gringer's user avatar
  • 13.9k
2 votes

assigning different characters to present and absent genes from blast output using perl or python

Here is a way to do it using a python dictionary: ...
bli's user avatar
  • 3,130
2 votes

assigning different characters to present and absent genes from blast output using perl or python

Using python it should be relatively trivial, using sets. The following snippet works with your pangenome file and one blast ...
mgalardini's user avatar
2 votes
Accepted

How to separate a microbial strain of MTB resistant and susceptible drugwise?

Since this involves combining multiple conditions, it is easier (and certainly more readable if you ever need to come back to it later) to write a script to do this. For example, in perl: ...
terdon's user avatar
  • 9,846
2 votes

Error while performing "lift-over" of genomic coordinates between two species using Ensembl Compara API

While I wouldn't consider this as the best answer or solution - I decided to use Ensembl REST api to extract the coordinates of alignment blocks. The quick fix - in python looks like this: ...
Siddharth's user avatar
  • 345
2 votes
Accepted

Multi-line efetch digging

Not exactly what you were looking for but may be you can use something like this? ...
vkkodali's user avatar
  • 1,266
2 votes

How about BioMoose?

I fear this entire thread is going to veer dangerously close to opinionation. But regardless of how one feels about the Perl language and its various libraries and communities, I think we can ...
Daniel Standage's user avatar
2 votes

storing SNPs in the genotype file for each chromosome in a separate file

I believe a pandas approach would be fast enough (probably faster than any other Python approach without pandas). After converting your table to a ...
haci's user avatar
  • 4,032
2 votes
Accepted

how to use list of gene id to get cds sequence(cds fasta file have many annotation, only gene id: is same to query id)

If you can use awk, you could use this simple script: ...
mrhd's user avatar
  • 363
2 votes

Removing stop codons from alignment file for dn/ds calculation

I would align your sequences with the software available here: https://github.com/veg/hyphy-analyses/tree/master/codon-msa
Alex's user avatar
  • 21
2 votes
Accepted

How to know if ID correspond to nucleotide sequence or protein with a script

If these are all GenBank or RefSeq accessions, you can use Entrez Direct for this as shown below: ...
vkkodali's user avatar
  • 1,266
2 votes

Using txt file to query Ensembl API

Similar to reading files in other languages, it is necessary to trim the newlines from each line. If you add chomp; to the first line of the ...
Throckmorton's user avatar
2 votes
Accepted

Running Bionano´s HybridScaffolding from the command line [Error: align0.stdout]

I was able to spot the problem. I thought the Server I was working on had at least 256 RAM. Turns out it only had 64. I think HybridScaffolding needs at least 128 RAM. So when I ran the whole ...
snakelake's user avatar

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