from Bio import SeqIO
path_to_file = ("/Users/richard/Desktop/AllSurfaceGlycoproteinSeqs.fasta")
with open(path_to_file, mode='r') as handle:
out = open("/Users/name/Desktop/texas1.fasta", 'w')
for record in SeqIO.parse(handle, 'fasta'):
identifer
我正在开发一个多平台的应用程序,它在Android,IOS和网络上工作。我为每个平台调用了不同的服务,在其中一个服务中,我使用FileReader()从web版本上传文件,它可以工作,但如果我不注释FileReader()对象,它就不让我编译安卓版本,以下是输出: Launching lib/main.dart on Mi 9T in debug mode...
Running Gradle task 'assembleDebug'...
Unhandled exception:
Crash when compiling file:///Users/danielcardona
我是编程领域的新手,我试图掌握python循环背后的结构和逻辑。有谁能给我解释一下,为什么这东西不起作用?
from Bio.SeqUtils import GC
from Bio import SeqIO
i = 0
record = SeqIO.read(open("group_%d.fasta"), "fasta")% i
for x in record.seq:
print GC(record.seq)
i+=1
上面的代码会产生以下错误:
IOError: [Errno 2] No such file or directory:
我有一个包含数百条记录的fasta文件,但我试图返回一个只包含前20条记录(记录描述、AA长度和名称)的表。
我的代码不工作,我想知道如何只返回前20条记录-最好是以表格式返回。
这是我的python代码:
#!/usr/local/bin/python3
import cgi
import re
form = cgi.FieldStorage()
from Bio import SeqIO
for index, record in enumerate(SeqIO.parse("e_coli_k12_dh10b.faa", "fasta")): print(re
我有一个python脚本如下:
#!/usr/bin/python
from Bio import SeqIO
fasta_file = "input.fa" # Input fasta file
wanted_file = "A_ids.txt" # Input interesting sequence IDs, one per line
result_file = "A.fasta" # Output fasta file
wanted = set()
with open(wanted_file) as f:
for line i
关于.fasta文件的快速背景,从第一行开始的每一行都以>开头,之后我们有标题名称。文件中没有其他地方可以找到>。因为有时候合并2个fasta文件会导致非唯一的头名,所以我想要一个简单的脚本,使每个头名都是唯一的。
我有:
for i in {1..4013}; do awk '/>/{c++;if(c=='"$i"'){sub(">",">'"$i"'_")}}1' Combined_Pass_2D_nanocorrect_round1_renamed
我对python相当陌生,而且我的python脚本(split_fasta.py)也有问题。下面是我的问题的一个例子:
list = ["1.fasta", "2.fasta", "3.fasta"]
for file in list:
contents = open(file, "r")
for line in contents:
if line[0] == ">":
new_file = open(file + "_chromosome.fa
我认为这对你来说是一个简单的问题,因为我是python3的初学者。当打印fasta文件的标题时,它包含括号。我怎么才能把它们移除?
import sys
from Bio import Entrez
from Bio import SeqIO
#define email for entrez login
db = "nuccore"
Entrez.email = "someone@email.com"
#load accessions from arguments
if len(sys.argv[1:]) > 1:
accs
我对python非常陌生,我正在尝试将它嵌入到bash脚本中。我有以下bash脚本:
#!/bin/bash
while read line
do
ORD=`echo $line | cut -c 1-7`
if [[ -r ../FASTA_SEC/COMBI_RAW/${ORD}_COMBI_RAW.fa ]]
then
touch ../Results/Log_Files/Log_${ORD}.txt
for (( win = 2; win < 20; win += 2 )); do
printf &
我对perl和一般的编程都很陌生。在过去的几天里,我一直在寻找如何计算模式匹配的数量;我很难理解其他解决方案,并将它们应用到我已经编写的代码中。
基本上,我有一个序列,我需要找到与TCCCTGGAAGC匹配的所有模式
我想我已经记下来了。但是我被困在计算每个模式匹配的出现次数。有没有人知道如何编辑我已经需要做的代码?欢迎任何建议。谢谢!
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
# open fasta file for reading
unless( open( FASTA, "<",
我有一个带索引的words表(language_id,state)。以下是解释分析的结果:
无限制
explain analyze SELECT "words".* FROM "words" WHERE (words.language_id = 27) AND (state IS NULL);
Bitmap Heap Scan on words (cost=10800.38..134324.10 rows=441257 width=96) (actual time=233.257..416.026 rows=540556 loops=1)
Recheck C
在我的Python程序中,我有可以打开输入文件的行:
f = open('/home/han/fasta.txt',"r")
并编写输出文件:
with open("output.txt", "w") as text_file:
text_file.write ("{:<16}{:<16}{:<16}{:<16}{:<16}".format('','A','C','G','T')+'\n
我编写了下面的函数,作为通过web接口处理FASTA格式化文件的更大应用程序的一部分。出于某种原因,当从baseCounts()内部调用我的baseCounts()函数时,它决定进入无穷大。值得注意的是,这两个函数都由同一个父函数封装。
函数baseCounts()以100+ long数组的形式返回有效数据,console.log确认这不是罪魁祸首,所以问题必须是makePretty()。
欢迎任何帮助。
function baseCount(records){
// Count instances of Bases in array
var basecounts = Array(
我试图用python编写一个脚本来解析一个大型的fasta文件,因为我正在学习脚本,所以我不想使用biopython。脚本需要将登录号、序列长度和序列gc内容打印到控制台。我已经能够提取登录号,但无法提取序列,因为它们被读取为行,这使我无法计算序列长度和gc内容。
有人能帮我吗?我尝试在列表中对行进行分组,但是这会在一个列表中创建多个列表,我也不知道如何加入它们。
seq=""
seqcount=0
seqlen=0
gc=0
#prompt user for file name
infile=input("Enter the name of your designa