<s> """<STR_LIT>""" <EOL> import six <EOL> try : <EOL> from Bio . SeqFeature import SeqFeature , FeatureLocation <EOL> from Bio import SeqIO <EOL> except ImportError : <EOL> import warnings <EOL> warnings . warn ( "<STR_LIT>" ) <EOL> from . feature import Feature , feature_from_line <EOL> _biopython_strand = { <EOL> '<STR_LIT:+>' : <NUM_LIT:1> , <EOL> '<STR_LIT:->' : - <NUM_LIT:1> , <EOL> '<STR_LIT:.>' : <NUM_LIT:0> , <EOL> } <EOL> _feature_strand = dict ( ( v , k ) for k , v in _biopython_strand . items ( ) ) <EOL> def to_seqfeature ( feature ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( feature , six . string_types ) : <EOL> feature = feature_from_line ( feature ) <EOL> qualifiers = { <EOL> '<STR_LIT:source>' : [ feature . source ] , <EOL> '<STR_LIT>' : [ feature . score ] , <EOL> '<STR_LIT>' : [ feature . seqid ] , <EOL> '<STR_LIT>' : [ feature . frame ] , <EOL> } <EOL> qualifiers . update ( feature . attributes ) <EOL> return SeqFeature ( <EOL> FeatureLocation ( feature . start - <NUM_LIT:1> , feature . stop ) , <EOL> id = feature . id , <EOL> type = feature . featuretype , <EOL> strand = _biopython_strand [ feature . strand ] , <EOL> qualifiers = qualifiers <EOL> ) <EOL> def from_seqfeature ( s , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> source = s . qualifiers . get ( '<STR_LIT:source>' , '<STR_LIT:.>' ) [ <NUM_LIT:0> ] <EOL> score = s . qualifiers . get ( '<STR_LIT>' , '<STR_LIT:.>' ) [ <NUM_LIT:0> ] <EOL> seqid = s . qualifiers . get ( '<STR_LIT>' , '<STR_LIT:.>' ) [ <NUM_LIT:0> ] <EOL> frame = s . qualifiers . get ( '<STR_LIT>' , '<STR_LIT:.>' ) [ <NUM_LIT:0> ] <EOL> strand = _feature_strand [ s . strand ] <EOL> start = s . location . start . position + <NUM_LIT:1> <EOL> stop = s . location . end . position <EOL> featuretype = s . type <EOL> id = s . id <EOL> attributes = dict ( s . qualifiers ) <EOL> attributes . pop ( '<STR_LIT:source>' , '<STR_LIT:.>' ) <EOL> attributes . pop ( '<STR_LIT>' , '<STR_LIT:.>' ) <EOL> attributes . pop ( '<STR_LIT>' , '<STR_LIT:.>' ) <EOL> attributes . pop ( '<STR_LIT>' , '<STR_LIT:.>' ) <EOL> return Feature ( seqid , source , featuretype , start , stop , score , strand , <EOL> frame , attributes , ** kwargs ) </s>
