【发布时间】:2019-04-15 17:17:07
【问题描述】:
我有一个字符串向量,例如:
x <- c("gene_biotype \"protein_coding\"; transcript_name \"IGHV3-66-201\";
transcript_source \"havana\"; transcript_biotype \"IG_V_gene\";
protein_id \"ENSP00000375041\"; protein_version \"2\"; tag
\"cds_end_NF\"; tag \"mRNA_end_NF\"; tag \"basic\";
transcript_support_level \"NA\";",
"gene_id \"ENSG00000211973\"; gene_version \"2\"; transcript_id
\"ENST00000390633\"; transcript_version \"2\"; exon_number \"1\";
gene_name \"IGHV1-69\"; gene_source \"ensembl_havana\"; gene_biotype
\"IG_V_gene\"; transcript_name \"IGHV1-69-201\"; transcript_source
\"ensembl_havana\"; transcript_biotype \"IG_V_gene\"; protein_id
\"ENSP00000375042\"; protein_version \"2\"; tag \"cds_end_NF\"; tag
\"mRNA_end_NF\"; tag \"basic\"; transcript_support_level \"NA\";",
"gene_id \"ENSG00000211973\"; gene_version \"2\"; transcript_id
\"ENST00000390633\"; transcript_version \"2\"; exon_number \"2\";
gene_name \"IGHV1-69\"; gene_source \"ensembl_havana\"; gene_biotype
\"protein_coding\";")
我需要提取gene_biotype 后面的引用文本(任何字符)。例如:
[1] protein_coding\
[2] IG_V_gene\
[3] protein_coding\
我尝试在 stringr 包中使用 str_extract,但我无法让正则表达式工作。
任何帮助将不胜感激!
【问题讨论】: