# Tag Info

10

No, there is currently no GFF support in biopython. However, you can read in GFF files into python using this package, gffutils. There are also a few other packages to read/write GFF files, like gff3.

6

One can get it to work by using SeqIO.InsdcIO.GenBankCdsFeatureIterator: from Bio import SeqIO file_name = 'NC_000913.3.gb' # stores all the CDS entries all_entries = [] with open(file_name, 'r') as GBFile: GBcds = SeqIO.InsdcIO.GenBankCdsFeatureIterator(GBFile) for cds in GBcds: if cds.seq is not None: cds.id = cds.name ...

4

This has been answered before. See: https://stackoverflow.com/a/55402322/6262370 In short, you need to either use rettype='gbwithparts' or rettype='gb', style='withparts' to download the entire genbank flat file.

3

3

If you change the delimiter to something besides a space in the tr command (tr "\"" "\t") then you can use that same delimiter in the awk command (-F "\t"). In my example below I used a tab, also I filtered the taxon prior to the tr so that you don't have to worry about that staying in sync if you change the delimiter. egrep -v "/db_xref=\"taxon"| tr "\"" ...

2

I would use BCBio for gff handling as it is written to directly interface with BioPython’s object model. The only downside is that I believe it is no longer actively supported. It is however the package that the BioPython docs use generally. There are plans to properly incorporate GFF/GTF parsers in to BP in the not too distant future according to that link ...

2

I believe seqret is already the simplest approach. If you install the emboss command line utility, genome (file) sizes will not be a problem. You can even install it with conda, see https://anaconda.org/bioconda/emboss. After that, you can use it as the example: seqret -sequence {genome file} -feature -fformat gff -fopenfile {gff file} -osformat genbank -...

2

Using the UniProt website API (https://www.uniprot.org/help/api) this could be done with a query like https://www.uniprot.org/uniprot/?query=name%3A%22type%20IV%20secretion%20protein%20Rhs%22&columns=id%2Centry%20name%2Creviewed%2Cprotein%20names%2Cgenes%2Cgo(biological%20process)%2Cgo(molecular%20function)%2Cgo(cellular%20component)&sort=score or, ...

2

The CrazyDoc Python package can convert Genbank/Fasta/Snapgene/MSDoc sequences into Biopython records, which can be saved as Genbank or Fasta. A web interface / demo is provided at EGF CUBA (Collection of Useful Biological Apps): Convert Sequence Files. Disclaimer: I'm the current maintainer of CrazyDoc.

2

Okay, I'll provide a formal answer, Genbank phylogeny is to get a gist of the diversity. It isn't a formal phylogenetic analysis. You can down the tree as a pdf, I don't think you can download the treefile (in fact I'm pretty certain you can't). Genbank will perform a reasonable distance method and from recollection it will "collapse clades", so if you see ...

2

Good question. feature.qualifiers is a dict, if the dict doesn't have that key it will throw a KeyError. The way your code works it expects feature.qualifiers to have 'gene' as a key every time feature.type == 'CDS'. However, it is possible to have feature.type == 'CDS' without a gene entry and in the case of AP019703.1 this comes up before you reach the ...

1

Did you try to fetch from the database nucleotide instead of gene ? # load modules from Bio import SeqIO from Bio import Entrez # Lookup ID search = Entrez.esearch(db='nucleotide', term='Tobacco mosaic virus[Orgn] AND replicase') read = Entrez.read(search) idlist = read["IdList"] # Fetch sequence search = Entrez.efetch(db='nucleotide', id=idlist[...

1

I don't have time to give you a polished fully functional version but this will get you started. The next step will be a bit harder as you will need to capture the start of the first CDS in the chunk and end of the last CDS instead of just hardcoding as I have here. fout = open('/path/first3.gbk','w') for record in SeqIO.parse('/path/NC_000962.3.final.gbk','...

1

You can use NCBI EntrezDirect to download data in GenBank format for a specific region of the sequence as follows: efetch -db nuccore -id NC_000962.3 -format gb -seq_start 1 -seq_stop 99000 > seq.gb

1

You can do this very easily with awk: $awk '/^ {5}\w/{a=1} /\/translation/{a=0}a' file.gb gene complement(8972..9094) /locus_tag="HAPS_0004" /db_xref="GeneID:7278619" CDS complement(8972..9094) /locus_tag="HAPS_0004" /codon_start=1 ... 1 You can simply use grep for this purpose as shown below, grep -v /translation bio.txt | grep -B100000000 /db_xref= > output_file.txt Just make sure that you keep the number with B bigger than the number of lines of your file. If you print the contents of the above file you get your desired output as given below, :~$ cat output_file.txt gene ...

1

You can use BioPerl to do this. Read in the GFF and make gene objects and write out those gene objects in Genbank format. Perhaps this tool (doing the opposite) will get you started: https://metacpan.org/pod/bp_genbank2gff3.pl Here is a script doing what you ask but it doesn't use any libraries (so is probably buggy): https://gist.github.com/avrilcoghlan/...

1

My conclusion from the tree is the fungi appears to be genuine and not an extant contaminant (which is very easily done). It is not Fomitopsis betulina because this is division Basidiomycota. The fungi here is division Ascomycota and these are very distinct from Basidiomycota. There have been many examples of contamination in ancient DNA work, but this ...

1

I read the Biopython Genbank record source code carefully and realized I wasn’t using the Qualifier class correctly. After reading the source code again, I realized I was using the data structure incorrectly. I need to use the Qualifier class to add a key and feature. This is formatted correctly and solves the problem. feature = Feature() # Strict ...

1

The /label=5'ITR is called a qualifier. You can look for those qualifiers: for feature in reference.features: for k, v in feature.qualifiers.items(): if k == "label" and v == ["5' ITR"]: # or "5' ITR" in v print(feature.location)

1

Most GFF parsers handle the work of reading annotation data into objects for convenient data access, but most do not handle the important task of resolving relationships between features. The tag Python library does both, grouping related features together for inspection, traversal, and feature-by-feature processing. CAVEAT: The tag library only supports ...

1

Opinion: I prefer to use EBI/ENA because the turnaround time for "customer service" on editing metadata about a submission is faster than on NCBI. Inquiries to change metadata on NCBI can go unanswered for up to six months in my experience. Answer to your question: No, there are no technical reasons that make it preferable to submit data through one website ...

1

I inquired into the details of the dendrograms after becoming frustrated with the lack of information. As with Ensembl, I'm sure that the folks at NCBI have a standardized pipeline that they run the sequences through to generate these dendrograms as no specific source deserving attribution was mentioned: The tree is based on a pairwise, BLAST comparison of ...

1

I can't quite grok your sorting scheme, but you can use genbankr to read your genbank file into a genomic ranges object in R, and filter/sort it however you like: source("https://bioconductor.org/biocLite.R") biocLite("genbankr") library(genbankr) gb = readGenBank("sequence.gb") subset(cds(gb), gene %in% c('sigE', 'sigG', 'spoIIE', 'sleC', 'REV7')) output: ...

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