我有这样的输入文件
@HWI-ST1072:185:C325WACXX:1:1101:8553:1994:1:N:#CAGATT
NGGGGCGATAGAGTAAGATTTTATTTTAAAAAAAAAAAAAAAAATTTAAAA
+
#0<FFBBFFFFFFFBFBFFIIIIIIIIIIIIIIIIIFFFFFB#########
@HWI-ST1072:185:C325WACXX:1:1101:16084:1999:1:N:#CCAATT
NGGAGTGGAGTGGTTGTGGTGGTTTGGGTTGTTGATTGTGTATTTGGAATA
+
#0<FFFFFFFFFFIFFFIIIIIIFFFFFFFBBFBFFIBFFIFIIIFBFFII
@HWI-ST1072:185:C325WACXX:1:1101:16829:1993:1:N:#TGATGT
NGGGTAGTAGTTTGGTGTATGTATTATTGTATATGGCGGTGAGAGTTAGGG
我想在第一行打印带序列的第二行
输出
@HWI-ST1072:185:C325WACXX:1:1101:8553:1994:1:N:#CAGATT
CAGATT
+
#0<FFBBFFFFFFFBFBFFIIIIIIIIIIIIIIIIIFFFFFB#########
@HWI-ST1072:185:C325WACXX:1:1101:16084:1999:1:N:#CCAATT
CCAATT
+
#0<FFFFFFFFFFIFFFIIIIIIFFFFFFFBBFBFFIBFFIFIIIFBFFII
@HWI-ST1072:185:C325WACXX:1:1101:16829:1993:1:N:#TGATGT
TGATGT
答案 0 :(得分:1)
awk -F'#' 'seq{$0=seq;seq=""} /@/{seq=$NF} 1' file
答案 1 :(得分:0)
with open('path/to/input') as infile:
for line in infile:
if line.startswith("@"):
line = line.strip()
print(line)
print(line.rsplit("#", 1)[1])
elif any(line.startswith(e) for e in "#+"):
print(line.strip())